deploy

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: MIT Imports: 22 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 executes the Phase 1 happy path. deployed reports whether a new tag was cut over (false when already current, or no release tag was found).

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
}

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