Candidate Environment & Port Scheme
Pre-production testing environment with isolated port allocation per environment
Overview
Added a candidate environment for pre-production testing alongside the existing preprod environment. All three environments (production, preprod, candidate) now have isolated port allocations, dedicated service processes, and their own release paths.
What Changed
Candidate Environment
Seven candidate subdomains deployed and verified:
| Subdomain | Type |
|---|---|
| candidate.ftsonline.com.au | PHP-FPM (Symfony) |
| candidate-ordering.ftsonline.com.au | PHP-FPM (Ordering) |
| candidate-releases.ftsonline.com.au | Next.js (Fumadocs) |
| candidate-docs.ftsonline.com.au | Static (Fumadocs export) |
| candidate-landing.ftsonline.com.au | Static |
| candidate-dossier.ftsonline.com.au | Static (Vite SPA) |
| candidate-dossier-api.ftsonline.com.au | Bun (TanStack Start) |
Infrastructure: Cloudflare DNS, Let's Encrypt SSL, dedicated PHP-FPM pools, nginx vhosts, bare repo for builds.
Port Scheme
Each environment gets its own port range so processes never conflict:
| App | Production | Preprod | Candidate |
|---|---|---|---|
| releases (Next.js) | 30001 | 40001 | 50001 |
| dossier-api (Bun) | 30002 | 40002 | 50002 |
Ports are configured via environment variables (PORT in .env.local for releases, PORT in systemd unit for dossier-api).
Service Management
| App | Manager | Auto-restart |
|---|---|---|
| releases | Supervisor | On crash + on boot |
| dossier-api | Systemd | On failure + on boot |
| messenger workers | Supervisor | Hourly + on crash |
Release Commands
bun run release:prod:safe -- master # production
bun run release:preprod -- master # preprod
bun run release:candidate -- master # candidateEach command sets the correct LIVE_LINK_NAME and BUILDS_DIR so the release script routes to the right environment.
Files Touched
| File | Change |
|---|---|
package.json | release:candidate command |
scripts/release-prod-safe.ts | LIVE_LINK_NAME / BUILDS_DIR support |
scripts/post-release.sh | Candidate branch for service restarts |