feat: ephemeral payment staging host #546

Sammanfogat
supernaut sammanfogade 8 incheckningar från feat/payment-staging in i main 2026-10-05 13:28:47 +00:00
Ägare

Adds an ephemeral staging host for testing the full payment flow in the payment provider's test mode, following ADR 0030's target shape. The ADR amendment is a separate bitborg-docs PR.

Changes

  • Vault scoped to a prod group. group_vars/all/vault.yml moves to group_vars/prod/vault.yml. Both prod hosts join a new prod group in inventory/hosts.yml. The staging inventory has no such group, so a staging host can only load secrets from its own group_vars/staging/vault.yml. Readers of the old path are repointed (package.json, scripts/tofu-state-passphrase.sh, scripts/signup-drill.sh, runbook).
  • bitborg_env guard. site.yml asserts bitborg_env is prod or staging before any role runs. Eight prod-only roles (backup, backup-drill, token-audit, registry-mirror, registry-retention, renovate, runner-controller, monitoring-agent) run only on prod.
  • Staging inventory and overlay. inventory/staging.yml, group_vars/staging/vars.yml: *.stg.bitborg.se names, no legacy redirect vhosts, no backup or LFS volume, mailer off, billing and payments on.
  • Registry pin. The web role pins the registry name to the local Caddy only when this host serves the registry. Staging pulls the same images from the prod registry.
  • opentofu/staging.tofu. One VM on staging_count (default 0), with its own network, router and security group. The floating IP and a data volume sit outside the count, so DNS, certificates and state survive a rebuild.
  • Runbook "Staging" section. DNS, vault keys, up, first boot, down and reset, a renewal time-shift procedure, and the test checklist.

Verification

  • Prod ansible-playbook site.yml --check --diff after each Ansible commit: the changed task list is identical to the pre-change baseline, failed=0. The two changed tasks are an already pending monitoring-agent update.
  • Prod --check --tags web after the registry-pin change: changed=0, the pin task still ok.
  • A host with no bitborg_env fails at the guard.
  • No prod vault variable is defined for bitborg-staging (checked with a positive control on bitborg-prod).
  • tofu plan: only *staging* addresses. 16 to add with staging_count=0, 19 with =1. Nothing changed or destroyed.
  • ansible-lint, tofu validate, tofu fmt -check, markdownlint and prettier pass.

Not proven until the first bring-up: that a fresh staging host converges.

Merge notes

  • The next tofu apply of any kind creates the always-on staging pieces (network, floating IP, data volume) at a small standing cost.
  • While staging is up, set staging_count = 1 in terraform.tfvars, or another apply would destroy the staging VM.
Adds an ephemeral staging host for testing the full payment flow in the payment provider's test mode, following ADR 0030's target shape. The ADR amendment is a separate bitborg-docs PR. ## Changes - **Vault scoped to a `prod` group.** `group_vars/all/vault.yml` moves to `group_vars/prod/vault.yml`. Both prod hosts join a new `prod` group in `inventory/hosts.yml`. The staging inventory has no such group, so a staging host can only load secrets from its own `group_vars/staging/vault.yml`. Readers of the old path are repointed (`package.json`, `scripts/tofu-state-passphrase.sh`, `scripts/signup-drill.sh`, runbook). - **`bitborg_env` guard.** `site.yml` asserts `bitborg_env` is `prod` or `staging` before any role runs. Eight prod-only roles (backup, backup-drill, token-audit, registry-mirror, registry-retention, renovate, runner-controller, monitoring-agent) run only on prod. - **Staging inventory and overlay.** `inventory/staging.yml`, `group_vars/staging/vars.yml`: `*.stg.bitborg.se` names, no legacy redirect vhosts, no backup or LFS volume, mailer off, billing and payments on. - **Registry pin.** The web role pins the registry name to the local Caddy only when this host serves the registry. Staging pulls the same images from the prod registry. - **`opentofu/staging.tofu`.** One VM on `staging_count` (default 0), with its own network, router and security group. The floating IP and a data volume sit outside the count, so DNS, certificates and state survive a rebuild. - **Runbook "Staging" section.** DNS, vault keys, up, first boot, down and reset, a renewal time-shift procedure, and the test checklist. ## Verification - Prod `ansible-playbook site.yml --check --diff` after each Ansible commit: the `changed` task list is identical to the pre-change baseline, `failed=0`. The two `changed` tasks are an already pending monitoring-agent update. - Prod `--check --tags web` after the registry-pin change: `changed=0`, the pin task still `ok`. - A host with no `bitborg_env` fails at the guard. - No prod vault variable is defined for `bitborg-staging` (checked with a positive control on `bitborg-prod`). - `tofu plan`: only `*staging*` addresses. 16 to add with `staging_count=0`, 19 with `=1`. Nothing changed or destroyed. - ansible-lint, `tofu validate`, `tofu fmt -check`, markdownlint and prettier pass. Not proven until the first bring-up: that a fresh staging host converges. ## Merge notes - The next `tofu apply` of any kind creates the always-on staging pieces (network, floating IP, data volume) at a small standing cost. - While staging is up, set `staging_count = 1` in `terraform.tfvars`, or another apply would destroy the staging VM.
supernaut lade till 8 incheckningar 2026-10-05 13:25:54 +00:00
supernaut sammanfogade incheckning fcbc8cff8f till main 2026-10-05 13:28:47 +00:00
supernaut tog bort grenen feat/payment-staging 2026-10-05 13:28:47 +00:00
supernaut refererade denna ändringsförfrågan från en incheckning 2026-10-05 13:28:48 +00:00
Logga in för att delta i denna konversation.
Inga granskare
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-infra!546
Ingen beskrivning angiven.