3.1 KiB
infra/ — agent instructions
How and where the already-built app images run: Terraform, the SOPS+age secrets
vault, compose and Swarm stack files, deploy scripts, host provisioning, mail,
and the ops cron (DB backup + IndexNow). Read the root CLAUDE.md first — it
owns the branch model, the deploy contract, and which environment runs which
orchestrator.
The machines
Per ACCESS.md: dev (operator's box — LAN dev server and CI runner),
prod (169.58.46.181, thermograph.org, agent user, passwordless sudo),
beta (75.119.132.91, beta.thermograph.org + Forgejo + Grafana/Loki,
agent user). All four are on a WireGuard mesh. Hosts' /opt/thermograph is a
checkout of this monorepo, not an infra-only repo.
Deploy paths
deploy/deploy.sh— the single entry point for beta and prod. Resets the host checkout toBRANCH(defaultmain), renders secrets, then routes: if/etc/thermograph/deploy-modesaysstackit execsdeploy/stack/deploy-stack.sh, otherwise it rolls compose services. Per-service tags persist in untrackeddeploy/.image-tags.env(compose) anddeploy/.stack-image-tags.env(stack) so the two never mix.deploy/stack/deploy-stack.sh— the Swarm path, live on prod.backendrolls web and worker;frontendrolls frontend;allruns a fulldocker stack deploy. Start-first, health-gated, auto-rollback.STACK_TEST=1rehearses the whole thing under stack namethermograph-teston throwaway volumes and ports18137/18080.deploy/deploy-dev.sh— thin LAN-dev wrapper (dev compose overlay,~/thermograph-dev). Its CI trigger is inert; see rootCLAUDE.md.Makefile— compose orchestration only:up,down,db-up,dev-up,om-up,om-backfill.
Volumes are the reason the compose project name is pinned: compose creates
thermograph_pgdata/_appdata/_applogs, and the Swarm stack declares those
same names as external: true at the same mount paths.
Rules
- Never run
terraform applycasually. No tfstate is persisted anywhere, so an apply would attempt full re-provisioning of live hosts. Terraform here is executable documentation until state is bootstrapped. - Secrets: SOPS vault only (
deploy/secrets/*.yaml,sops edit→ commit → deploy). Never hand-edit/etc/thermograph.env— it is a rendered artifact.secrets-guardCI rejects plaintext.deploy/secrets/seed-from-live.shreads production secrets and is not for an agent to run. - The ops cron (
.forgejo/workflows/ops-cron.yml, at the repo root) is THE prod backup. It usesPROD_SSH_*, notSSH_*— an earlier revision reusedSSH_*and silently dumped beta while prod had no backup at all. If you touch it, verify a dump actually lands inagent@prod:~/thermograph-backups/. - Shell here runs as root over SSH against live hosts with no test suite in
front of it.
shell-lintCI (pinned shellcheck) is the only guard — keep the tree at zero findings.
Commits & PRs
Concise and technical. Never mention AI, assistants or automated authorship.