deploy

package
v0.0.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package deploy implements ADR-0085: on-box pull-build-and-atomic-deploy for the imzero2 headless demo. This is the logic layer (SD2); systemd supplies supervision and the poll timer.

Phase 1 (this file) is the happy path:

resolve tag -> checkout -> build -> stage -> ws_probe gate -> atomic
symlink swap -> restart

Rollback/retention (SD6) and the env-registry / runinfo / audited-bus wiring (SD7-8) are later phases; the seams are left explicit.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCommand

func NewCommand() *cli.Command

NewCommand returns the `imzero2 deploy` subcommand (ADR-0085). Flag defaults come from the IMZERO2_DEPLOY_* env registry (SD7) — so systemd `Environment=` configures the tool and every knob self-documents in doc/env-vars.md — and a flag passed on the command line overrides the env.

func Run

func Run(ctx context.Context, lg zerolog.Logger, cfg Config) (deployed bool, err error)

Run is the deploy entrypoint. With cfg.Ref set it is the operator out-of-cadence path (SD10–SD11); otherwise it is the autonomous tag poll — cut over to the newest release tag when it is strictly newer than the running release (SD12). deployed reports whether a release was cut over.

Types

type Config

type Config struct {
	Remote       string        // git remote name in the workspace clone (read-only)
	Workspace    string        // persistent clone + cargo/go caches; builds run here
	ReleasesDir  string        // immutable release snapshots: <ReleasesDir>/<tag>/
	CurrentLink  string        // `current` symlink the systemd unit ExecStarts through
	ServiceName  string        // systemd unit restarted on swap
	ScratchPort  int           // gate: candidate carrier loopback port
	GateAUs      int           // gate: access units ws_probe must receive
	GateTimeout  time.Duration // gate: overall budget
	LivePort     int           // post-restart health probe: the demo service's listen port
	KeepReleases int           // retain the last K release dirs (rollback history)
	// RequireSignedTags gates building on a valid GPG/SSH tag signature (SD8);
	// false is a loopback/dev escape only.
	RequireSignedTags bool
	EncoderArgs       string // IMZERO2_HEADLESS_ENCODER_ARGS for the gate run
	MainFont          string // optional; fc-match'd if empty
	PhosphorFont      string // optional; the release's bundled asset if empty
	FallbackFont      string // optional; fc-match'd if empty
	DryRun            bool   // stage + gate but skip the swap + restart
	// Ref, when set, is the operator out-of-cadence path (SD10): deploy this
	// exact revision (commit/branch/tag) now, bypassing tag-selection, with its
	// commit signature verified like a tag (SD11). Empty = the autonomous tag poll.
	Ref string
	// Root is the deploy root (<root>/{workspace,releases,current}); the
	// append-only break-glass audit log (SD11) lives here.
	Root string
}

Config is a deploy run's configuration. Phase 1 takes it from cli flags; ADR-0085 SD7 moves these knobs into the imzero2env registry in Phase 3.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL