chore(deploy): provision Forgejo runner, registry and deploy secrets #8

Open
opened 2026-10-22 17:55:22 +00:00 by dsh · 3 comments
Member

Scope

Turn the scaffolded Forgejo workflows into a working deployment pipeline.

Needs

  • Provision/confirm a Forgejo runner that supports Docker (DinD or socket) for image builds.
  • Create repository secrets: REGISTRY_USER, REGISTRY_TOKEN; for deploy: DEPLOY_SSH_KEY, DEPLOY_HOST, DEPLOY_USER, DEPLOY_PATH.
  • Log the deploy host into git.pvlb.dev so docker compose pull works.
  • Put a reverse proxy (Caddy/Traefik/nginx) in front of 127.0.0.1:8000 and set SITE_URL, TRUST_PROXY=1, SESSION_COOKIE_SECURE=1.
  • Run one manual deploy and verify /healthz, /, /de/, /admin.
  • Enable branch protection/required CI once the runner is reliable.

Acceptance

The publish workflow builds and pushes an image on master, and a manual workflow_dispatch deploy updates the host.

Moved from pvlb-infra/vps-setup#23 (created in the wrong repo by the issue tool's default).

## Scope Turn the scaffolded Forgejo workflows into a working deployment pipeline. ## Needs - Provision/confirm a Forgejo runner that supports Docker (DinD or socket) for image builds. - Create repository secrets: `REGISTRY_USER`, `REGISTRY_TOKEN`; for deploy: `DEPLOY_SSH_KEY`, `DEPLOY_HOST`, `DEPLOY_USER`, `DEPLOY_PATH`. - Log the deploy host into `git.pvlb.dev` so `docker compose pull` works. - Put a reverse proxy (Caddy/Traefik/nginx) in front of `127.0.0.1:8000` and set `SITE_URL`, `TRUST_PROXY=1`, `SESSION_COOKIE_SECURE=1`. - Run one manual deploy and verify `/healthz`, `/`, `/de/`, `/admin`. - Enable branch protection/required CI once the runner is reliable. ## Acceptance The publish workflow builds and pushes an image on `master`, and a manual `workflow_dispatch` deploy updates the host. <sub>Moved from pvlb-infra/vps-setup#23 (created in the wrong repo by the issue tool's default).</sub>
Author
Member

While this is pending, the public apex is not bare: pvlb.dev and www.pvlb.dev serve a temporary static holding page from the control repo (pvlb-infra/vps-setup: edge/welcome/, Caddy block in edge/Caddyfile, installed with bin/deploy-edge-local). Commands, backup path and rollback are in note pvlb-infra/vps-setup#35.

When the real deployment goes live: retire that Caddy site block (or point it at the app) and remove edge/welcome/, so the placeholder does not linger. The page already declares https://pvlb.dev/ as its canonical URL, and it is currently indexable.

While this is pending, the public apex is not bare: **`pvlb.dev` and `www.pvlb.dev` serve a temporary static holding page** from the control repo (`pvlb-infra/vps-setup`: `edge/welcome/`, Caddy block in `edge/Caddyfile`, installed with `bin/deploy-edge-local`). Commands, backup path and rollback are in note pvlb-infra/vps-setup#35. When the real deployment goes live: retire that Caddy site block (or point it at the app) and remove `edge/welcome/`, so the placeholder does not linger. The page already declares `https://pvlb.dev/` as its canonical URL, and it is currently indexable.
Author
Member

