Deploy through the predeploy gate instead of by hand.

`npm run deploy` now runs the gate (typecheck, unit suite, render check) before
anything is copied, then rsyncs the source, rebuilds and restarts the service on
the target from LUMINARY_DEPLOY_* variables, and fails if the server is not
serving the same bundle hashes as the reviewed local build. npm runs a script
named predeploy before deploy on its own, so the gate runs once; invoked as
`node scripts/deploy.mjs` the script gates itself. Both scripts exit through
process.exitCode, because process.exit() truncated the failure messages when
they were piped.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
2026-11-28 15:20:18 +00:00
parent 4b17ca00db
commit 24deb8e69b
4 changed files with 222 additions and 21 deletions
+17
View File
@@ -281,6 +281,22 @@ npm run build # type-checks and bundles dist/
npm start # serves dist/ and /api from one Node process
```
To push a running install over ssh, `npm run deploy` runs the whole predeploy gate
first — a type error, a failing test or a clipping-overlay regression stops it before
anything is copied — then rsyncs the source, rebuilds, restarts the service and checks
that the server is serving the same bundle hashes. npm runs the `predeploy` script
before `deploy` on its own, so the gate runs exactly once; calling `node
scripts/deploy.mjs` directly runs the gate itself:
```bash
LUMINARY_DEPLOY_HOST=bhursey@photos.example.org \
LUMINARY_DEPLOY_SUDO_PASS=… npm run deploy
```
`LUMINARY_DEPLOY_PATH` (default `/srv/luminary`), `LUMINARY_DEPLOY_SERVICE` (default
`luminary`) and `LUMINARY_DEPLOY_SSH_PASS` cover a different layout; without the
password variables it uses your ssh key and passwordless sudo.
The server serves the built UI with an SPA fallback (unknown non-API paths return
`index.html`), caches `/assets/*` for a year as immutable, and returns `503` with a
build hint if `dist/index.html` is missing. JSON responses are `no-store`; image bytes
@@ -958,6 +974,7 @@ positions. Camera-lens defaults require both a normalised camera and lens name t
| `npm test` | Vitest, one pass then exit |
| `npm run check:render` | Headless Chrome check that the 16-bit sidecar and JPEG proxy upload in the same row order |
| `npm run predeploy` | Typecheck, unit suite, render check, then build — run this before pushing a deploy; the build is skipped when only test files changed since the last build |
| `npm run deploy` | Predeploy gate, then rsync, remote build, restart and bundle-hash check (see [Production deployment](#production-deployment)) |
Conventions worth knowing before changing code: