runtime

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package runtime starts, stops and observes the things Outpost supervises. A Runtime knows how to turn a manifest.Service into a running Handle; it does not decide whether something should be running — that is the supervisor's job.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithoutSecrets added in v0.2.0

func WithoutSecrets(env []string) []string

WithoutSecrets returns env, in os.Environ form, minus the daemon's own credentials, for building a child process's environment.

Types

type Handle

type Handle interface {
	// ID identifies the running instance: its PID.
	ID() string
	PID() int
	Status() Status

	// Done is closed once the instance has exited.
	Done() <-chan struct{}

	// ExitCode is meaningful only after Done is closed; it is -1 while running
	// or if the instance was killed by a signal.
	ExitCode() int

	// CleanStop reports whether the exit was user-initiated via Stop rather
	// than a crash. The supervisor keys its restart decision off this (§6.3).
	CleanStop() bool
}

Handle is a reference to one started service instance. Implementations are safe for concurrent use.

type ProcessRuntime

type ProcessRuntime struct {
	// LogDir holds <service>.log files; defaults to ~/.outpost/logs.
	LogDir string
	// StopGrace is how long a service gets to exit after SIGTERM before it is
	// sent SIGKILL.
	StopGrace time.Duration
	// HealthTimeout bounds a single healthcheck request.
	HealthTimeout time.Duration
	// Env is KEY=value pairs every service gets, after its manifest's own
	// env so a manifest can't override them.
	Env []string
	// contains filtered or unexported fields
}

ProcessRuntime runs services as native child processes (§6).

func (*ProcessRuntime) Healthy

func (r *ProcessRuntime) Healthy(ctx context.Context, handle Handle) (bool, error)

Healthy probes the service's healthcheck on loopback. A non-2xx response or a transport error is a failed check, and the error explains which (§2).

func (*ProcessRuntime) LogPath

func (r *ProcessRuntime) LogPath(service string) string

LogPath reports where a service's logs are written, for CLI use.

func (*ProcessRuntime) Logs

func (r *ProcessRuntime) Logs(handle Handle) (io.ReadCloser, error)

Logs opens the service's current log file for reading.

func (*ProcessRuntime) Start

func (r *ProcessRuntime) Start(ctx context.Context, svc *manifest.Service) (Handle, error)

Start launches the service and begins reaping it in the background.

func (*ProcessRuntime) Stop

func (r *ProcessRuntime) Stop(ctx context.Context, handle Handle) error

Stop asks the service to exit, escalating to SIGKILL after StopGrace.

type Runtime

type Runtime interface {
	Start(ctx context.Context, svc *manifest.Service) (Handle, error)
	Stop(ctx context.Context, h Handle) error
	Healthy(ctx context.Context, h Handle) (bool, error)
	Logs(h Handle) (io.ReadCloser, error)
}

Runtime is the boundary the supervisor drives. ProcessRuntime implements it with os/exec, and is the only implementation: Outpost supervises native processes, not containers.

type Status

type Status string

Status is a service's observed lifecycle state (§6).

const (
	StatusStarting  Status = "starting"
	StatusRunning   Status = "running"
	StatusUnhealthy Status = "unhealthy"
	StatusStopped   Status = "stopped"
	StatusFailed    Status = "failed"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL