chore(deploy): build & (re)start microservices on release tag #102

Merged
shad0w merged 1 commit from chore/deploy-microservices into master 2026-06-23 21:33:46 +00:00
Owner

Why

The v* tag deploy (deploy.yml) only built and restarted the Next app (ppms). The standalone Playwright services — GstService / EpfoService / PdfService — were never built, created, or restarted by automation; the tag dropped their source on the host but nothing provisioned them. This makes them first-class in the release.

What

  • ecosystem.config.js (repo root) — pm2 definitions for gst-service (3003), epfo-service (3004), pdf-service (3005). It registers only services whose source is checked out (keyed on package.json), so a not-yet-merged service is skipped and adopted automatically once its PR lands (e.g. PdfService from #101). Ports are fixed here; secrets are read from the env at pm2-invocation time.
  • deploy.yml — after the app restart, a new step:
    1. exports the few keys the services need out of App/.env (PDF_SERVICE_TOKEN, ALLOWED_ORIGIN, EPFO_LIVE) — never PORT or the runner's ephemeral FORGEJO_TOKEN;
    2. npm install + npx playwright install chromium + npm run build for each present service;
    3. pm2 startOrReload ecosystem.config.js --update-env — creates the processes on the first release, reloads them on every release after — then pm2 save;
    4. health-checks :3003/:3004/:3005 (/health → 200).
  • automation/README.md — documents the flow and the one-time alignment step.

Notes / caveats

  • Resilient to ordering: this merges independently of #101. On master today it manages gst + epfo; it picks up pdf-service the moment that source is on the tag.
  • One-time alignment (flagged in the README): if a service already runs on pms1 under a different pm2 name, delete it once (pm2 delete <old> && pm2 save) so the canonical process can bind its port — otherwise the new one EADDRINUSE-clashes. I can't know the current names from here, hence the manual step.
  • Chromium system libs: the deploy runs playwright install chromium (browser binary only). The very first PdfService run also needs the OS libs (playwright install --with-deps chromium, needs sudo) — already present on the host since Gst/Epfo use Playwright.
  • npm install (not ci) because not every service carries a lockfile (EpfoService doesn't on master).
  • ppms itself is untouched — its deliberate non---update-env restart (FORGEJO_TOKEN handling) stays exactly as-is.

🤖 Generated with Claude Code

## Why The `v*` tag deploy (`deploy.yml`) only built and restarted the **Next app** (`ppms`). The standalone Playwright services — **GstService / EpfoService / PdfService** — were never built, created, or restarted by automation; the tag dropped their source on the host but nothing provisioned them. This makes them first-class in the release. ## What - **`ecosystem.config.js`** (repo root) — pm2 definitions for `gst-service` (3003), `epfo-service` (3004), `pdf-service` (3005). It registers **only services whose source is checked out** (keyed on `package.json`), so a not-yet-merged service is skipped and **adopted automatically once its PR lands** (e.g. PdfService from #101). Ports are fixed here; secrets are read from the env at pm2-invocation time. - **`deploy.yml`** — after the app restart, a new step: 1. exports the few keys the services need out of `App/.env` (`PDF_SERVICE_TOKEN`, `ALLOWED_ORIGIN`, `EPFO_LIVE`) — never `PORT` or the runner's ephemeral `FORGEJO_TOKEN`; 2. `npm install` + `npx playwright install chromium` + `npm run build` for each present service; 3. `pm2 startOrReload ecosystem.config.js --update-env` — **creates** the processes on the first release, **reloads** them on every release after — then `pm2 save`; 4. health-checks `:3003/:3004/:3005` (`/health` → 200). - **`automation/README.md`** — documents the flow and the one-time alignment step. ## Notes / caveats - **Resilient to ordering:** this merges independently of #101. On master today it manages gst + epfo; it picks up pdf-service the moment that source is on the tag. - **One-time alignment (flagged in the README):** if a service already runs on pms1 under a *different* pm2 name, delete it once (`pm2 delete <old> && pm2 save`) so the canonical process can bind its port — otherwise the new one EADDRINUSE-clashes. I can't know the current names from here, hence the manual step. - **Chromium system libs:** the deploy runs `playwright install chromium` (browser binary only). The very first PdfService run also needs the OS libs (`playwright install --with-deps chromium`, needs sudo) — already present on the host since Gst/Epfo use Playwright. - `npm install` (not `ci`) because not every service carries a lockfile (EpfoService doesn't on master). - `ppms` itself is untouched — its deliberate non-`--update-env` restart (FORGEJO_TOKEN handling) stays exactly as-is. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
shad0w added 1 commit 2026-06-23 21:29:57 +00:00
chore(deploy): build & (re)start microservices on release tag
All checks were successful
PR checks / checks (pull_request) Successful in 42s
PR checks / integration (pull_request) Successful in 31s
6b0210078a
The v* tag deploy previously only updated the Next app (ppms); GstService /
EpfoService / PdfService were never built or restarted by automation. Now the
same deploy manages them.

- ecosystem.config.js (root): pm2 definitions for gst-service (3003) /
  epfo-service (3004) / pdf-service (3005). Registers only services whose source
  is checked out (keyed on package.json), so a not-yet-merged service is skipped
  and adopted automatically once its PR lands. Secrets come from the env at pm2
  invocation; ports are fixed here.
- deploy.yml: after the app restart, export the few service secrets out of
  App/.env (never PORT or the ephemeral FORGEJO_TOKEN), npm install + playwright
  install chromium + build each present service, then
  `pm2 startOrReload ecosystem.config.js --update-env` (create on first release,
  reload after) + pm2 save, and health-check :3003/:3004/:3005.
- automation/README.md: documents the flow + the one-time alignment for any
  pre-existing differently-named pm2 process.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
shad0w merged commit 2ac11d7528 into master 2026-06-23 21:33:46 +00:00
Sign in to join this conversation.
No description provided.