feat: Add workspace agent lifecycle state reporting (#5785)

This commit is contained in:
Mathias Fredriksson
2023-01-24 14:24:27 +02:00
committed by GitHub
parent dbfeb5630c
commit 138887de7e
34 changed files with 1596 additions and 634 deletions

View File

@ -99,6 +99,14 @@ CREATE TYPE user_status AS ENUM (
'suspended'
);
CREATE TYPE workspace_agent_lifecycle_state AS ENUM (
'created',
'starting',
'start_timeout',
'start_error',
'ready'
);
CREATE TYPE workspace_app_health AS ENUM (
'disabled',
'initializing',
@ -448,7 +456,10 @@ CREATE TABLE workspace_agents (
last_connected_replica_id uuid,
connection_timeout_seconds integer DEFAULT 0 NOT NULL,
troubleshooting_url text DEFAULT ''::text NOT NULL,
motd_file text DEFAULT ''::text NOT NULL
motd_file text DEFAULT ''::text NOT NULL,
lifecycle_state workspace_agent_lifecycle_state DEFAULT 'created'::workspace_agent_lifecycle_state NOT NULL,
delay_login_until_ready boolean DEFAULT false NOT NULL,
startup_script_timeout_seconds integer DEFAULT 0 NOT NULL
);
COMMENT ON COLUMN workspace_agents.version IS 'Version tracks the version of the currently running workspace agent. Workspace agents register their version upon start.';
@ -459,6 +470,12 @@ COMMENT ON COLUMN workspace_agents.troubleshooting_url IS 'URL for troubleshooti
COMMENT ON COLUMN workspace_agents.motd_file IS 'Path to file inside workspace containing the message of the day (MOTD) to show to the user when logging in via SSH.';
COMMENT ON COLUMN workspace_agents.lifecycle_state IS 'The current lifecycle state reported by the workspace agent.';
COMMENT ON COLUMN workspace_agents.delay_login_until_ready IS 'If true, the agent will delay logins until it is ready (e.g. executing startup script has ended).';
COMMENT ON COLUMN workspace_agents.startup_script_timeout_seconds IS 'The number of seconds to wait for the startup script to complete. If the script does not complete within this time, the agent lifecycle will be marked as start_timeout.';
CREATE TABLE workspace_apps (
id uuid NOT NULL,
created_at timestamp with time zone NOT NULL,