Configuration

Last updated


This page lists the environment variables, process management settings, and storage layout.

Environment Variables (app/.env)


VariableRequired.env valueDescription
NODE_PORTYes8080Express listening port; must match the Nginx proxy_pass port
NODE_ENVNoproductionWith development, the upload response src uses http://localhost:8080/c/img; otherwise https://${DOMAIN}/c/img
DOMAINWhen 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


ItemSettingLocation
Startuppm2-runtime runs app.ts through ./node_modules/.bin/ts-node -r tsconfig-paths/registerapp/app.json
PM2 logsstorage/logs/out.log, storage/logs/err.logapp/app.json
ClusterWith more than one CPU, the primary forks max(cpus.length, 4) - 1 workers and respawns any that exit; the primary does not listenapp/app.ts
Single coreWith one CPU, nothing is forked and the same process listensapp/app.ts
ShutdownOn SIGINT / SIGTERM / SIGHUP, kills all workers and exitsapp/app.ts
Path aliases@middlewares, @router, @srcapp/tsconfig.json

Storage Layout


Path in containerHost 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/.

  • Nginx routing and caching: Nginx
中文