Documentation
¶
Overview ¶
Package update replaces the running Zelie with a signed release. The core fetches and checks the release; a short-lived systemd unit, run from the binary being replaced, restarts the services and puts the old binary back if the new one does not come up.
Index ¶
Constants ¶
const ( Old = install.Binary + ".old" StateFile = "/var/lib/zelie/update.json" // Unit is the transient systemd unit that finishes an update. Its // fixed name also keeps two updates from running at once. Unit = "zelie-update" // HealthTimeout is how long the new version has to come up. HealthTimeout = 90 * time.Second )
The binary being replaced is kept next to the new one until the next update, for the rollback and for anyone who wants to go back by hand.
const Repo = "Caria-Core/zelie"
Repo is where releases are published.
Variables ¶
This section is empty.
Functions ¶
func Newer ¶
Newer reports whether version a comes after b. A build that is not a release, such as "dev", is never older than anything: it cannot be told what it would be updated to.
func Place ¶
Place puts bin where the services run from, keeping the current binary as Old. Root is prepended to the paths; empty on a server.
Types ¶
type Fetcher ¶
type Fetcher struct {
Client *http.Client
// Base is where release files are, with the version appended; tests
// point it at a local server.
Base string
// Key replaces the embedded public key in tests.
Key ed25519.PublicKey
}
Fetcher downloads releases.
type Finisher ¶
type Finisher struct {
Root string
Exec func(ctx context.Context, name string, args ...string) (string, error)
// Healthy reports whether every service answers with version.
Healthy func(ctx context.Context, version string) error
Timeout time.Duration
Now func() time.Time
}
Finisher restarts the services on the new binary and checks that they come up. It runs from Old, so a new binary that does not even start cannot keep the old one from coming back.