M2: Drone server + exec runner up; infra as idempotent-reconcile oneshots
Convert proxy+drone bring-up to writeShellApplication systemd oneshots that reconcile every activation (orchestrator steer). pkgs.abra overlay. Runner connected via RPC (polling, capacity=2). install.md = clone + nixos-rebuild switch. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+36
@@ -209,3 +209,39 @@ Server env: DRONE_SERVER_HOST/PROTO, DRONE_USER_CREATE.
|
||||
**Next:** scripts/deploy-drone.sh (abra deploy of drone server w/ Gitea SSO + rpc/client secrets),
|
||||
modules/drone-runner.nix (exec runner systemd unit, rpc secret from sops), wire sops secrets for the
|
||||
runner, then push a hello-world .drone.yml and confirm a green build (M2 gate).
|
||||
|
||||
## 2026-05-26 — M2: Drone server + exec runner up; infra as idempotent-reconcile oneshots
|
||||
|
||||
**Orchestrator steer (2×):** collapse install to a single `nixos-rebuild switch` — convert the
|
||||
manual deploy scripts into **idempotent-reconcile systemd oneshots** (writeShellApplication, embedded
|
||||
in store; after swarm-init+docker; wants network-online; wantedBy multi-user; reconcile every
|
||||
activation/boot, NO run-once sentinel; fail visibly on missing cert). Applied to proxy + drone.
|
||||
|
||||
**Refactor done:**
|
||||
- `modules/packages.nix`: `pkgs.abra` overlay (shared pinned build).
|
||||
- `modules/proxy.nix`: `deploy-proxy` oneshot — reconciles coop-cloud traefik (wildcard/no-ACME).
|
||||
- `modules/drone.nix`: `deploy-drone` oneshot — reconciles coop-cloud drone (Gitea SSO, secrets from
|
||||
/run/secrets), after deploy-proxy.
|
||||
- `modules/drone-runner.nix`: exec runner (fixed PATH conflict via `lib.mkForce`; allowUnfree for
|
||||
drone-runner-exec — Polyform license).
|
||||
- `modules/secrets.nix`: declared drone_rpc_secret + drone_gitea_client_secret + a sops *template*
|
||||
`drone-runner.env` (DRONE_RPC_SECRET) as the runner's EnvironmentFile (shared secret).
|
||||
- Removed `scripts/deploy-*.sh`. install.md now = clone + nixos-rebuild switch + preconditions.
|
||||
|
||||
**Build/switch:** build EXIT 0 (shellcheck clean via writeShellApplication; runner pkg unfree-allowed).
|
||||
`nixos-rebuild switch` → all three units `active`/`success`:
|
||||
- `deploy-proxy` success (reconciled traefik), `deploy-drone` → `deploy succeeded 🟢` (drone/drone
|
||||
2.26.0, secrets client_secret+rpc_secret v1, drone_env config), `drone-runner-exec` active.
|
||||
|
||||
**Verify (commands + output):**
|
||||
- `docker service ls` → `drone_ci_commoninternet_net_app 1/1`, traefik app+socket-proxy 1/1.
|
||||
- Via gateway: `…/healthz` → **200**; `/` → **303** (login redirect, correct).
|
||||
- Runner: journal shows a few startup `cannot ping the remote server (404)` (drone RPC not ready
|
||||
yet) then `successfully pinged the remote server` + `polling the remote server capacity=2
|
||||
endpoint=https://drone.ci.commoninternet.net kind=pipeline type=exec`. **Runner connected via RPC.**
|
||||
|
||||
**Remaining for M2 gate:** push a hello-world `.drone.yml` to cc-ci + get a green build. Needs the
|
||||
cc-ci repo activated in Drone, which requires the bot's Gitea OAuth login (browser flow) to grant
|
||||
Drone a Gitea token (to sync repos + set the push webhook). Next tick: script the OAuth login to mint
|
||||
a Drone token, activate cc-ci, push .drone.yml, confirm green. (DRONE_USER_CREATE made autonomic-bot
|
||||
the admin.)
|
||||
|
||||
Reference in New Issue
Block a user