Documentation
¶
Overview ¶
Package app is starting and stopping services gracefully, using golang.org/x/sync/errgroup to ensure that multiple services are started properly at the same time.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App servers
func (*App) RunWithExitCode ¶
RunWithExitCode runs services with process-supervisor semantics: any completed service triggers cleanup, including an upstream that exits successfully. It returns the child's status after cleanup so main can pass it to os.Exit. Run retains the existing framework lifecycle for applications that prefer it.
type UpstreamConfig ¶
type UpstreamConfig struct {
Args []string `yaml:"args" json:"args"`
Command string `yaml:"command" json:"command"`
Enabled bool `yaml:"enabled" json:"enabled"`
Env map[string]string `yaml:"env" json:"env"`
StopSignal string `yaml:"stopSignal" json:"stopSignal"`
TargetBindSocket string `yaml:"targetBindSocket" json:"targetBindSocket"`
TargetPort int `yaml:"targetPort" json:"targetPort"`
WorkingDirectory string `yaml:"workingDirectory" json:"workingDirectory"`
}
UpstreamConfig configures a supervised local process.
type UpstreamServer ¶
type UpstreamServer struct {
// contains filtered or unexported fields
}
UpstreamServer supervises an upstream command, relaying logs and signals.
func NewUpstreamServer ¶
func NewUpstreamServer(cfg UpstreamConfig) *UpstreamServer
NewUpstreamServer creates a supervisor for the configured upstream command.
func (*UpstreamServer) ExitCode ¶
func (s *UpstreamServer) ExitCode() int
ExitCode returns the upstream's exit status after Start or Stop completes. Unix signal deaths use the shell convention 128 + signal number.
func (*UpstreamServer) SetShutdownSignal ¶
func (s *UpstreamServer) SetShutdownSignal(sig os.Signal)
SetShutdownSignal relays the parent's terminating signal during Stop.
func (*UpstreamServer) Start ¶
func (s *UpstreamServer) Start() error
Start launches the upstream command and blocks until it exits.
func (*UpstreamServer) Stop ¶
func (s *UpstreamServer) Stop() error
Stop attempts to gracefully stop the upstream process.
func (*UpstreamServer) String ¶
func (s *UpstreamServer) String() string
String implements app.IServer for logging purposes.