Add registry-based prod promotion, separate from auto dev deploy
Dev keeps auto-deploying on every push to main, same as before, but now also publishes each build to git.jerodrigged.com's container registry tagged by short commit SHA (best-effort - never blocks the dev deploy if REGISTRY_TOKEN isn't set yet). Prod deploys only on an intentional `git push origin main:prod`, and only ever pulls a pre-built SHA-tagged image - it never rebuilds from source. This guarantees prod runs the exact artifact dev already validated, and makes promoting an untested commit fail loudly (pull of a nonexistent tag) instead of silently rebuilding something new. Needs new secrets before the prod path works: PROD_SSH_KEY, PROD_HOST, PROD_USER, REGISTRY_USER, REGISTRY_TOKEN. PROD_SSH_KEY/PROD_HOST/ REGISTRY_USER are already set; PROD_USER and REGISTRY_TOKEN still need Jerod's input.
This commit is contained in:
@@ -144,16 +144,43 @@ Missing images fall back to a styled placeholder — safe to deploy before photo
|
||||
| `.gitea/workflows/deploy.yml` | Push-to-main → SSH deploy → smoke tests |
|
||||
| `scripts/smoke-test.sh` | 6 curl assertions; exits non-zero on failure |
|
||||
|
||||
## CI/CD — Trunk-Based Development
|
||||
## CI/CD — Dev auto-deploys, prod is a deliberate promotion
|
||||
|
||||
Every push to `main`:
|
||||
Both pipelines run on Gitea Actions (git.jerodrigged.com). GitHub is not part
|
||||
of the deploy story — `main` on the GitHub mirror is unused.
|
||||
|
||||
**Dev (every push to `main`)** — `.gitea/workflows/deploy.yml`:
|
||||
1. Gitea runner (CT117) SSHes into CT114 (dev LXC at 192.168.1.192)
|
||||
2. `git fetch origin && git reset --hard origin/main` — robust, never fails on drift
|
||||
3. `docker compose build && docker compose up -d`
|
||||
4. Health check loop (24 × 5s attempts)
|
||||
5. `bash scripts/smoke-test.sh` — 6 tests; pipeline fails if any fail
|
||||
3. `docker compose build` (tags images `lisilou-portfolio-web:local` / `lisilou-portfolio-api:local`)
|
||||
4. If `REGISTRY_TOKEN` is set: tag+push both images to
|
||||
`git.jerodrigged.com/jhodgkin/lisilou-portfolio-{web,api}:<short-sha>` —
|
||||
best-effort, a publish failure never blocks the dev deploy itself
|
||||
5. `docker compose up -d` (runs the just-built local image)
|
||||
6. Health check loop (24 × 5s attempts), then `bash scripts/smoke-test.sh`
|
||||
|
||||
**Gitea secrets required:** `DEV_SSH_KEY`, `DEV_HOST`, `DEV_USER`
|
||||
**Prod (only on `git push origin main:prod`, or `<sha>:prod` to pin an older
|
||||
commit)** — `.gitea/workflows/deploy-prod.yml`:
|
||||
1. Gitea runner SSHes into CT111 (prod LXC, 192.168.1.246)
|
||||
2. `git fetch origin && git reset --hard origin/prod`, then computes the same
|
||||
short SHA dev used to tag its published image
|
||||
3. `docker compose -f docker-compose.yml -f docker-compose.deploy.yml pull` —
|
||||
pulls that exact SHA-tagged image from the registry. **No `docker compose
|
||||
build` ever runs here** — this is what guarantees prod runs the same
|
||||
artifact dev already validated, not a fresh rebuild that could drift.
|
||||
Pulling a SHA that dev never published fails loudly instead of silently
|
||||
rebuilding.
|
||||
4. `docker compose -f docker-compose.yml -f docker-compose.deploy.yml up -d`
|
||||
5. Same health check + smoke test pattern, against CT111
|
||||
|
||||
`docker-compose.deploy.yml` is the override that swaps each service's `image:`
|
||||
for the registry-tagged one; it's only ever used for the prod pull, never for
|
||||
local dev (`docker compose up -d` alone still builds from source as before).
|
||||
|
||||
**Gitea secrets required:** `DEV_SSH_KEY`, `DEV_HOST`, `DEV_USER` (dev);
|
||||
`PROD_SSH_KEY`, `PROD_HOST`, `PROD_USER` (prod); `REGISTRY_USER`,
|
||||
`REGISTRY_TOKEN` (both pipelines — a Gitea access token scoped
|
||||
`write:package,read:package`).
|
||||
|
||||
## Booking Wizard — Implementation Status
|
||||
|
||||
|
||||
Reference in New Issue
Block a user