Documentation
¶
Overview ¶
Package splash draws the screen a Jokku server greets you with when you log in: the logo, a striped sun, and live figures about the server and its cluster. It also installs and removes it as the login banner (motd.go).
Index ¶
- Variables
- func AskTerminal(question string) (string, bool)
- func Decline() error
- func Disable() error
- func Enable(exe string) error
- func Offer(out io.Writer, exe string, ask Asker) error
- func Render(w io.Writer, in *Info, o Options)
- func Supported() bool
- func Theirs() bool
- type AppHealth
- type Asker
- type Info
- type Options
- type Silenced
- type Sources
- type State
Constants ¶
This section is empty.
Variables ¶
var ( MOTDDir = "/etc/update-motd.d" // Dir holds what Disable needs: the state, and a banner script of the // admin's own that the splash took the place of. Dir = filepath.Join(daemon.DefaultDataDir, "splash") )
The splash becomes the login banner as a script in /etc/update-motd.d, which pam_motd runs at every SSH login on Debian and Ubuntu. It takes the place of the distribution's own welcome text, which it turns off and remembers turning off, so that Disable can turn it back on. The scripts that warn about something (a restart needed, a new release) keep running.
var DefaultSources = Sources{ Proc: "/proc", DataDir: daemon.DefaultDataDir, Socket: client.DefaultSocket, Updates: "/var/lib/update-notifier/updates-available", }
Functions ¶
func AskTerminal ¶
AskTerminal asks on the controlling terminal: install.sh and update.sh run setup with the script itself as stdin. It gives up after two minutes, so an unattended run with a terminal still finishes.
func Decline ¶
func Decline() error
Decline notes that the admin doesn't want the splash, so setup doesn't ask again.
func Disable ¶
func Disable() error
Disable takes the splash off the login banner, puts back what it replaced, and notes not to offer it again.
func Enable ¶
Enable makes the splash, drawn by the jokku binary at exe, the login banner. Running it again only brings it up to date.
func Offer ¶
Offer is setup's part. On a server that hasn't decided, it asks whether to show the splash at login (JOKKU_SPLASH=1 or 0 answers in advance); where it's on, it brings the banner script up to date. Without anyone to ask, it says how to turn it on and asks again next time.
Types ¶
type Asker ¶
Asker puts a question to whoever runs setup. ok is false when there is no one to ask, or no answer came.
type Info ¶
type Info struct {
Host string
Role string // control, worker or edge; empty where jokku isn't set up
Running bool // the jokku daemon answers
Status string // this node's status on the control node: ready, down or draining
Version string
Mesh string // this node's address on the cluster's network
// Cluster is set when the control node answered; the figures below are
// the whole cluster's.
Cluster bool
Apps, Databases, Asleep, Stopped int
Unhealthy []AppHealth
Nodes, NodesUp, Edges int
Down []string // nodes that stopped reporting
Instances int
LastDeploy *types.Deploy
// Here is the instances on this node.
Here int
// A worker's or an edge's view of the cluster, from its own files.
Control string // the control node's address
Peers int // the other nodes it knows of
Routes int // apps an edge routes
// This machine.
IP string
CPUs int
Load []float64 // over 1, 5 and 15 minutes
MemoryMB, MemoryUsedMB int
DiskMB, DiskUsedMB int
DiskAvailMB int
Uptime time.Duration
Updates, SecurityUpdates int // packages waiting, from update-notifier
Now time.Time
}
Info is everything the splash shows. Gather fills it in.
type Options ¶
type Options struct {
Color bool
// Width is the terminal's width in columns, or 0 when it isn't known,
// as at login; the full splash takes 78.
Width int
}
Options say what the splash is drawn on.
type Silenced ¶
type Silenced struct {
Name string `json:"name"`
How string `json:"how"` // statoverride, chmod or unlink
Target string `json:"target,omitempty"` // the symlink it removed points here
}
Silenced is a stock welcome script the splash turned off.
type Sources ¶
type Sources struct {
Proc string // /proc
DataDir string // jokku's state, and the filesystem whose disk is shown
Socket string // the jokku daemon's API
Updates string // update-notifier's note of waiting packages
}
Sources are where Gather looks.