Documentation
¶
Overview ¶
Package daemon runs `magpie serve` as a service of the user's own: a systemd user unit on Linux, a launch agent on the Mac. The system starts it at boot or login and starts it again when it stops, with no window and no desktop session, for a server or a machine reached over SSH. Whether it is installed and running is the system's own record, read each time, never a setting of magpie's.
Index ¶
Constants ¶
const Label = "com.yetone.magpie.serve"
Label is the launch agent's; the tray's at login is com.yetone.magpie.
const Name = "magpie"
Name is the service's name: magpie.service, com.yetone.magpie.serve.
Variables ¶
var ErrNotInstalled = errors.New("the magpie service isn't installed: `magpie daemon install`")
ErrNotInstalled is Start, Stop or Restart before Install.
var ErrUnsupported = errors.New("unsupported")
ErrUnsupported is for a system with no service manager magpie writes for.
Functions ¶
func Install ¶
Install writes the service for this copy of magpie, with the environment it was installed from, and starts it; again, it writes the service anew (a moved magpie, a new PATH or proxy) and restarts it.
func Node ¶
func Node() string
Node is the node the service finds on its PATH, "" for none: what the CLI warns of after an install.
func Removed ¶ added in v0.1.1483
func Removed() bool
Removed says the user removed the service, and hasn't installed it since.
func Restart ¶
func Restart() error
Restart stops it and starts it again: a magpie updated in place serves as the new version.
func TLS ¶ added in v0.1.1232
func TLS() (cert, key string)
TLS is the certificate and key files the installed service serves HTTPS with (`magpie daemon install --tls-cert … --tls-key …`), "" when it has none or isn't installed.
Types ¶
type Options ¶ added in v0.1.1231
type Options struct {
// Web is the address the app's page is served on (`magpie serve
// --web=…`), "" for none.
Web string
// Key is the page's MAGPIE_WEB_KEY, written into the service so its
// link stays the same across restarts; needed with Web.
Key string
}
Options are what the service serves besides the gateway.
type Status ¶
type Status struct {
Installed bool // the unit or launch agent is on disk
Enabled bool // started at boot or login
Running bool // its process is up
PID int // that process, when the system says
State string // the system's own word for it: active, failed, running…
LastExit string // how its last run ended, when the system says
File string // the unit or launch agent's file
Logs string // how to read what it printed
Advice []string
}
Status is what the system says of the service.