dev: maintenance
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
# WM-002: Add a non-init supervisor mode
|
||||
|
||||
Let Wingmate run as an ordinary Linux process under an existing init system, in the spirit of Python's Supervisor. It should start and restart configured programs and shut down only the workloads it owns. The existing container init mode remains the default.
|
||||
|
||||
## Scope
|
||||
|
||||
### In scope
|
||||
|
||||
- An explicit opt-in mode for running Wingmate in the foreground as a regular user, without being PID 1.
|
||||
- Start, monitor, and restart foreground services using existing YAML and shell-script configurations. Keep existing cron scheduling for supported foreground jobs and apply the same shutdown rules to running jobs.
|
||||
- Track and reap Wingmate's own child processes. Send shutdown signals only to managed workloads, including descendants that remain in a process group Wingmate created for the workload.
|
||||
- Document how to select the mode, what it can supervise, and how to configure programs to stay in the foreground.
|
||||
|
||||
### Out of scope
|
||||
|
||||
- Changes to PID 1 shutdown behavior or the [PID 1 Docker test](WM-001-docker-shutdown-test.md).
|
||||
- Full Supervisor compatibility, including its configuration format, control socket, web UI, and `supervisorctl`.
|
||||
- Managing unrelated processes or adopting detached daemons. Supporting PID-file proxying and commands that create a separate session in this mode is deferred.
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
- [ ] A documented option starts Wingmate as a non-PID-1, unprivileged Linux process. Existing container invocations still select init mode by default.
|
||||
- [ ] A configured foreground service starts and restarts after an unexpected exit. When Wingmate begins shutting down, it stops starting new services and cron jobs, and it does not restart processes that exit during shutdown.
|
||||
- [ ] On shutdown, Wingmate sends TERM to its managed workloads, waits for a bounded grace period, and sends KILL only to managed workloads that remain. It never broadcasts signals or uses a catch-all child reaper in this mode.
|
||||
- [ ] Unsupported task options, such as `pidfile` and `setsid`, produce a clear error naming the task before any workload starts.
|
||||
- [ ] Tests cover restart, graceful shutdown, and escalation. A Linux integration test runs Wingmate as non-PID 1 inside an isolated PID namespace and verifies that an unrelated process in the same namespace survives both shutdown paths.
|
||||
|
||||
## Implementation notes
|
||||
|
||||
- Give each workload its own process group at launch. Wingmate and unrelated processes must stay outside those groups.
|
||||
- Assign one owner to wait for each direct child. Keep init-mode orphan reaping separate from the non-init execution path.
|
||||
- Synchronize process starts with shutdown so a child cannot start after shutdown has taken its list of workloads to stop.
|
||||
Reference in New Issue
Block a user