Documentation
¶
Overview ¶
Package update is how a self-hosted platform learns of its new releases and applies one when its owner asks, the way GitLab tells an instance's admins "update available": the platform checks the releases of devopus-server now and then and shows the owner what is out. Applying needs root, which the platform does not have: it leaves a request in its data folder, and a systemd unit installed with it (devopus-server-upgrade.path) runs 'devopus-server upgrade --requested' as root — backup, download checked against the checksums, replace, restart, roll back if the new release does not come up — writing how it goes next to the request.
Index ¶
Constants ¶
const ( RequestFile = "request.json" StatusFile = "status.json" )
The files of the update folder.
const ( Requested = "requested" Running = "running" Failed = "failed" Done = "done" )
States of applying a release.
const ReleasesAPI = "https://api.github.com/repos/amalychev/devopus-server/releases/latest"
ReleasesAPI is where the newest release of devopus-server is told.
Variables ¶
This section is empty.
Functions ¶
func Newer ¶
Newer reports whether release a is newer than the running version b. A build that is no release (dev, a test build) has nothing newer: it is not upgraded.
func WriteRequest ¶
WriteRequest leaves the request the upgrade unit picks up.
func WriteStatus ¶
WriteStatus records how applying goes; the platform reads it.
Types ¶
type Request ¶
type Request struct {
Version string `json:"version"`
By string `json:"by"`
At time.Time `json:"at"`
}
Request is the owner's request to apply a release.
func TakeRequest ¶
TakeRequest reads the request and removes it, so the unit does not run again for it.
type Status ¶
type Status struct {
State string `json:"state"`
Target string `json:"target"`
Message string `json:"message,omitempty"`
At time.Time `json:"at"`
}
Status is how applying the last requested release goes.
func ReadStatus ¶
ReadStatus is the status in a folder; zero when nothing was asked yet.