Configuration
Last updated
This page lists the environment variables, process management settings, and storage layout.
Environment Variables (app/.env)
| Variable | Required | .env value |
Description |
|---|---|---|---|
NODE_PORT |
Yes | 8080 |
Express listening port; must match the Nginx proxy_pass port |
NODE_ENV |
No | production |
With development, the upload response src uses http://localhost:8080/c/img; otherwise https://${DOMAIN}/c/img |
DOMAIN |
When NODE_ENV is not development |
— | Public domain used to build the upload response src |
.env is loaded by dotenv, which does not override variables already set; docker-compose.yaml sets NODE_ENV: development, so inside the container the compose value wins. For production, edit the compose environment block and set DOMAIN.
Process Management
| Item | Setting | Location |
|---|---|---|
| Startup | pm2-runtime runs app.ts through ./node_modules/.bin/ts-node -r tsconfig-paths/register |
app/app.json |
| PM2 logs | storage/logs/out.log, storage/logs/err.log |
app/app.json |
| Cluster | With more than one CPU, the primary forks max(cpus.length, 4) - 1 workers and respawns any that exit; the primary does not listen |
app/app.ts |
| Single core | With one CPU, nothing is forked and the same process listens | app/app.ts |
| Shutdown | On SIGINT / SIGTERM / SIGHUP, kills all workers and exits |
app/app.ts |
| Path aliases | @middlewares, @router, @src |
app/tsconfig.json |
Storage Layout
| Path in container | Host mount (Docker Compose) | Purpose |
|---|---|---|
storage/image/upload/ |
./image/upload/ |
Original uploads |
storage/image/cache/ |
./image/cache/ |
Converted cache files |
storage/image/upload/.trash/ |
./image/upload/.trash/ |
Deleted items |
storage/logs/ |
./logs/nodejs/ |
req.log (rotated every 3 days) and PM2 logs |
storage/static/ |
Not mounted (ships with the code) | 404-light.svg, 404-dark.svg |
Nginx logs are mounted at ./logs/nginx/.
Related Pages
- Nginx routing and caching: Nginx
- Known deployment issues: Known Limitations