fix(deployment): remove db service from base config - use external PostgreSQL stack for all environments

User specified that all environments (local, staging, production) should
use external PostgreSQL stacks consistently instead of embedded database.

Changes:
- Removed db service definition from base config (lines 87-114)
- Removed db dependency from queue-worker service
- Updated php-test DB_HOST to use external 'postgres' service

This eliminates the need for production overrides and creates uniform
architecture across all environments. The application-db-1 container
will no longer be started, fixing deployment failure.

This is the tenth cumulative fix for production deployment pipeline.

Related commits:
- f97863a: Add image references to production config
- 5b5fdee: Fix registry upload with sequential push
- a1b9a53: Remove CI test file
- 0b54086: Fix Node.js cache dependency
- 6263d7a: Trigger CI workflow verification
- 08f6f64: Stable IMAGE_TAG
- 2e539ed: Add build: null overrides
- 6e1faab: Deploy docker-compose via scp
- c1d6a71: Fix scp working directory
- a4ca6e9: Trigger pipeline
- 0c0c3ba: Fix .env mount conflict
- 41882da: Fix storage/var volume mounts
- 477fe67: Fix Redis health check
This commit is contained in:
2025-11-04 17:19:20 +01:00
parent 477fe6767e
commit 5b958dc6b1

View File

@@ -76,7 +76,7 @@ services:
environment:
APP_ENV: testing
APP_DEBUG: true
DB_HOST: db
DB_HOST: postgres # External PostgreSQL Stack service
REDIS_HOST: redis
networks:
- backend
@@ -84,34 +84,10 @@ services:
entrypoint: []
command: ["php", "-v"]
db:
image: postgres:16-alpine
environment:
POSTGRES_DB: ${DB_DATABASE:-michaelschiemer}
POSTGRES_USER: ${DB_USERNAME:-postgres}
# SECURITY: POSTGRES_PASSWORD must be set explicitly (no hardcoded fallback)
# Set DB_PASSWORD in .env.local for local development
# Use Docker Secrets in production/staging via DB_PASSWORD_FILE
POSTGRES_PASSWORD: ${DB_PASSWORD}
# Performance & Connection Settings
POSTGRES_INITDB_ARGS: "-E UTF8 --locale=C"
PGDATA: /var/lib/postgresql/data/pgdata
volumes:
- db_data:/var/lib/postgresql/data
- "${DB_CONFIG_PATH:-./docker/postgres/postgresql.conf}:/etc/postgresql/postgresql.conf:ro"
- "${DB_INIT_PATH:-./docker/postgres/init}:/docker-entrypoint-initdb.d:ro"
command:
- "postgres"
- "-c"
- "config_file=/etc/postgresql/postgresql.conf"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME:-postgres} -d ${DB_DATABASE:-michaelschiemer}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
networks:
- backend
# Database service removed - all environments use external PostgreSQL Stack
# Local: deployment/stacks/postgresql/
# Staging: deployment/stacks/postgresql/
# Production: deployment/stacks/postgresql/
redis:
image: redis:7-alpine
@@ -139,8 +115,7 @@ services:
condition: service_healthy
redis:
condition: service_healthy
db:
condition: service_healthy
# Note: PostgreSQL is external service, connection via app-internal network
volumes:
# Use same storage volumes as PHP container for consistency
# Persistent volumes for queue and logs