gantry

module
v0.19.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT

README

gantry

ci test security codecov Go Reference

gantry is a non-Kubernetes release orchestrator. It reads the latest published release of each of your components from a forge (GitLab or GitHub), pins the resolved immutable image references into per-environment dotenv files committed to git, deploys over SSH (plain compose, symlink-release, or blue-green), verifies health, records every outcome in a git-tracked deploy ledger, and gates promotion on that ledger. It runs one-shot from CI or continuously as a daemon with Prometheus metrics and a webhook doorbell.

The gap it fills

Plenty of teams run their services with Docker Compose on plain hosts rather than Kubernetes. They still want what Kubernetes-style GitOps gives you: a single declarative description of which version runs where, an auditable history of every version bump, a verified path from "a new release exists" to "it is running in test", and a gated promotion to production that can only ship a revision a green test deploy has already proven. gantry provides exactly that for the Compose-over-SSH world — git is the only state store, and there is no system-specific logic baked in.

How it works

  • Git is the source of truth. Pins are dotenv files in git; the deploy ledger is JSONL in git; the daemon is stateless (each loop reads git). Crash-safety, auditability, and git log as the debugging UI all fall out for free.
  • The deploy ledger is the promotion gate. Every deploy records its outcome keyed by (environment, pin-commit). Promotion to prod reads that ledger and refuses any revision without a green (optionally healthy) test deploy — "prod requires a proven revision" is enforceable, not a convention.
  • Promotion is frozen. promote reads the pin file as committed at the gated SHA, never "current upstream", closing the TOCTOU race between validating and shipping.
  • Rollback targets the last green ledger entry, not the parent commit, so repeated rollbacks walk backward through known-good states instead of oscillating onto a bad one.

Capabilities

  • Forges: GitLab and GitHub Release adapters; both resolve "latest" to the newest non-prerelease release and parse an embedded release-metadata block (repository:tag, digest, commit, changelog). With a digest the pin is written as repository:tag@sha256:… so a re-pushed tag cannot drift the pulled image.
  • Executors: compose-over-ssh (docker compose pull && up -d), symlink-release (atomic current symlink flip over per-release dirs), and blue-green (stage the idle slot, gate the switch on a green ledger entry plus a fresh idle-slot verify).
  • Verification: post-deploy http, compose-ps, and command probes; an optional verify_on_failure: rollback auto-rolls-back a failed verify (held for blue-green, whose pointer is the safety mechanism).
  • Promotion / rollback / drift: gated promote, ledger-targeted rollback, and a drift report (exit code 3) for tracked components whose latest release is unconsumed past a threshold.
  • Status matrix: status --all shows latest-vs-pinned per component across every environment plus each environment's health.
  • Notifications: webhook, slack, telegram, and email channels for deploy/promote/rollback/verify/drift/reconcile-failed events, per-channel event filtering.
  • Daemon (serve): a reconcile loop under a single-writer lock, with /healthz, Prometheus /metrics, and an optional authenticated webhook doorbell that triggers an immediate (debounced) reconcile.
  • Secrets: every credential is a ${scheme:…} reference — env, file, cmd, sops, vault — resolved at use; inline literals are rejected.

Quickstart

task build            # or: go build -o gantry ./cmd/gantry

export GANTRY_FORGE_TOKEN=glpat-xxxxxxxxxxxxxxxxxxxx   # referenced as ${env:GANTRY_FORGE_TOKEN}

# Inspect, then apply
./gantry plan    --env test --config gantry.yaml
./gantry sync    --env test --config gantry.yaml
./gantry status  --all       --config gantry.yaml

# Gated promotion and rollback
./gantry promote --from test --to prod --config gantry.yaml
./gantry rollback --env prod  --config gantry.yaml

# Run continuously (daemon) with metrics on :9713
./gantry serve --config gantry.yaml

A complete, runnable configuration lives in examples/demo — a generic two-component setup, intentionally unrelated to any specific system, to show gantry is driven entirely by gantry.yaml.

Exit codes

0 success · 3 drift detected (distinct from failure, a CI affordance) · 1 any other operational error.

Documentation

License

Released under the MIT License.

Directories

Path Synopsis
cmd
gantry command
Command gantry is a non-Kubernetes release orchestrator.
Command gantry is a non-Kubernetes release orchestrator.
internal
cli
Package cli wires gantry's cobra command tree to the engine.
Package cli wires gantry's cobra command tree to the engine.
config
Package config defines gantry's declarative configuration model and loader.
Package config defines gantry's declarative configuration model and loader.
daemon
Package daemon runs gantry's reconcile loop (`gantry serve`): it calls the same engine verbs the CLI does, on an interval, under a single-writer lock.
Package daemon runs gantry's reconcile loop (`gantry serve`): it calls the same engine verbs the CLI does, on an interval, under a single-writer lock.
engine
Package engine orchestrates the consume → pin → deploy flow.
Package engine orchestrates the consume → pin → deploy flow.
executor
Package executor defines the deploy backend interface and its plan/result types.
Package executor defines the deploy backend interface and its plan/result types.
executor/bluegreen
Package bluegreen deploys a two-slot environment behind a switchable pointer: Deploy stages the idle slot, SwitchTo flips an nginx-agnostic symlink pointer to promote it.
Package bluegreen deploys a two-slot environment behind a switchable pointer: Deploy stages the idle slot, SwitchTo flips an nginx-agnostic symlink pointer to promote it.
executor/composessh
Package composessh deploys via `docker compose pull && up -d` over SSH.
Package composessh deploys via `docker compose pull && up -d` over SSH.
executor/symlinkrelease
Package symlinkrelease deploys via a versioned release directory and an atomic `current` symlink, running compose from the active release.
Package symlinkrelease deploys via a versioned release directory and an atomic `current` symlink, running compose from the active release.
forge
Package forge reads component Releases (and their metadata block) from a forge.
Package forge reads component Releases (and their metadata block) from a forge.
forge/gitlab
Package gitlab implements forge.Forge against the GitLab Releases API.
Package gitlab implements forge.Forge against the GitLab Releases API.
gitutil
Package gitutil holds small go-git helpers shared by gantry's git-backed stores.
Package gitutil holds small go-git helpers shared by gantry's git-backed stores.
humanize
Package humanize renders durations for gantry's user-facing strings (drift alarms in the CLI and the daemon), so the same event reads identically wherever it is emitted.
Package humanize renders durations for gantry's user-facing strings (drift alarms in the CLI and the daemon), so the same event reads identically wherever it is emitted.
ledger
Package ledger records and queries the outcome of every deploy gantry performs.
Package ledger records and queries the outcome of every deploy gantry performs.
logging
Package logging provides gantry's slog logger and a context carrier so the engine can emit structured diagnostics without taking a logger parameter.
Package logging provides gantry's slog logger and a context carrier so the engine can emit structured diagnostics without taking a logger parameter.
notify
Package notify delivers gantry's deploy/promote/rollback/verify/drift events to configured channels (webhook, email), best-effort.
Package notify delivers gantry's deploy/promote/rollback/verify/drift events to configured channels (webhook, email), best-effort.
pin
Package pin models per-environment version-pin files (dotenv) and their diffs.
Package pin models per-environment version-pin files (dotenv) and their diffs.
verify
Package verify runs post-deploy health probes against a freshly-deployed environment.
Package verify runs post-deploy health probes against a freshly-deployed environment.

Jump to

Keyboard shortcuts

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