Documentation
¶
Overview ¶
Package target turns an installed instance into a running service on a particular platform: a systemd unit, a Windows service, a launchd agent, a container or a Kubernetes manifest.
Every native target runs the same thing: `anyserve run <name>`, which supervises the server. Targets only decide how that command gets started, restarted and logged.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Env ¶
type Env struct {
// Exe is the absolute path of the anyserve binary.
Exe string
// Home is set when ANYSERVE_HOME is in use, so services see it too.
Home string
Out io.Writer
}
Env is what a target needs from the caller.
type Target ¶
type Target interface {
Name() string
Description() string
// Available reports whether the target works on this machine, and why
// not if it doesn't.
Available() error
// SupportsService reports whether a service can run on this target.
SupportsService(d *spec.Definition) error
// Register creates or refreshes the service for an instance.
Register(in *instance.Instance, d *spec.Definition, env Env) error
Unregister(in *instance.Instance) error
Start(in *instance.Instance) error
Stop(in *instance.Instance) error
Status(in *instance.Instance) Status
// Logs shows recent output, following it if follow is set.
Logs(in *instance.Instance, lines int, follow bool, out io.Writer) error
}
Target manages instances on one kind of platform.