diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fb15ad..c7231ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project follows [Semantic Versioning](https://semver.org/). ## [Unreleased] +## [1.37.4] - 2026-10-23 + +### Fixed + +- **Deploy script** (`scripts/deploy.sh`): without a tag it now deploys the latest `main`. The PM2 config is per install: `ecosystem.config.js` is no longer in git (the repo has `ecosystem.config.example.js`), so deploys stop overwriting the install's app names and port; the script keeps the install's copy across checkouts and rollbacks, and creates it from the example on a fresh install. The script also runs from a temporary copy (so checking out a new version of it mid-deploy is safe), and a failure rolls back once. + ## [1.37.3] - 2026-10-23 ### Fixed diff --git a/README.md b/README.md index 1b73838..d1ca9d9 100644 --- a/README.md +++ b/README.md @@ -98,8 +98,18 @@ Documentation: see Frontend README for environment and scripts. ## Deployment -To update a running install to a release: `bash scripts/deploy.sh v1.34.0` on the server -(backs up the database, migrates, builds, reloads PM2). +To update a running install, on the server in the repo folder: + +- `bash scripts/deploy.sh` — the latest `main` +- `bash scripts/deploy.sh v1.37.4` — a tagged release + +It backs up the database, checks the version out, installs, migrates, builds and reloads PM2. +If anything fails before the reload, it goes back to the previous version (the running app +isn't touched). + +PM2 uses the install's own `ecosystem.config.js` (app names, frontend port). It isn't in git, +so deploys never change it; the first deploy creates it from `ecosystem.config.example.js` — +set names that match your PM2 apps (`pm2 ls`) and the port you use. ### Backend Deployment diff --git a/backend/package-lock.json b/backend/package-lock.json index 55f10aa..b9eaa8e 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -1,12 +1,12 @@ { "name": "event-management-backend", - "version": "1.37.3", + "version": "1.37.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "event-management-backend", - "version": "1.37.3", + "version": "1.37.4", "hasInstallScript": true, "dependencies": { "@prisma/adapter-pg": "^7.10.1", diff --git a/backend/package.json b/backend/package.json index 41431c0..7139c65 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "event-management-backend", - "version": "1.37.3", + "version": "1.37.4", "description": "Event Management System Backend", "main": "src/index.js", "scripts": { diff --git a/docs/HANDOVER.md b/docs/HANDOVER.md index c466a92..606ed4b 100644 --- a/docs/HANDOVER.md +++ b/docs/HANDOVER.md @@ -1,6 +1,6 @@ # Handover — where things stand and how to carry on -Last updated: 2026-10-23, after **1.37.3**. The plan itself is in +Last updated: 2026-10-23, after **1.37.4**. The plan itself is in [ROADMAP-v2.md](./ROADMAP-v2.md) (decisions table at the end); the previous round of features is in [FEATURES-ROUND-1.md](./FEATURES-ROUND-1.md). @@ -12,6 +12,7 @@ features is in [FEATURES-ROUND-1.md](./FEATURES-ROUND-1.md). | 1.33.0 | Multi-day events phase A — sessions, late joining + late pricing, per-session check-in, attendance register, session reminders, certificates (4 templates, verify page) | | 1.34.0 | Background jobs on pg-boss (admin Background jobs page), Playwright e2e tests, Gitea CI workflow, `scripts/deploy.sh` | | 1.35.0 | Multi-day events phase B — "pick sessions" (per-session tickets and prices, session capacity) | +| 1.37.4 | Deploy script: no tag = latest main; per-install `ecosystem.config.js` out of git (`ecosystem.config.example.js`) | | 1.37.3 | Fix: the production build failed on unescaped quotes in a help text | | 1.37.2 | Payment status checks (PayFast transaction history; job every 15 min; Payments → Reconcile → Waiting for payment), PayFast Test connection | | 1.37.1 | "Pay online" hidden when no provider is on or under R15; SnapScan/Zapper dropped from the roadmap | @@ -44,6 +45,11 @@ features is in [FEATURES-ROUND-1.md](./FEATURES-ROUND-1.md). need a migration. - **Server Node version:** the deployment notes install Node 20, so dependencies must support Node 20 (that's why pg-boss is pinned to 10.x). +- **Deploying:** `bash scripts/deploy.sh [tag]` on the server (no tag = latest main). Each install + keeps its own `ecosystem.config.js` (PM2 app names, port), which is not in git. The script + runs from a temp copy of itself and rolls back on failure before the PM2 reload. It was + tested by running it against a throwaway clone with npm/pm2 stubbed: across the tracked → + untracked change for the PM2 file, deploying main, failed builds and a bad tag. - **Pushing:** pushing from some shells fails with "Failed to authenticate user" (a stale saved credential); pushing from your own terminal works. diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 6e4eb42..6b59bde 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "hope-events-frontend", - "version": "1.37.3", + "version": "1.37.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "hope-events-frontend", - "version": "1.37.3", + "version": "1.37.4", "dependencies": { "@dnd-kit/core": "^6.3.1", "@hookform/resolvers": "^5.2.1", diff --git a/frontend/package.json b/frontend/package.json index 40e17eb..0eb71f1 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "hope-events-frontend", - "version": "1.37.3", + "version": "1.37.4", "private": true, "scripts": { "dev": "next dev --turbopack", diff --git a/package-lock.json b/package-lock.json index 9ccce9b..2c2935d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "hope-events", - "version": "1.37.3", + "version": "1.37.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "hope-events", - "version": "1.37.3", + "version": "1.37.4", "license": "ISC", "devDependencies": { "@playwright/test": "^1.64.0", diff --git a/package.json b/package.json index afb66dd..3fbdfb4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hope-events", - "version": "1.37.3", + "version": "1.37.4", "main": "index.js", "scripts": { "dev:backend": "cd backend && npm run dev", diff --git a/scripts/deploy.sh b/scripts/deploy.sh index faf6237..d0a550c 100644 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -58,6 +58,8 @@ echo "==> Backing up the database" (cd backend && node -e "require('dotenv').config(); require('./src/utils/backupUtils').runBackup().then(r => console.log(' ', r.filename)).catch(e => { console.error(' Backup failed:', e.message); process.exit(1); })") rollback() { + # set -E passes this trap into ( … ) subshells too; only the script itself rolls back. + if [ "$BASH_SUBSHELL" -gt 0 ]; then return; fi echo "!!> Deploy failed — going back to $PREVIOUS (the running version was not touched)" clear_pm2_config git checkout -q "$PREVIOUS"