web/flango now has a worked reference for this (4ef7abe, CI run #1168 green). Reuse it rather than re-deriving:

  • deploy/compose.yaml — image pinned by IMAGE_TAG, SQLite named volume, 127.0.0.1:8000, healthcheck, 512 MiB cap
  • deploy/deploy.sh — pins the tag, pulls, waits up to 120 s for healthy, rolls back on failure; forward-only migrations caveat documented
  • deploy/receive.sh — SSH forced command: the deploy key can only submit an X.Y.Z, then sudo -u dockersvc deploy.sh; restrict,command=... entry in authorized_keys
  • .forgejo/workflows/publish.yml — a real publish only on a v* tag; missing registry secrets skip the push with a warning (checked in shell, not secrets.* in if:)
  • .forgejo/workflows/deploy.yml — manual dispatch, DEPLOY_SSH_KEY/DEPLOY_KNOWN_HOSTS/DEPLOY_HOST/DEPLOY_USER/DEPLOY_PORT; no runner on prod

Differences from the sketch above worth keeping: DEPLOY_PATH is replaced by the fixed /srv/dockersvc/<service> dir; publishing is tag-based, never on master; and production never runs :latest.

Two items not in this issue's list yet:

  1. Backups: the srv nightly archives per-service data/ + .env, so a named Docker volume is not covered. Add the service to /usr/local/sbin/pvlb-backup.sh (stop, tar .env + volume _data, start) before go-live; exact edit in flango deploy/README.md.
  2. Port map: add 8000/tcp loopback to ops/srv devops/portmap.md.

The apex switch must keep bind 104.152.49.193 and the /.well-known/matrix/* handler (both Caddy traps are in the runbook). Full runbook: web/flango@4ef7abe → deploy/README.md, and AGENTS.d/deployment.md in the private clone.

`web/flango` now has a worked reference for this (`4ef7abe`, CI run #1168 green). Reuse it rather than re-deriving: - `deploy/compose.yaml` — image pinned by `IMAGE_TAG`, SQLite named volume, `127.0.0.1:8000`, healthcheck, 512 MiB cap - `deploy/deploy.sh` — pins the tag, pulls, waits up to 120 s for `healthy`, rolls back on failure; forward-only migrations caveat documented - `deploy/receive.sh` — SSH **forced command**: the deploy key can only submit an `X.Y.Z`, then `sudo -u dockersvc deploy.sh`; `restrict,command=...` entry in `authorized_keys` - `.forgejo/workflows/publish.yml` — a real publish only on a `v*` tag; missing registry secrets skip the push with a warning (checked in shell, not `secrets.*` in `if:`) - `.forgejo/workflows/deploy.yml` — manual dispatch, `DEPLOY_SSH_KEY`/`DEPLOY_KNOWN_HOSTS`/`DEPLOY_HOST`/`DEPLOY_USER`/`DEPLOY_PORT`; no runner on prod Differences from the sketch above worth keeping: `DEPLOY_PATH` is replaced by the fixed `/srv/dockersvc/<service>` dir; publishing is tag-based, never on `master`; and production never runs `:latest`. Two items not in this issue's list yet: 1. **Backups**: the srv nightly archives per-service `data/ + .env`, so a named Docker volume is *not* covered. Add the service to `/usr/local/sbin/pvlb-backup.sh` (stop, tar `.env` + volume `_data`, start) before go-live; exact edit in flango `deploy/README.md`. 2. **Port map**: add `8000/tcp` loopback to `ops/srv` `devops/portmap.md`. The apex switch must keep `bind 104.152.49.193` and the `/.well-known/matrix/*` handler (both Caddy traps are in the runbook). Full runbook: `web/flango@4ef7abe` → `deploy/README.md`, and `AGENTS.d/deployment.md` in the private clone.
Author
Member

Tag v0.1.0 was pushed on 2026-11-26. The publish workflow built the image successfully after fixing a tomllib/Python-version bug in the workflow, but skipped the registry push: REGISTRY_USER and REGISTRY_TOKEN are not set in the repository secrets.

Run/log: https://git.pvlb.dev/web/web-frontend/actions/runs/78

After adding both secrets, re-run the publish workflow for v0.1.0 (or re-push the tag). Then the manual deploy workflow can pull git.pvlb.dev/web/web-frontend:0.1.0.

Tag `v0.1.0` was pushed on 2026-11-26. The publish workflow built the image successfully after fixing a `tomllib`/Python-version bug in the workflow, but **skipped the registry push**: `REGISTRY_USER` and `REGISTRY_TOKEN` are not set in the repository secrets. Run/log: https://git.pvlb.dev/web/web-frontend/actions/runs/78 After adding both secrets, re-run the `publish` workflow for `v0.1.0` (or re-push the tag). Then the manual deploy workflow can pull `git.pvlb.dev/web/web-frontend:0.1.0`.
Sign in to join this conversation.
No description provided.