An open API service indexing awesome lists of open source software.

https://github.com/jpvargasdev/magos-dominus

Lightweight GitOps agent for homelabs, enforcing Git as truth with Podman/Docker/Linux Containers.
https://github.com/jpvargasdev/magos-dominus

automation ci-cd gitops linux

Last synced: 9 days ago
JSON representation

Lightweight GitOps agent for homelabs, enforcing Git as truth with Podman/Docker/Linux Containers.

Awesome Lists containing this project

README

          


Magos Dominus Logo

๐Ÿง™ 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
```ini
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:

```yaml
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