What is the path from a commit to running in production? Decide CI (e.g. Gitea Actions), container registry, deployment method (GitOps controller such as Argo CD/Flux vs CI-push), manifest format (Helm, Kustomize), database migration execution, and rollback.
Part of #44
## Question
What is the path from a commit to running in production? Decide CI (e.g. Gitea Actions), container registry, deployment method (GitOps controller such as Argo CD/Flux vs CI-push), manifest format (Helm, Kustomize), database migration execution, and rollback.
Inputs from Which libraries and conventions form the FastAPI app skeleton?: CI should call the just recipes (lint, pyright, import-linter, tests on testcontainers Postgres), build the multi-stage image, smoke-test it, and export the OpenAPI schema as an artifact. Migrations are an explicit hapi migrate step that this ticket must place (Job, hook, etc.). Renovate is committed to; where it runs is decided here.
Inputs from [Which libraries and conventions form the FastAPI app skeleton?](https://git.bobbypalko.com/bobby/hapi/issues/51#issuecomment-196): CI should call the `just` recipes (lint, pyright, import-linter, tests on testcontainers Postgres), build the multi-stage image, smoke-test it, and export the OpenAPI schema as an artifact. Migrations are an explicit `hapi migrate` step that this ticket must place (Job, hook, etc.). Renovate is committed to; where it runs is decided here.
Constraint from How does hAPI connect to its managed database? (#53, ADR-0004): the DB connection budget caps concurrent app pods at 4, including rollout surge (10 connections each, out of ~46 usable). Replica count, HPA max and maxSurge must respect that. hapi migrate runs as hapi_migrator, a separate credential from the app's.
Constraint from **How does hAPI connect to its managed database?** (#53, [ADR-0004](https://git.bobbypalko.com/bobby/hapi/src/branch/main/docs/adr/0004-database-access.md)): the DB connection budget caps **concurrent app pods at 4, including rollout surge** (10 connections each, out of ~46 usable). Replica count, HPA max and `maxSurge` must respect that. `hapi migrate` runs as `hapi_migrator`, a separate credential from the app's.
bobby
self-assigned this 2026-11-24 13:13:26 -05:00
Pull-based delivery with Flux. Flux polls this public repo anonymously over HTTPS every 1 min, with prune and drift correction on, and holds no git credentials. The Owner installs it once over the tailnet. Layout: deploy/clusters/prod, deploy/infrastructure (HelmReleases), deploy/apps/hapi (Kustomize). There's no webhook Receiver.
CI on Gitea Actions, on a dedicated runner VM defined in OpenTofu under infra/: deny-all inbound, not on the tailnet.
On a PR:just lint, pyright, import-linter, testcontainers tests, image build, smoke test, OpenAPI artifact, and a Trivy scan that fails on fixable critical or high CVEs.
On main: the same, then push to Gitea's container registry (public images) and commit the digest bump using a write deploy key allowlisted on protected main.
Every green merge to main deploys. There are no release tags.
Migrations: a digest-named Job in its own Flux Kustomization, running as hapi_migrator. The app Kustomization dependsOn it with wait: true. Migrations are expand/contract and forward-only.
Rollout: 2 replicas, maxSurge: 1, maxUnavailable: 0, no HPA, a PDB with minAvailable: 1, replicas spread across the workers. That's at most 3 app pods.
Rollback:git revert of the bump. Break-glass is flux suspend plus kubectl rollout undo. There's no automated rollback.
Renovate: a nightly workflow running as its own bot user. It auto-merges only dev tooling; anything that ships comes as a PR.
Outside Flux: the Owner applies OpenTofu changes (runner VM, Cilium, CCM) over the tailnet. Talos and Kubernetes upgrades are a manual talosctl runbook.
Failures go to ntfy from CI (if: failure()) and from Flux's notification-controller. Topics and auth are designed with notifications.
Deferred to cluster hardening: Flux commit-signature verification, and image signing with admission verification.
## Resolution
Recorded in [ADR-0007](https://git.bobbypalko.com/bobby/hapi/src/branch/main/docs/adr/0007-flux-pull-delivery.md).
- **Pull-based delivery with Flux.** Flux polls this public repo anonymously over HTTPS every 1 min, with `prune` and drift correction on, and holds no git credentials. The Owner installs it once over the tailnet. Layout: `deploy/clusters/prod`, `deploy/infrastructure` (HelmReleases), `deploy/apps/hapi` (Kustomize). There's no webhook Receiver.
- **CI on Gitea Actions**, on a dedicated runner VM defined in OpenTofu under `infra/`: deny-all inbound, not on the tailnet.
- **On a PR:** `just` lint, pyright, import-linter, testcontainers tests, image build, smoke test, OpenAPI artifact, and a Trivy scan that fails on fixable critical or high CVEs.
- **On `main`:** the same, then push to **Gitea's container registry** (public images) and commit the **digest** bump using a write deploy key allowlisted on protected `main`.
- **Every green merge to `main` deploys.** There are no release tags.
- **Migrations:** a digest-named Job in its own Flux Kustomization, running as `hapi_migrator`. The app Kustomization `dependsOn` it with `wait: true`. Migrations are expand/contract and forward-only.
- **Rollout:** 2 replicas, `maxSurge: 1`, `maxUnavailable: 0`, no HPA, a PDB with `minAvailable: 1`, replicas spread across the workers. That's at most 3 app pods.
- **Rollback:** `git revert` of the bump. Break-glass is `flux suspend` plus `kubectl rollout undo`. There's no automated rollback.
- **Renovate:** a nightly workflow running as its own bot user. It auto-merges only dev tooling; anything that ships comes as a PR.
- **Outside Flux:** the Owner applies OpenTofu changes (runner VM, Cilium, CCM) over the tailnet. Talos and Kubernetes upgrades are a manual `talosctl` runbook.
- **Failures go to ntfy** from CI (`if: failure()`) and from Flux's notification-controller. Topics and auth are designed with notifications.
- **Deferred to cluster hardening:** Flux commit-signature verification, and image signing with admission verification.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Part of #44
Question
What is the path from a commit to running in production? Decide CI (e.g. Gitea Actions), container registry, deployment method (GitOps controller such as Argo CD/Flux vs CI-push), manifest format (Helm, Kustomize), database migration execution, and rollback.
Inputs from Which libraries and conventions form the FastAPI app skeleton?: CI should call the
justrecipes (lint, pyright, import-linter, tests on testcontainers Postgres), build the multi-stage image, smoke-test it, and export the OpenAPI schema as an artifact. Migrations are an explicithapi migratestep that this ticket must place (Job, hook, etc.). Renovate is committed to; where it runs is decided here.Constraint from How does hAPI connect to its managed database? (#53, ADR-0004): the DB connection budget caps concurrent app pods at 4, including rollout surge (10 connections each, out of ~46 usable). Replica count, HPA max and
maxSurgemust respect that.hapi migrateruns ashapi_migrator, a separate credential from the app's.Resolution
Recorded in ADR-0007.
pruneand drift correction on, and holds no git credentials. The Owner installs it once over the tailnet. Layout:deploy/clusters/prod,deploy/infrastructure(HelmReleases),deploy/apps/hapi(Kustomize). There's no webhook Receiver.infra/: deny-all inbound, not on the tailnet.justlint, pyright, import-linter, testcontainers tests, image build, smoke test, OpenAPI artifact, and a Trivy scan that fails on fixable critical or high CVEs.main: the same, then push to Gitea's container registry (public images) and commit the digest bump using a write deploy key allowlisted on protectedmain.maindeploys. There are no release tags.hapi_migrator. The app KustomizationdependsOnit withwait: true. Migrations are expand/contract and forward-only.maxSurge: 1,maxUnavailable: 0, no HPA, a PDB withminAvailable: 1, replicas spread across the workers. That's at most 3 app pods.git revertof the bump. Break-glass isflux suspendpluskubectl rollout undo. There's no automated rollback.talosctlrunbook.if: failure()) and from Flux's notification-controller. Topics and auth are designed with notifications.