Update setup docs for dotenv + default port 33033

This commit is contained in:
2026-06-17 22:26:11 +10:00
parent cc0803b09f
commit bf719a1dda
+7 -7
View File
@@ -55,11 +55,11 @@ npm install
cp .env.example .env
```
Then edit `.env` and set, at minimum:
`.env` is loaded automatically at startup via dotenv, so `npm start` and `npm run seed` read it directly — no process manager or manual `export` needed. Edit `.env` and set, at minimum:
- `JWT_SECRET` — a long random string (e.g. `openssl rand -hex 32`). This signs login tokens; treat it like a password.
- `ADMIN_USER` / `ADMIN_PASS` — the bootstrap admin login created on first seed. You'll change the password from the admin panel right after.
- `PORT` — defaults to `3000`; change if that port is taken.
- `PORT` — defaults to `33033`; change if that port is taken. Keep it in sync with the nginx upstream (step 6).
### 4. Seed the database
@@ -77,18 +77,18 @@ Re-running `npm run seed` is safe — it only seeds ghost/set data when the `gho
npm start
```
You should see `Newbury Nights listening on http://127.0.0.1:3000`. Test it locally:
You should see `Newbury Nights listening on http://127.0.0.1:33033` (or whatever `PORT` you set). Test it locally:
```bash
curl http://127.0.0.1:3000/healthz # -> {"ok":true}
curl http://127.0.0.1:3000/api/scan/NN-70419 # -> Wrecked Shrimp Boat roster + Captain Archibald
curl http://127.0.0.1:33033/healthz # -> {"ok":true}
curl http://127.0.0.1:33033/api/scan/NN-70419 # -> Wrecked Shrimp Boat roster + Captain Archibald
```
For production, run it under a process manager so it restarts on reboot/crash — e.g. `pm2 start server.js --name newbury-nights`, or a systemd unit. Pass the env vars through whatever manager you use.
For production, run it under a process manager so it restarts on reboot/crash — e.g. `pm2 start server.js --name newbury-nights`, or a systemd unit. dotenv still loads `.env` under either.
### 6. Put nginx in front (HTTPS)
Camera and gyro APIs only work in a secure context, so the site must be served over HTTPS. Copy the example server block and adjust `server_name` and certificate paths:
Camera and gyro APIs only work in a secure context, so the site must be served over HTTPS. Copy the example server block and adjust `server_name` and certificate paths (the example upstream already points at `127.0.0.1:33033` — match it to your `PORT`):
```bash
sudo cp deploy/nginx.conf.example /etc/nginx/sites-available/newbury-nights