memory-bank/components/supervisor.md
The Supervisor is a critical component that runs inside each Gitpod workspace container. It serves as the init process (PID 1) for the workspace and manages various aspects of the workspace lifecycle, including terminal management, IDE integration, and process control.
The primary purposes of the Supervisor are:
The Supervisor operates as a multi-faceted service with several key components:
The Supervisor is designed to be lightweight but robust, ensuring proper workspace initialization, operation, and termination.
main.go: Entry point that calls the Execute function from the cmd packagecmd/root.go: Defines the root command and basic service configurationcmd/init.go: Implements the init process functionalitycmd/run.go: Implements the main supervisor servicecmd/terminal-*.go: Terminal management commandspkg/: Supporting packages for supervisor functionalityfrontend/: Web UI for workspace accessopenssh/: SSH server integrationcomponents/common-go:lib: Common Go utilitiescomponents/content-service-api/go:lib: Content service API definitionscomponents/content-service:lib: Content service clientcomponents/gitpod-protocol/go:lib: Gitpod protocol definitionscomponents/supervisor-api/go:lib: Supervisor API definitionscomponents/ws-daemon-api/go:lib: Workspace daemon API definitionscomponents/ide-metrics-api/go:lib: IDE metrics API definitionscomponents/public-api/go:lib: Public API definitionsThe Supervisor is configured via a JSON configuration file (supervisor-config.json) that includes:
Additional configuration may be provided through environment variables and command-line flags.
The Supervisor exposes a gRPC API that provides:
The Supervisor integrates with:
The Supervisor is typically used to:
The Supervisor implements sophisticated lifecycle management: