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
201 lines
5.8 KiB
YAML
201 lines
5.8 KiB
YAML
# Base Docker Compose Configuration
|
|
# This file contains shared service definitions, networks, and volumes.
|
|
# Use with environment-specific override files:
|
|
# - docker-compose.local.yml (local development)
|
|
# - docker-compose.staging.yml (staging environment)
|
|
# - docker-compose.production.yml (production environment)
|
|
#
|
|
# Usage:
|
|
# Local: docker-compose -f docker-compose.base.yml -f docker-compose.local.yml up
|
|
# Staging: docker-compose -f docker-compose.base.yml -f docker-compose.staging.yml up
|
|
# Production: docker-compose -f docker-compose.base.yml -f docker-compose.production.yml up
|
|
|
|
services:
|
|
web:
|
|
build:
|
|
context: docker/nginx
|
|
dockerfile: Dockerfile
|
|
healthcheck:
|
|
test: ["CMD", "nc", "-z", "127.0.0.1", "443"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
depends_on:
|
|
php:
|
|
condition: service_started
|
|
networks:
|
|
- frontend
|
|
- backend
|
|
|
|
php:
|
|
build:
|
|
context: .
|
|
dockerfile: docker/php/Dockerfile
|
|
args:
|
|
- ENV=${APP_ENV:-dev}
|
|
- COMPOSER_INSTALL_FLAGS=${COMPOSER_INSTALL_FLAGS:---no-scripts --no-autoloader}
|
|
healthcheck:
|
|
test: [ "CMD", "php", "-v" ]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
networks:
|
|
- backend
|
|
- cache
|
|
volumes:
|
|
# Shared Volume für Composer-Cache über Container-Neustarts hinweg
|
|
- composer-cache:/root/.composer/cache
|
|
# Persistent volumes for queue and logs
|
|
- storage-queue:/var/www/html/storage/queue:rw
|
|
- var-data:/var/www/html/var/logs:rw
|
|
tmpfs:
|
|
# tmpfs for cache and runtime directories (RAM-based, faster I/O)
|
|
- /var/www/html/storage/cache
|
|
- /var/www/html/storage/discovery
|
|
- /var/www/html/var/cache
|
|
- /tmp
|
|
|
|
php-test:
|
|
build:
|
|
context: .
|
|
dockerfile: docker/php/Dockerfile.test
|
|
user: "1000:1000"
|
|
profiles:
|
|
- test
|
|
volumes:
|
|
- composer-cache:/home/appuser/.composer/cache
|
|
# Persistent volumes for queue and logs
|
|
- storage-queue:/var/www/html/storage/queue:rw
|
|
- var-data:/var/www/html/var/logs:rw
|
|
tmpfs:
|
|
# tmpfs for cache and runtime directories (RAM-based, faster I/O)
|
|
- /var/www/html/storage/cache
|
|
- /var/www/html/storage/discovery
|
|
- /var/www/html/var/cache
|
|
- /tmp
|
|
environment:
|
|
APP_ENV: testing
|
|
APP_DEBUG: true
|
|
DB_HOST: postgres # External PostgreSQL Stack service
|
|
REDIS_HOST: redis
|
|
networks:
|
|
- backend
|
|
- cache
|
|
entrypoint: []
|
|
command: ["php", "-v"]
|
|
|
|
# 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
|
|
volumes:
|
|
- "${REDIS_CONFIG_PATH:-./docker/redis/redis.conf}:/usr/local/etc/redis/redis.conf:ro"
|
|
- redis_data:/data
|
|
command: ["redis-server", "/usr/local/etc/redis/redis.conf"]
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 30s
|
|
networks:
|
|
- cache
|
|
|
|
queue-worker:
|
|
build:
|
|
context: .
|
|
dockerfile: docker/worker/Dockerfile
|
|
entrypoint: "" # Override any entrypoint
|
|
command: ["php", "/var/www/html/worker.php"] # Direct command execution
|
|
depends_on:
|
|
php:
|
|
condition: service_healthy
|
|
redis:
|
|
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
|
|
- storage-queue:/var/www/html/storage/queue:rw
|
|
- var-data:/var/www/html/var/logs:rw
|
|
tmpfs:
|
|
# tmpfs for cache and runtime directories (RAM-based, faster I/O)
|
|
- /var/www/html/storage/cache
|
|
- /var/www/html/storage/discovery
|
|
- /var/www/html/var/cache
|
|
- /tmp
|
|
networks:
|
|
- backend
|
|
- cache
|
|
# Graceful shutdown timeout
|
|
stop_grace_period: 30s
|
|
|
|
minio:
|
|
image: minio/minio:latest
|
|
environment:
|
|
- TZ=Europe/Berlin
|
|
# SECURITY: MINIO credentials must be set explicitly (no hardcoded fallback)
|
|
# Set MINIO_ROOT_USER and MINIO_ROOT_PASSWORD in .env.local for local development
|
|
# Use Docker Secrets in production/staging for production deployments
|
|
- MINIO_ROOT_USER=${MINIO_ROOT_USER}
|
|
- MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}
|
|
command: server /data --console-address ":9001"
|
|
volumes:
|
|
- minio_data:/data
|
|
- /etc/timezone:/etc/timezone:ro
|
|
- /etc/localtime:/etc/localtime:ro
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 10s
|
|
networks:
|
|
- backend
|
|
|
|
networks:
|
|
frontend:
|
|
driver: bridge
|
|
backend:
|
|
driver: bridge
|
|
cache:
|
|
driver: bridge
|
|
|
|
volumes:
|
|
redis_data:
|
|
composer-cache:
|
|
storage-queue: # Queue-Verzeichnis (Performance-kritisch, persistent)
|
|
var-data: # Runtime logs (persistent)
|
|
db_data:
|
|
project-data:
|
|
worker-logs:
|
|
worker-queue:
|
|
worker-storage: # Complete separate storage for worker with correct permissions
|
|
minio_data: # MinIO object storage data
|
|
|
|
# Docker Secrets Configuration
|
|
# Secrets are defined here but activated in environment-specific override files
|
|
secrets:
|
|
db_root_password:
|
|
file: ./secrets/db_root_password.txt
|
|
external: false
|
|
db_user_password:
|
|
file: ./secrets/db_user_password.txt
|
|
external: false
|
|
redis_password:
|
|
file: ./secrets/redis_password.txt
|
|
external: false
|
|
app_key:
|
|
file: ./secrets/app_key.txt
|
|
external: false
|
|
vault_encryption_key:
|
|
file: ./secrets/vault_encryption_key.txt
|
|
external: false
|
|
git_token:
|
|
file: ./secrets/git_token.txt
|
|
external: false
|
|
|