Documentation
¶
Overview ¶
Package serverinfo describes the running server process: build, instance identity, and readiness. One source feeds the Version RPC, the health endpoint, and the cloud uplink so they cannot disagree.
Index ¶
Constants ¶
const ContainerBootEnv = "MIREN_CONTAINER_BOOT"
ContainerBootEnv is set by `miren internal container-boot` before it execs the server. It is the one positive sign that a container install is the shape restart and upgrade rely on: the image's entrypoint chose the binary from the release directory, so an upgrade written there is what the next boot runs. Looking like a container (a /.dockerenv, cgroup names) proves none of that: it is also true of a plain `docker run` of the image, an older image whose entrypoint runs its own binary, and the dev environment.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct {
Version string `json:"version"`
Commit string `json:"commit"`
BuildDate time.Time `json:"build_date"`
// InstanceID changes on every restart even when Version does not.
InstanceID string `json:"runtime_instance_id"`
StartedAt time.Time `json:"started_at"`
// Ready flips once the boot graph has started every component.
Ready bool `json:"ready"`
InstallKind InstallKind `json:"install_kind"`
// Components are the versions of the runtime pieces this process drives
// (containerd, runc, ...), as observed at boot. An upgrade that swaps
// them on disk is only known to have taken when this says so.
Components map[string]string `json:"components,omitempty"`
}
Info is a snapshot of the server process.
type InstallKind ¶
type InstallKind string
InstallKind is how the process is supervised, which decides how an upgrade restarts it: through systemd, or by exiting and letting the container runtime's restart policy bring a new container up.
const ( InstallKindSystemd InstallKind = "systemd" InstallKindContainer InstallKind = "container" InstallKindUnknown InstallKind = "unknown" )
func DetectInstallKind ¶
func DetectInstallKind() InstallKind
DetectInstallKind reports how this process is supervised, from the environment alone. systemd wins over the container check: if systemd started this process, `systemctl restart` works wherever that systemd lives (including a systemd-in-docker test host). A container install is only one that came through container-boot; anything else in a container is unknown, and unknown gets a clear refusal rather than a restart nothing brings back.
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
Source is created once per process at boot and marked ready when the boot graph finishes.
func (*Source) InstanceID ¶
func (*Source) SetComponent ¶
SetComponent records the version of a runtime component once the boot graph has it running. An empty version is not worth recording.