diff --git a/README.md b/README.md index b27d9b6..e355683 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,8 @@ the [cc-ci repository](https://git.autonomic.zone/recipe-maintainers/cc-ci). | Combined host and timers | `flake.nix`, `nix/hosts/cc-ci/`, `nix/modules/` | | Operator session, weekly upgrade and report launchers | `cc-ci-plan/agents.py`, `cc-ci-plan/launch-{upgrader,report,supervisor}.py` | | Recipe inventory, upstream notes, reporting tools | `cc-ci-plan/used-recipes.md`, `cc-ci-plan/upstream/`, `cc-ci-plan/recipe-report.py` | -| Original Builder/Adversary build and first host deployment | [`archive/original-build/`](archive/original-build/README.md) | +| Host provisioning and migration | [`docs/host-provisioning-and-migration.md`](docs/host-provisioning-and-migration.md) | +| Original Builder/Adversary build | [`archive/original-build/`](archive/original-build/README.md) | Secrets and runtime state are gitignored. The completed two-loop build is archived; no Builder or Adversary session should be running. The Nix diff --git a/archive/original-build/README.md b/archive/original-build/README.md index b37909d..a29c769 100644 --- a/archive/original-build/README.md +++ b/archive/original-build/README.md @@ -1,13 +1,13 @@ # Original cc-ci build archive This is the historical Builder/Adversary phase build of the cc-ci recipe CI -server and the initial combined-host deployment. The phase work is complete; -these plans and prompts are reference material, not current operating steps. +server. Current host provisioning and migration guidance lives in +[`docs/host-provisioning-and-migration.md`](../../docs/host-provisioning-and-migration.md). The phase work is complete; these plans and prompts are reference material, not current operating steps. - `cc-ci-plan/`: build plan, phase plans, loop prompts, launchers, and the original agent configuration and instructions. -- `host-build-guide.md`: the original from-scratch host build narrative moved - from the root README. +- `cc-ci-plan/IDEAS.md`: deferred ideas recorded during the phase build. +- `memory/`: historical phase and earlier host notes. - `AGENTS.md`: the instructions used while the two build loops were active. Some old `cc-ci-plan/` paths remain as relative symlinks into this archive. diff --git a/cc-ci-plan/IDEAS.md b/archive/original-build/cc-ci-plan/IDEAS.md similarity index 100% rename from cc-ci-plan/IDEAS.md rename to archive/original-build/cc-ci-plan/IDEAS.md diff --git a/memory/cfold-paused-pending-upgrade.md b/archive/original-build/memory/cfold-paused-pending-upgrade.md similarity index 100% rename from memory/cfold-paused-pending-upgrade.md rename to archive/original-build/memory/cfold-paused-pending-upgrade.md diff --git a/memory/launch-system-unification.md b/archive/original-build/memory/launch-system-unification.md similarity index 100% rename from memory/launch-system-unification.md rename to archive/original-build/memory/launch-system-unification.md diff --git a/memory/orchestrator-host-hetzner.md b/archive/original-build/memory/orchestrator-host-hetzner.md similarity index 100% rename from memory/orchestrator-host-hetzner.md rename to archive/original-build/memory/orchestrator-host-hetzner.md diff --git a/memory/weekly-upgrade-queued-after-phases.md b/archive/original-build/memory/weekly-upgrade-queued-after-phases.md similarity index 100% rename from memory/weekly-upgrade-queued-after-phases.md rename to archive/original-build/memory/weekly-upgrade-queued-after-phases.md diff --git a/archive/original-build/host-build-guide.md b/docs/host-provisioning-and-migration.md similarity index 95% rename from archive/original-build/host-build-guide.md rename to docs/host-provisioning-and-migration.md index 7b8a224..a412607 100644 --- a/archive/original-build/host-build-guide.md +++ b/docs/host-provisioning-and-migration.md @@ -1,8 +1,8 @@ -# Deploying a cc-ci host from scratch +# Provisioning and migrating a cc-ci host This is the whole path from "nothing" to a working CI server + orchestrator on one Hetzner -server. It was last done on 2026-09-07 for `195.201.88.249` and is written so a person or an LLM -can repeat it. Read it once before starting; the order matters. +server. The procedure was last used on 2026-09-07 for `195.201.88.249` and is written so a person or an LLM +can adapt it. Verify all versions, paths, and service names against the current Nix configuration before using it; the order matters. ## 0. What you need in hand @@ -148,7 +148,7 @@ traffic is docker-forwarded, not host INPUT). ### 4b. The CI server's checkout and its one out-of-band secret ```bash -# the bot deploy key for the private cc-ci-secrets submodule — generated ON this host by loops +# the bot deploy key for the private cc-ci-secrets submodule — generated ON this host by the loops user # (§4c) and registered on the autonomic-bot Gitea account; root only points at it: install -d -m700 /root/.ssh cat > /root/.ssh/config <<'SSHCFG' @@ -185,8 +185,7 @@ sudo -iu loops git clone --recursive https://git.autonomic.zone/recipe-maintainers/cc-ci-orchestrator.git /srv/cc-ci-orch sudo ln -sfn /srv/cc-ci-orch /srv/cc-ci # every script and unit says /srv/cc-ci cd /srv/cc-ci-orch -git clone https://git.autonomic.zone/recipe-maintainers/cc-ci.git cc-ci # Builder clone -git clone https://git.autonomic.zone/recipe-maintainers/cc-ci.git cc-ci-adv # Adversary clone +# Historical Builder/Adversary clones are no longer required. mkdir -p .cc-ci-logs .sops ``` @@ -217,7 +216,7 @@ not "clean" it away. | runtime path → `/secrets/files/…` | what | source | |---|---|---| | `/srv/cc-ci/.testenv` → `cc-ci.testenv` | `GITEA_PASSWORD` (autonomic-bot: PR/API calls), `DOCKERHUB_USERNAME/TOKEN` (harness image pulls). Nothing else: no tailscale key, no third-party model API keys (opencode's own auth is `opencode-auth.json`; add `TINFOIL_API_KEY` back only if `LOOP_MODEL` moves to a tinfoil model). | old host's copy minus the tailscale line; fresh: create each credential | -| `/srv/cc-ci/upgrader.env` (not a secret, lives in the checkout) | `LOOP_TIER`, `LOOP_MODEL`, `REPORT_MODEL`, `SUPERVISOR_MODEL` for the weekly run. This host is on the **OpenCode Go subscription** (`LOOP_TIER=go`, `opencode-go/…` models); the ZEN tier is pay-as-you-go credit and its key is not on this host | old host, or copy the example in `AGENTS.md` | +| `/srv/cc-ci/upgrader.env` (not a secret, lives in the checkout) | `LOOP_TIER`, `LOOP_MODEL`, `REPORT_MODEL`, `SUPERVISOR_MODEL` for the weekly run. This host is on the **OpenCode Go subscription** (`LOOP_TIER=go`, `opencode-go/…` models); the ZEN tier is pay-as-you-go credit and its key is not on this host | old host, or create the variables listed here | | `~loops/.ssh/cc-ci-local-ed25519` (+`.pub`) → same names | `ssh cc-ci` as root — to loopback on this host. **Generated on the host**, its pub in `nix/hosts/cc-ci/ssh-keys` | `ssh-keygen -t ed25519 -C cc-ci-loops-to-root@cc-ci` as loops | | `~loops/.ssh/autonomic-bot-cc-ci-ed25519` (+`.pub`) → same names | pushes recipe branches / PRs as `autonomic-bot`; root's ssh config points at the same file to clone the private cc-ci-secrets submodule. **Generated on the host** and registered on the bot's Gitea account (`POST /api/v1/user/keys` with the bot password) | `ssh-keygen -t ed25519 -C autonomic-bot@cc-ci-host` as loops | | `~loops/.local/share/opencode/auth.json` → `opencode-auth.json`; `~loops/.config/opencode/opencode.jsonc` (config, not secret — it must contain NO inline `apiKey`) | opencode provider auth + config. Exactly ONE provider, `opencode-go` — the orchestrator AND the weekly upgrader are opencode agents; there is no Claude on this host | old host; fresh: `opencode auth login` as loops | @@ -258,10 +257,10 @@ deploy-reports`, `deploy-backupbot`, `warm-keycloak`). Verify: ```bash systemctl is-system-running # running — or list-units --failed and read journalctl -u docker service ls # traefik app+socket-proxy, drone, bridge, dashboard, reports, backups: 1/1 -systemctl status cc-ci-loops cc-ci-orchestrator opencode-web nginx acme-dns fail2ban +systemctl status cc-ci-orchestrator opencode-web nginx acme-dns fail2ban fail2ban-client status sshd; fail2ban-client status nginx-http-auth systemctl list-timers 'cc-ci-*' nightly-sweep -sudo -iu loops tmux ls # cc-ci-orchestrator (+ loops sessions if a phase is active) +sudo -iu loops tmux ls # cc-ci-orchestrator (and weekly agents during a run) # the CI front doors, before DNS points here (expect 200 / 200 / 303 and ssl_verify=0 once # /var/lib/acme is restored or a cert has been issued): curl -s --resolve ci.commoninternet.net:443:127.0.0.1 -o /dev/null -w '%{http_code} %{ssl_verify_result}\n' https://ci.commoninternet.net/ @@ -300,7 +299,7 @@ stopped on the new host while its directory is copied: | `/var/lib/ci-certs` | the copy traefik is handed | then `systemctl restart cc-ci-acme-traefik-handoff` | | `/root/.abra` | abra's per-app env files for the deployed stacks | | | Drone data volume `/var/lib/docker/volumes/drone_ci_commoninternet_net_data` | Drone's DB: the Gitea OAuth grant, repo activation, build history | `docker service scale drone_ci_commoninternet_net_app=0` on the new host, copy, scale back to 1. Otherwise run `scripts/bootstrap-drone-oauth.sh` (cc-ci repo) with the bot password and re-activate repos | -| `/srv/cc-ci-orch/.cc-ci-logs`, `/srv/cc-ci-orch/cc-ci-plan/upstream/`, `REBOOTS.md`, `JOURNAL.md` | orchestrator history, the upgrader's per-recipe release-note registry | as loops; do the final sync after stopping the orchestrator on the old host | +| `/srv/cc-ci-orch/.cc-ci-logs`, `/srv/cc-ci-orch/cc-ci-plan/upstream/`, `cc-ci-plan/REBOOTS.md`, `cc-ci-plan/JOURNAL.md` | orchestrator history, the upgrader's per-recipe release-note registry | as loops; do the final sync after stopping the orchestrator on the old host | ## 7. Cutover and verification @@ -321,7 +320,7 @@ stopped on the new host while its directory is copied: 4. End to end: post `!testme` on an open recipe PR and watch it turn green on the new Drone; open `https://ci.commoninternet.net` and `https://report.ci.commoninternet.net`. 5. The orchestrator: as loops on the new host `cd /srv/cc-ci-orch && python3 cc-ci-plan/agents.py up orchestrator` - (or just `systemctl restart cc-ci-orchestrator`), attach with `claude --resume` or from - claude.ai/code. Its startup routine (AGENTS.md) reports phase + reboot count. + (or just `systemctl restart cc-ci-orchestrator`), attach with `sudo -iu loops tmux attach -t cc-ci-orchestrator` or use the opencode web UI. + Check its status and the host journal after startup. 6. Keep the old host as a cold standby for a week, then delete it (and its tailnet node — the old servers were on the tailnet; the new one is not). diff --git a/memory/MEMORY.md b/memory/MEMORY.md index 30f3bf5..bbfcf46 100644 --- a/memory/MEMORY.md +++ b/memory/MEMORY.md @@ -2,7 +2,7 @@ - [Enroll gate fixtures must fail loudly](enroll-gate-fixtures-fail-loudly.md) — version-gate reads via lifecycle.deployed_identity, never None-into-if; post-host-merge deploy = --cc-ci-only after merge (staging obsolete) -- [Orchestrator host: Hetzner](orchestrator-host-hetzner.md) — runs on Hetzner cpx22; rebuild cmd, loops-service bounce, git-identity gotcha +- [Orchestrator host: Hetzner](../archive/original-build/memory/orchestrator-host-hetzner.md) — runs on Hetzner cpx22; rebuild cmd, loops-service bounce, git-identity gotcha - [Push commits to remote](push-commits-to-remote.md) — push to git.autonomic.zone right after every commit in this repo - [Regression canary cadence](regression-canary-cadence.md) — server E2E canaries run on polish/review/release, not every commit - [Recipe-mirrors MUST be public](recipe-mirrors-public-org-blocker.md) — org public since ~2026-06, but /recipe-enroll created late mirrors (gitea, wordpress) private-from-birth, darkening report STATUS cells; flipped public + skill fixed 2026-09-14 @@ -13,10 +13,10 @@ - [Drone sqlite log extraction](drone-sqlite-log-extraction.md) — copy /data/database.sqlite from drone container, query builds→stages→steps→logs for full step output - [plausible upgrade-base trap](plausible-upgrade-base-trap.md) — RESOLVED: PR#3 GREEN L4; lessons: check harness base version pre-!testme; backupbot v2 label syntax; TinyLog not FREEZEable; BEAM exit-0 needs restart_policy any - [Swarm UpdateStatus convergence gotchas](swarm-updatestatus-convergence-gotchas.md) — N/N is not converged mid stop-first update; paused flag persists forever; only updating/rollback_started are active -- [Weekly upgrade queued after phases](weekly-upgrade-queued-after-phases.md) — 06-12 cron skipped; auto-runs /upgrade-all when phase queue (drone) finishes; don'\''t systemctl start the timer -- [cfold paused pending upgrade](cfold-paused-pending-upgrade.md) — cfold phase loops+watchdog STOPPED until /upgrade-all (cc-ci-upgrader) finishes; resume = restart watchdog (phase-idx 9) +- [Weekly upgrade queued after phases](../archive/original-build/memory/weekly-upgrade-queued-after-phases.md) — 06-12 cron skipped; auto-runs /upgrade-all when phase queue (drone) finishes; don'\''t systemctl start the timer +- [cfold paused pending upgrade](../archive/original-build/memory/cfold-paused-pending-upgrade.md) — cfold phase loops+watchdog STOPPED until /upgrade-all (cc-ci-upgrader) finishes; resume = restart watchdog (phase-idx 9) - [proxy VIP exhaustion runbook](proxy-vip-exhaustion-runbook.md) — TODO after upgrade: enlarge proxy overlay to /16 (exhausts at /24=254 VIPs); root cause of discourse/ghost deploy wedges - [ghost PR debug](ghost-pr-debug.md) — TODO after proxy fix: debug+fix the ghost upgrade PR (wedged on proxy VIP exhaustion; possible duplicate PR) -- [launch-system unification](launch-system-unification.md) — replacing 5 launchers + ~15 dotfiles with one agents.toml + agents.py; plan in cc-ci-plan/plan-unified-launch.md +- [launch-system unification](../archive/original-build/memory/launch-system-unification.md) — replacing 5 launchers + ~15 dotfiles with one agents.toml + agents.py; plan in cc-ci-plan/plan-unified-launch.md - [orchestrator backend-switch gotcha](orchestrator-backend-switch-gotcha.md) — full claude↔opencode switch: kill watchdog first, fix all control files, env overrides files, pkill -f self-matches - [cc-ci host rebuild procedure](cc-ci-host-rebuild-procedure.md) — how to nixos-rebuild the live cc-ci server (no self-service path; stage clone + copy sops secrets + drop .git + --flake .#cc-ci)