Complete Docker compose deployment setup
- Add an API container entrypoint that waits for PostgreSQL, runs Prisma migrations, seeds demo data, and then starts NestJS. - Keep Prisma CLI and seed dependencies available in the API runtime image and copy seed source dependencies into the container. - Add Docker Compose healthchecks and health-based startup ordering for PostgreSQL, API, and Nginx web services. - Add Docker initialization environment switches for migrations, seed, and startup retries. - Add a dedicated Docker deployment guide covering services, ports, initialization, HTTPS, production variables, backup, restore, and troubleshooting. - Update README, AGENTS, installation, deployment, progress, and environment example docs for the Dockerized workflow.
This commit is contained in:
@@ -11,6 +11,11 @@ services:
|
||||
- "5433:5432"
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U surclaw -d surclaw"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
|
||||
api:
|
||||
build:
|
||||
@@ -26,12 +31,21 @@ services:
|
||||
SESSION_SECRET: change-me-in-production
|
||||
SESSION_COOKIE_SECURE: "false"
|
||||
FILE_STORAGE_DIR: /app/uploads
|
||||
RUN_DB_MIGRATIONS: "true"
|
||||
RUN_DB_SEED: "true"
|
||||
ports:
|
||||
- "3002:3100"
|
||||
depends_on:
|
||||
- db
|
||||
db:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- uploads_data:/app/uploads
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "node -e \"fetch('http://localhost:3100/api/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))\""]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 12
|
||||
start_period: 20s
|
||||
|
||||
web:
|
||||
build:
|
||||
@@ -43,7 +57,13 @@ services:
|
||||
- "4002:80"
|
||||
- "4443:443"
|
||||
depends_on:
|
||||
- api
|
||||
api:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "wget -q --spider http://127.0.0.1/ || exit 1"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 6
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
|
||||
Reference in New Issue
Block a user