2.2 KiB
Docker Deployment
This deployment runs the Condo frontend and backend in Docker while connecting
to an existing PostgreSQL database. PostgreSQL is not included in
docker-compose.yml.
Runtime Shape
frontend: nginx serves the static files and proxies/api/*to the backend.backend: Node 24 runs the Fastify API on0.0.0.0:3000.- Existing PostgreSQL: must expose the
booking_testdatabase to the backend container.
The browser only needs the frontend URL. API requests go to the same origin
under /api, so the backend port does not need to be published.
Environment
Use the variables shown in deploy/.env.production.example. The important
settings are:
DB_HOST,DB_PORT,DB_USER,DB_PASSWORD,DB_NAME=booking_testAUTH_USERNAME,AUTH_PASSWORDAUTH_COOKIE_SECURE=falsefor HTTP test machinesAUTH_COOKIE_SECURE=truewhen the public frontend URL uses HTTPSFRONTEND_PORT, default8080
DB_HOST must be resolvable from inside the backend container. If PostgreSQL
runs directly on the Docker host, use the host address that works for that
server environment.
Build And Run
docker compose build
docker compose up -d
Open the frontend at:
http://<test-machine-host>:8080
Database Migration And Checks
The database scripts intentionally read one JSON connection line from standard input. Example shape:
{"host":"DB_HOST","port":5432,"user":"DB_USER","password":"DB_PASSWORD","database":"booking_test","ssl":false}
Run migration safety checks without database access:
docker compose run --rm backend npm run db:check-migrations
Run inventory and migrations against the existing PostgreSQL connection:
printf '%s\n' "$CONDON_DB_CONNECTION_JSON" | docker compose run --rm -T backend npm run db:inventory
printf '%s\n' "$CONDON_DB_CONNECTION_JSON" | docker compose run --rm -T backend npm run db:migrate:up
For an already imported database that matches the retained production baseline, run:
printf '%s\n' "$CONDON_DB_CONNECTION_JSON" | docker compose run --rm -T backend npm run db:verify
/api/auth/session is public and works as a basic process check. /api/health
requires a valid login cookie.