lifecycle: ordered startup, supervised services and clean shutdown #5
Notifications
Due Date
No due date set.
Blocks
#8 lifecycle/cli: run commands inside the lifecycle
corestack/go
Reference: corestack/go#5
Reference in new issue
Block a user
Root-module package
go.auvem.com/corestack/lifecycle. Lark Relay's daemons and muxer need it first.Clean-room rewrite. Build from this spec. Don't read or port
gitea.auvem.com/go-toolkit/app.Purpose
Ordered startup and clean shutdown for Go services and daemons, including processes that supervise several long-running services.
Requirements
Setup(ctx) error,Teardown(ctx) error, and an optionalRun(ctx) errorfor long-running services.errors.Join), not just the first.*slog.Logger. No globals and no init side effects.lifecycle/cli(separate issue).Done when
-raceand cover:Exampletest shows a program with two services.Kickoff prompt
One key additional requirement that I think we need to meet. Lifecycle needs to provide the necessary coordination to allow for a bounded, graceful shutdown that cleans up the entire app. This means we'll need to explicitly provide a tooling abstraction to manage the lifecycle of background goroutines / workers, etc.