Local-first orchestration & GitOps platform built on Docker Compose and a unified
w7CLI. PaaS-grade ergonomics without leaving the terminal β designed for developers and homelab operators.
W7-Base is a directory-driven monorepo that standardizes Docker Compose deployments across four isolated zones (@ops, @dev, @prod, @lab) and exposes them through a single ergonomic CLI: w7. It bundles GitOps automation, SOPS-encrypted secrets, Traefik ingress, observability, and policy enforcement β all running entirely on your local machine or a small VPS.
Built for:
- Developers running multiple compose stacks who are tired of typing
docker compose -f ... --env-file .... - Homelab operators who want PaaS-style discoverability without Kubernetes.
- Teams that want GitOps discipline (push β deploy) on a single host, with no cloud dependency.
Not built for:
- Multi-host orchestration (use Kubernetes/Swarm).
- Production cloud deployments.
- Stateless ephemeral workloads (it's local-first, persistent-volume oriented).
| Area | Status | Notes |
|---|---|---|
| Platform baseline (zones, CLI, GitOps, secrets, observability) | β Sealed at Slice 21 | All 23 documentation slices verified |
@ops services (9 stacks) |
β Operational | Gitea, Traefik, Webhook, Prometheus, Grafana, Node Exporter, W7 Exporter, Dozzle, Act-Runner |
@dev/anythingllm (LLM workspace) |
β Deployed | Postgres + Qdrant + Gemini, SOPS-encrypted secrets |
@lab/ll-KNOWRAG (KB/RAG sub-project) |
π Phase 7 sealed β Phase 8 pivot in-flight | See Β§ KNOWRAG |
@prod/whoami |
β Validation workload | Pre-prod gate verified |
π Active focus:
@lab/ll-KNOWRAGis mid-pivot from Supabase/PostgREST to Gitea + Qdrant as the storage backend. Phase 7 (UI/Backend parity, recursive crawling, reranking) is sealed; Phase 8 (re-architecture) is the next planned slice.
Prerequisites: bash (or zsh), docker, docker-compose-plugin, tar. Optional: age and sops for encrypted secrets.
# 1. Clone
git clone https://github.com/w7-mgfcode/w7-base.git ~/w7-base
cd ~/w7-base
# 2. Activate shell integration (adds `w7` CLI, zone aliases, `w7 go` cwd-jump)
echo 'source ~/w7-base/.shared/w7.sh' >> ~/.bashrc
source ~/.bashrc
# 3. Verify
w7 stat # Cross-zone health matrix
w7 doctor # Validate host dependencies, DNS, contractsYou'll see the W7-Base health matrix showing all stacks across all zones.
~/w7-base/
βββ @ops/ Core platform (Gitea, Traefik, Prometheus, Grafana, ...)
βββ @dev/ Active development stacks
βββ @prod/ Production-grade local stacks (gated)
βββ @lab/ Sandboxes & experiments (only zone where `prune` is allowed)
βββ .shared/ Global env bridge, policies, deploy templates
βββ .bin/ Vendored CLI: w7, sops, age
βββ docs/ Platform documentation
A stack is any directory exactly one level deep inside a zone that contains a .w7-meta file:
@dev/my-app/
βββ .w7-meta YAML β GitOps routing, dependencies, health checks
βββ compose.yml Standard Docker Compose definition
βββ data/ Persistent volumes (target of `w7 backup`)
βββ .env.example Required-secret schema (committed)
βββ .env Real secrets (NEVER committed)
βββ .env.sops SOPS+AGE encrypted secrets (safe to commit)
The CLI auto-injects COMPOSE_PROJECT_NAME="<zone>-<stack>" (e.g., dev-my-app) before invoking Docker so identical stacks across zones don't collide.
| Zone | Trust | GitOps | prune allowed |
up requires --yes |
|---|---|---|---|---|
@ops |
High | Webhook + Actions | β | β |
@dev |
Med | Webhook (instant) | β | β |
@prod |
Highest | Actions only (approval-gated) | β | β |
@lab |
Low | Webhook (instant) | β | β |
| Command | Description |
|---|---|
w7 up <stack|all> |
Start stack(s) β merges .shared/global.env and stack .env; all boots @ops first |
w7 down <stack|all> |
Stop stack(s) β all stops application zones first, @ops last |
w7 init <@zone/stack> |
Scaffold a new stack with the standard contract |
w7 doctor [--json] |
Validate dependencies, DNS, secret coverage, policy compliance |
w7 stat |
O(1) cross-zone status matrix |
w7 top / stats |
Live per-zone resource visibility |
w7 logs <stack> |
Tail logs (preserves Docker ANSI colors) |
w7 go <stack> |
cd shell to stack path (requires .shared/w7.sh sourced) |
w7 net |
Port-mapping visibility |
w7 backup <stack> |
Tar.gz of data/ (excludes .env to prevent secret leakage) |
w7 prune <stack> |
Destroy containers + networks + volumes β @lab only |
w7 secret <init|edit|decrypt> <stack> |
SOPS+AGE secret management |
W7-Base layers env files instead of duplicating them. CLI runs:
docker compose --env-file .shared/global.env --env-file .env up -dPrecedence (highest wins):
- Host OS exported variables
- Stack-local
.env - Global bridge
.shared/global.env(no secrets here β committed)
Use ${REQUIRED_KEY:?error msg} in compose.yml for fail-fast on missing vars.
| File | Committed? | Purpose |
|---|---|---|
.env.example |
β Yes | Schema (key names + placeholders) |
.env |
β Never | Real values, runtime only |
.env.sops |
β Yes (encrypted) | AGE-encrypted .env, GitOps-safe |
Auto-decrypt: w7 up decrypts .env.sops β .env automatically when the encrypted file is newer and sops is installed.
age-keygen -o ~/.config/sops/age/keys.txt # Generate key
# Paste public key into root .sops.yaml
w7 secret init @ops/gitea # Encrypt existing .env
w7 secret edit @ops/gitea # Edit encrypted secretsFull guide: .shared/SECRETS.md
| Path | Trigger | Use For | Approvals |
|---|---|---|---|
Webhook (@ops/webhook) |
Instant push (HMAC-signed) | @dev, @lab |
None β speed over ceremony |
Runner (@ops/act-runner) |
Gitea Actions (push, PR, schedule, manual) | @ops, @prod |
Branch protection + required reviews |
The webhook flow: push β HMAC verify β git pull β docker compose config validation β w7 up. Failed validation rolls back the commit; the running stack stays untouched.
Full design: .shared/GITOPS_DESIGN.md
The repo ships with ready-to-run workflows for the local @ops/act-runner:
| File | Purpose |
|---|---|
.gitea/workflows/validate.yaml |
docker compose config across every stack + run all .shared/policy/*.sh checks. Triggered on push/PR. |
.gitea/workflows/deploy.yaml |
Discovers stacks changed in the push, runs w7 up on each (skips @prod β that path requires manual approval). |
.shared/workflows/deploy-template.yaml |
Reference template for stacks that want their own per-repo deploy pipeline. |
GitHub Actions equivalents (.github/workflows/ci.yaml, lint.yaml) run the same compose + policy + ShellCheck/yamllint validation on PRs.
All HTTP services route through Traefik on the w7-ingress external Docker network. Default hostnames (add to /etc/hosts):
| Service | URL |
|---|---|
| Traefik dashboard | http://localhost:8080 |
| Gitea | http://git.w7.local |
| Webhook listener | http://webhook.w7.local |
| Dozzle (logs) | http://logs.w7.local |
| Prometheus | http://prom.w7.local |
| Grafana | http://grafana.w7.local |
# /etc/hosts
127.0.0.1 git.w7.local webhook.w7.local logs.w7.local prom.w7.local grafana.w7.localBuilt-in Prometheus + Grafana + custom W7-aware exporter:
@ops/prometheusβ scrapesnode-exporter+w7-exporter@ops/grafanaβ dashboards (default login:admin/admin)@ops/node-exporterβ host metrics@ops/w7-exporterβ translatesw7 doctor --json+w7 statinto Prometheus metrics@ops/dozzleβ real-time container log streaming
Custom metrics exposed:
w7_healthyβ global system health (1/0)w7_error_count,w7_warning_countβdoctorresultsw7_containers_up{zone}β per-zone container countsw7_policy_violation{zone, stack, policy}β automated policy enforcement failures
Static checks under .shared/policy/ run during w7 doctor:
prod-privileged.shβ blocksprivileged: truein@prodprod-no-root-mount.shβ blocks host/or/etcmounts in@prodzone-ingress-naming.shβ enforces*.w7.localnaming convention
@lab/ll-KNOWRAG is an in-flight local-first KB+RAG system extracted from Archon. It ingests websites/documents, chunks and embeds content, and exposes retrieval via FastAPI, FastMCP, and a React UI.
Phase 7 (sealed):
- β Recursive crawling with depth limits
- β
llms.txttask expansion - β Crawl4AI integration with httpx fallback for JS-rendered pages
- β Provider-based reranking with lexical fallback
- β UI overhaul with backend parity
- β 6 dogfood-found UI/API issues fixed
Phase 8 (planned β re-architecture pivot):
- π΄ Replace Supabase/PostgREST with Gitea + Qdrant (Git as artifact source-of-truth, Qdrant for semantic search)
- π΄ Markdown frontmatter parser (tags, status, version, owner)
- π΄ Git-webhook-driven Qdrant ingestion pipeline
- π΄ Tailwind-based card-grid catalog UI
- π΄ Open WebUI + MCP integration
See @lab/ll-KNOWRAG/.omg/state/taskboard.md for the full Phase 8 task plan.
.
βββ @ops/ Platform services (9 stacks)
β βββ gitea/ Local Git server (mirror + Actions host)
β βββ traefik/ Reverse proxy + ingress
β βββ webhook/ GitOps deploy listener (HMAC-signed)
β βββ act-runner/ Gitea Actions runner
β βββ dozzle/ Real-time container logs
β βββ prometheus/ Metrics server
β βββ grafana/ Dashboards
β βββ node-exporter/ Host metrics
β βββ w7-exporter/ Custom W7 β Prometheus bridge
βββ @dev/ Development stacks
β βββ anythingllm/ LLM workspace + PG + Qdrant + SOPS secrets
β βββ skill-generator/ Claude skill builder (no compose stack)
β βββ test-scaffold/ Init template fixture
βββ @prod/ Production-grade stacks
β βββ whoami/ Pre-prod validation workload
βββ @lab/ Sandbox / experiments
β βββ ll-KNOWRAG/ KB + RAG system (Archon-derived)
β βββ test-init/ Init template fixture
βββ .bin/ w7, sops, age (vendored)
βββ .shared/ Global env, policies, workflows, contract spec
βββ .claude/ Claude Code rules + skills (project instructions)
βββ docs/ Platform documentation
Operator-facing:
Platform docs (docs/):
- README-LLM.md β concise LLM-optimized platform guide
- KNOWLEDGE_BASE.md β operational reference + troubleshooting
- ARCHITECTURE_DIAGRAM.md β network topology + request flow
- API_REFERENCE.md β CLI flags +
.w7-metaschema - SECURITY_POLICY.md β zone isolation + trust boundaries
- CI_CD_EXAMPLES.md β Gitea Actions templates
- OBSERVABILITY.md β Prometheus + Grafana setup
- BACKUP_SCRIPTS.md β automated backup guide
- DISASTER_RECOVERY.md β full restoration steps
- USER_ONBOARDING.md β Day 1 operator guide
Internal contracts (.shared/):
- W7-CONTRACT.md β directory +
.w7-metaspec - ENV_PRECEDENCE.md β env-file overlay rules
- SECRETS.md β SOPS+AGE operator guide
- GITOPS_DESIGN.md β webhook + runner design
| Symptom | Cause / Fix |
|---|---|
w7 go says "directory not found" |
You're running .bin/w7 directly. source ~/w7-base/.shared/w7.sh to activate the shell wrapper. |
w7 up @prod/... fails |
By design β @prod is gated. Use --yes to bypass interactively, or use the Gitea Actions path. |
| Webhook silently doesn't deploy | Check w7 logs @ops/webhook. docker compose config validation failure auto-rolls-back the commit. |
w7 doctor warns about SOPS |
Install age + sops and configure ~/.config/sops/age/keys.txt. |
*.w7.local doesn't resolve |
Add the hostnames to /etc/hosts (see Β§ Ingress). |
The @ops/webhook and @ops/act-runner containers mount /var/run/docker.sock to execute w7 up. If compromised, this gives root-equivalent host access. Mitigations baked in:
- HMAC-SHA256 signature verification on webhook payloads.
docker compose configpre-flight validation β rolls back the commit on failure.- Hard-blocked
@proddeploys via the webhook path;@prodrequires the Actions path with branch protection.
Never expose the webhook port (9000) or Gitea (3000) to the public internet without zero-trust overlays (Tailscale, Cloudflare Tunnel, etc.).
| Feature | Status |
|---|---|
w7 init scaffolding engine |
β Implemented |
w7 doctor system validation |
β Implemented |
| SOPS+AGE secret management | β Implemented |
| Webhook GitOps + HMAC | β Implemented |
| Gitea Actions / runner integration | β Implemented |
Traefik ingress + *.w7.local |
β Implemented |
| Prometheus + Grafana + W7 exporter | β Implemented |
| Policy enforcement (privileged, root-mount, naming) | β Implemented |
| Backup retention + restore | β Implemented |
Interactive @prod approvals |
β Implemented |
| KNOWRAG Phase 8 β Gitea+Qdrant pivot | π΄ Planned (next slice) |
| Webhook audit logging | π Planned |
This is a personal homelab/operator framework first, but suggestions and patches are welcome. Conventions:
- Commits:
type(scope): descriptionβ types:feat,fix,docs,chore,refactor,test. See historicalgit log. - Stacks: Must follow the contract in .shared/W7-CONTRACT.md.
- Secrets: Never commit
.env. Use.env.examplefor the schema and.env.sopsfor encrypted values. - Policy: New
@prodstacks must pass.shared/policy/*.shchecks.
Released under the MIT License.
- Archon β KB/RAG core reused and adapted in
@lab/ll-KNOWRAG. - Traefik, Gitea, Prometheus, Grafana β the platform substrate.
- Mozilla SOPS + AGE β encrypted secrets.
- Crawl4AI β JS-rendered crawling in KNOWRAG.