๐ง Magos Dominus (A.K.A Magos)
A self-hosted GitOps daemon for homelabs โ automating container deployments with mystical precision.
โThe Machine does not err. The flesh errs. The Code is truth, and I am its voice.โ
โ Credus del Adeptus Mechanicus
๐ About
Magos Dominus is a lightweight GitOps agent forged in the spirit of the Adeptus Mechanicus.
Its purpose: to enforce the declared state from your sacred Git repository and reconcile it with the material world of your homelab.
Unlike the bloated rites of Kubernetes and its labyrinthine CRDs, Magos acts directly on a simple Linux host using Podman Compose โ pure, direct, and efficient.
No unnecessary ceremony. No wasted bureaucracy. Only obedience to the written manifest.
Each reconciliation loop is a ritual. Each deployment, a litany.
Where drift appears, corruption is purged. Where the manifest and the machine diverge, Magos enforces the will of the Code.
โ๏ธ Core Features (implemented)
โ
Daemonized GitOps loop
- Runs continuously via
systemd as a rootless or privileged service.
- Pulls from a GitHub App-authenticated repo.
โ
Image watcher
- Monitors container registries (currently GHCR).
- Evaluates semantic versions and filters valid tags.
โ
Reconciler
- Detects updated image versions matching defined policies.
- Rewrites Compose files with immutable
@sha256 digests.
- Commits and pushes via GitHub App credentials.
โ
Secrets integration
- Automatically decrypts SOPS-encrypted files using local
age keys.
- Supports environment variable injection and runtime secret expansion.
โ
Applier
- Executes
podman compose pull && up -d to deploy updated stacks.
- Supports rootless environments (with Pasta networking fallback).
โ
System integration
- Managed via systemd --user or as a root service.
- Logs and metrics available via
journalctl -fu magos-dominus.
โ
Cross-platform binaries
- Released for Linux, macOS, and Windows through GitHub Actions.
๐งฉ Repository Layout
- cmd/server/ # Entrypoint and CLI
- internal/cli/ # Command-line interface
- internal/watcher/ # Registry watcher & event loop
- internal/daemon/ # Core reconciliation engine
- scripts/ # Reconcile + secrets decryption helpers
- configs/ # Default YAML configuration
๐ง Configuration
.env essentials
MD_REPO=https://github.com/yourname/your-gitops-repo
MD_RUNTIME=podman/docker
SOPS_AGE_KEY_FILE=/home/user/.config/sops/age/keys.txt
GITHUB_APP_ID=123456
GITHUB_APP_PRIVATE_KEY=/home/user/.local/share/magos/github_app.pem
Compose Policy Annotation
Magos recognizes image policies through comments in your docker-compose.yml:
services:
lexcodex:
image: ghcr.io/jpvargasdev/lexcodex:0.0.1 # {"magos": {"policy": "semver", "repo": "ghcr.io/jpvargasdev/lexcodex"}}
Supported policies:
- semver โ Enforce semantic version updates (e.g., >=1.2.0 <2.0.0)
- latest โ Always reconcile to the latest tag
- digest โ Enforce a specific immutable digest
๐ ๏ธ Future Augmentations (planned)
- ๐ฎ Multi-registry support: DockerHub, Quay.io
- ๐ต๏ธโโ๏ธ Vulnerability scanning via Trivy
- ๐ Image signature verification (cosign)
- ๐งฉ Health & metrics endpoints (/healthz, /metrics)
- ๐ง Rule-based policies (e.g. minAge, arch constraints)
- ๐จ Webhook-driven reconciliations (GitHub Events)
- ๐งฌ PR-based workflows instead of direct commits
- ๐งฐ Podman network auto-healing and diagnostics