Harden production deployment lifecycle

This commit is contained in:
Arun committed 2026-08-11 09:25:44 +00:00
1 parent 3fbf2743d0
commit 5aa16b0f05
11 files changed
+475 -35

No files matched your search

+32 -11
View File
@@ -1,27 +1,48 @@
version: '3'
services:
db:
image: postgres:15
image: postgres:16.14-alpine
restart: unless-stopped
environment:
POSTGRES_USER: forumlify
POSTGRES_PASSWORD: 123456
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env}
POSTGRES_DB: forumlify
volumes:
- ./schema.sql:/docker-entrypoint-initdb.d/schema.sql
- db_data:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U forumlify -d forumlify"]
interval: 5s
timeout: 5s
retries: 10
start_period: 10s
app:
build: .
build:
context: .
dockerfile: Dockerfile
restart: unless-stopped
ports:
- "3000:3000"
- "${PORT:-3000}:3000"
depends_on:
- db
db:
condition: service_healthy
environment:
DATABASE_URL: postgresql://forumlify:123456@db:5432/forumlify
NODE_ENV: production
PORT: 3000
PGHOST: db
PGPORT: 5432
PGUSER: forumlify
PGPASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env}
PGDATABASE: forumlify
JWT_SECRET: ${JWT_SECRET:?Set JWT_SECRET in .env}
volumes:
- ./uploads:/app/uploads
- uploads_data:/app/uploads
healthcheck:
test: ["CMD", "node", "scripts/healthcheck.js"]
interval: 30s
timeout: 5s
retries: 3
start_period: 30s
volumes:
db_data:
uploads_data: