You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ -n "${{ vars.DEPLOY_BRANCH }}" ] || err "Set Variable DEPLOY_BRANCH (e.g. main or develop)."
50
+
[ -n "${{ vars.HEALTH_PORT }}" ] || err "Set Variable HEALTH_PORT to the host port published for GET /health (see docker-compose / README; e.g. 9101). Without it the workflow builds http://localhost:/health and curl fails."
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
16
16
17
17
- Documentation: deployment URLs (Slack Request URL behind nginx `/paperscout/`), clone URL in server setup, staging-style placeholders.
18
18
-`db-backup.yml`: matrix parallel backups for `staging` / `production` using environment-level SSH secrets; uploads under `gs://insights-db-backups/paperscout/<environment>/` with unique temp files and object keys (UTC timestamp + `run_id` + `run_attempt` + environment); `EXIT` trap removes temp dump on failure. `SERVER_SETUP` restore examples updated (`--no-owner`, listing/copy by object name).
19
+
-`cd.yml`: validate `DEPLOY_PATH`, `DEPLOY_BRANCH`, and `HEALTH_PORT` GitHub Environment variables before SSH so missing `HEALTH_PORT` fails with a clear error instead of curling `http://localhost:/health`.
Copy file name to clipboardExpand all lines: README.md
+7-6Lines changed: 7 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -154,17 +154,17 @@ Push to develop → CI tests → SSH into staging → git pull --ff-only → doc
154
154
155
155
#### Configure GitHub Environments
156
156
157
-
Create two environments under **Settings → Environments**: `production` and `staging`. Both use the **same secret names** (different values per environment) and a small set of per-environment **Variables**:
157
+
Create two environments under **Settings → Environments**: `production` and `staging`. Both use the **same secret names** (different values per environment) and **these Environment variables are required for CD** — if `HEALTH_PORT` is omitted, the workflow builds `http://localhost:/health` and the deploy fails at the health check:
The workflow picks the environment from the branch (`refs/heads/main` → `production`, `refs/heads/develop` → `staging`), so values like `DEPLOY_PATH` and `HEALTH_PORT` are not hard-coded in the YAML.
On the **staging** server (separate host or separate path on the same host; must match the `staging` environment's `DEPLOY_PATH` and expose `/health` on `HEALTH_PORT`):
cp .env.example .env # use staging credentials / DB / Slack app as appropriate
190
190
docker compose up -d --build
191
-
curl -sf http://localhost:9102/health
191
+
curl -sf http://localhost:9101/health
192
192
```
193
193
194
194
See [`deploy/SERVER_SETUP.md`](deploy/SERVER_SETUP.md) for the full Ubuntu 22.04 provisioning guide, and [`.github/workflows/cd.yml`](.github/workflows/cd.yml) for the CD pipeline.
@@ -444,6 +444,7 @@ The `.github/workflows/cd.yml` workflow runs on push to `main` or `develop` (and
444
444
1.**Test** — single Python 3.12 pytest run as a gate (re-uses the same coverage threshold as CI).
445
445
2.**Deploy** — single environment-driven job:
446
446
- Selects the **GitHub Environment** from the branch (`main` → `production`, `develop` → `staging`).
447
+
-**Validates** Environment variables `DEPLOY_PATH`, `DEPLOY_BRANCH`, and **`HEALTH_PORT`** are non-empty (missing `HEALTH_PORT` produces an invalid health URL and fails the job immediately with an actionable error).
447
448
- SSHes using the environment-scoped secrets (`SERVER_HOST`, `SERVER_USER`, `SERVER_SSH_KEY`, optional `SERVER_PORT`).
448
449
- Reads per-environment **variables** (`DEPLOY_PATH`, `DEPLOY_BRANCH`, `HEALTH_PORT`) so the same workflow targets prod or staging without code changes.
449
450
- Runs `git fetch` + `git checkout` + `git pull --ff-only` against `DEPLOY_BRANCH` to keep deploys deterministic, then `docker compose up -d --build paperscout`.
If you use a **separate** staging deployment (second clone path and GitHub Environment `staging`), typical placeholders are:
232
232
233
233
- TLS / DNS: `sudo certbot --nginx -d staging.example.org` (replace with your real staging hostname when provisioning).
234
-
- Health check on the staging machine after mapping ports (see README CD table): `curl -sf http://localhost:9102/health` — use whatever port your staging compose publishes for health instead of `9102` if different.
234
+
- Health check on the staging machine after mapping ports (see README CD table): `curl -sf http://localhost:9101/health`.
235
235
- Slack **Request URL** when nginx proxies under `/paperscout/`: `https://staging.example.org/paperscout/slack/events`.
0 commit comments