feat(infra): PostgreSQL in the compose stacks, automatic pre-deploy backups (MITHOME-136)
- staging/prod: postgres:16-alpine per the llmdev Docker spec (healthcheck, log and memory limits, no host port); the app builds DATABASE_URI from POSTGRES_PASSWORD and waits for a healthy database; MongoDB kept for one release (rollback path, transfer source) - dev: PostgreSQL replaces MongoDB and Mongo Express (host port 5433, checked and registered); integration test rewritten with pg - deploy.sh: pg_dump (and, during the switch, mongodump) before the build - pg/@types/pg pinned to the adapter's 8.20.0 (one copy, no type clash) - docs: CLAUDE.md, architecture/testing steering, deploy workflow, DOCKER.md; staging switch runbook in the design Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
a68fb94b61
commit
0ec5714676
+20
-36
@@ -10,12 +10,8 @@ services:
|
||||
- "127.0.0.1:8080:3000"
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
# WHY authSource=admin: the mongodb service below only creates a root
|
||||
# user (via MONGO_INITDB_ROOT_USERNAME/PASSWORD), which forces --auth
|
||||
# on the mongod process — an unauthenticated URI fails every query
|
||||
# with "Command find requires authentication" (MITHOME-98).
|
||||
- MONGODB_URI=mongodb://admin:password123@mongodb:27017/mozdit?authSource=admin
|
||||
- MONGODB_DB=mozdit
|
||||
# MITHOME-136: PostgreSQL; dev-only, not secret credentials.
|
||||
- DATABASE_URI=postgresql://mozdit_web:devpassword@postgres:5432/mozdit_web
|
||||
# Dev-only, nem titkos (MITHOME-97) — Payload ez nélkül el sem indul
|
||||
# ("missing secret key"), és ez a compose fájl eddig nem adta át.
|
||||
- PAYLOAD_SECRET=dev-only-insecure-secret-do-not-use-in-staging-or-prod
|
||||
@@ -29,42 +25,30 @@ services:
|
||||
- /app/.next
|
||||
command: npm run dev
|
||||
depends_on:
|
||||
- mongodb
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- mozdit-network
|
||||
restart: unless-stopped
|
||||
|
||||
# MongoDB Database
|
||||
mongodb:
|
||||
image: mongo:7.0
|
||||
container_name: mozdit-mongodb-dev
|
||||
# PostgreSQL (MITHOME-136). Host port 5433 is registered in the llmdev port
|
||||
# registry (5432 is peakxi-dev) — for the integration tests and local tools.
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
container_name: mozdit-postgres-dev
|
||||
ports:
|
||||
- "127.0.0.1:27018:27017"
|
||||
- "127.0.0.1:5433:5432"
|
||||
environment:
|
||||
- MONGO_INITDB_ROOT_USERNAME=admin
|
||||
- MONGO_INITDB_ROOT_PASSWORD=password123
|
||||
- MONGO_INITDB_DATABASE=mozdit
|
||||
- POSTGRES_DB=mozdit_web
|
||||
- POSTGRES_USER=mozdit_web
|
||||
- POSTGRES_PASSWORD=devpassword
|
||||
volumes:
|
||||
- mongodb_data:/data/db
|
||||
- ./docker/mongodb/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
|
||||
networks:
|
||||
- mozdit-network
|
||||
restart: unless-stopped
|
||||
|
||||
# MongoDB Express (Web UI)
|
||||
mongo-express:
|
||||
image: mongo-express:1.0.2
|
||||
container_name: mozdit-mongo-express-dev
|
||||
ports:
|
||||
# MITHOME-137: 8081 is the mozdit staging app on llmdev (port registry)
|
||||
- "127.0.0.1:8082:8081"
|
||||
environment:
|
||||
- ME_CONFIG_MONGODB_ADMINUSERNAME=admin
|
||||
- ME_CONFIG_MONGODB_ADMINPASSWORD=password123
|
||||
- ME_CONFIG_MONGODB_URL=mongodb://admin:password123@mongodb:27017/
|
||||
- ME_CONFIG_BASICAUTH=false
|
||||
depends_on:
|
||||
- mongodb
|
||||
- postgres_data_dev:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U mozdit_web -d mozdit_web"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
networks:
|
||||
- mozdit-network
|
||||
restart: unless-stopped
|
||||
@@ -101,7 +85,7 @@ services:
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
mongodb_data:
|
||||
postgres_data_dev:
|
||||
driver: local
|
||||
loki_data:
|
||||
driver: local
|
||||
|
||||
Reference in New Issue
Block a user