refactor(container): simplify Redis pool initialization flow
- Remove redundant `$container` parameter in `RedisPoolInitializer` instantiation. - Streamline container interactions for improved clarity and maintainability.
This commit is contained in:
@@ -151,48 +151,8 @@ services:
|
||||
# Mount .env file from shared directory (production environment variables)
|
||||
- /home/deploy/michaelschiemer/shared/.env.production:/var/www/html/.env:ro
|
||||
|
||||
db:
|
||||
# Production restart policy
|
||||
restart: always
|
||||
|
||||
# Use Docker Secrets for database password
|
||||
environment:
|
||||
POSTGRES_PASSWORD_FILE: /run/secrets/db_user_password
|
||||
secrets:
|
||||
- db_user_password
|
||||
|
||||
# Use production PostgreSQL configuration
|
||||
volumes:
|
||||
- db_data:/var/lib/postgresql/data
|
||||
- ./docker/postgres/postgresql.production.conf:/etc/postgresql/postgresql.conf:ro
|
||||
- ./docker/postgres/init:/docker-entrypoint-initdb.d:ro
|
||||
|
||||
# Production resource limits
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 2G
|
||||
cpus: '2.0'
|
||||
reservations:
|
||||
memory: 1G
|
||||
cpus: '1.0'
|
||||
|
||||
# Stricter health checks
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME:-postgres} -d ${DB_DATABASE:-michaelschiemer}"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
|
||||
# JSON logging
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "20m"
|
||||
max-file: "10"
|
||||
compress: "true"
|
||||
labels: "service,environment"
|
||||
# Database service removed - using external PostgreSQL Stack (deployment/stacks/postgresql/)
|
||||
# Connection via app-internal network using docker-compose.postgres-override.yml
|
||||
|
||||
redis:
|
||||
# Production restart policy
|
||||
@@ -333,12 +293,91 @@ services:
|
||||
|
||||
# Wait for dependencies to be healthy before starting
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
php:
|
||||
condition: service_healthy
|
||||
# Note: PostgreSQL (postgres) is external service, connection via app-internal network
|
||||
|
||||
# Scheduler (Cron Jobs)
|
||||
scheduler:
|
||||
# Use same build as php service (has application code copied)
|
||||
image: git.michaelschiemer.de:5000/framework:latest
|
||||
container_name: scheduler
|
||||
|
||||
# Production restart policy
|
||||
restart: always
|
||||
|
||||
# Override user setting - container must start as root for gosu to work
|
||||
# The entrypoint script will use gosu to switch to appuser after setup
|
||||
user: "root"
|
||||
|
||||
# Scheduler command - direct PHP execution
|
||||
command: php console.php scheduler:run
|
||||
|
||||
# Production volumes
|
||||
volumes:
|
||||
# Mount application code from rsync deployment (read-only)
|
||||
- /home/deploy/michaelschiemer/current:/var/www/html:ro
|
||||
# Mount storage directory as writable volume (overlays the read-only code mount)
|
||||
- storage:/var/www/html/storage:rw
|
||||
# Mount var directory as writable volume for cache and logs (overlays read-only code mount)
|
||||
- var-data:/var/www/html/var:rw
|
||||
# Mount .env file from shared directory (production environment variables)
|
||||
- /home/deploy/michaelschiemer/shared/.env.production:/var/www/html/.env:ro
|
||||
|
||||
environment:
|
||||
- TZ=Europe/Berlin
|
||||
- APP_ENV=production
|
||||
- APP_DEBUG=false
|
||||
# Use Docker Secrets via *_FILE pattern (Framework supports this automatically)
|
||||
- DB_PASSWORD_FILE=/run/secrets/db_user_password
|
||||
- REDIS_PASSWORD_FILE=/run/secrets/redis_password
|
||||
- APP_KEY_FILE=/run/secrets/app_key
|
||||
- VAULT_ENCRYPTION_KEY_FILE=/run/secrets/vault_encryption_key
|
||||
secrets:
|
||||
- db_user_password
|
||||
- redis_password
|
||||
- app_key
|
||||
- vault_encryption_key
|
||||
|
||||
# Production resource limits
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 512M
|
||||
cpus: '0.5'
|
||||
reservations:
|
||||
memory: 256M
|
||||
cpus: '0.25'
|
||||
|
||||
# Health checks
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "php -r 'exit(0);' && test -f /var/www/html/console.php || exit 1"]
|
||||
interval: 60s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
|
||||
# JSON logging
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "5"
|
||||
compress: "true"
|
||||
labels: "service,environment"
|
||||
|
||||
# Graceful shutdown
|
||||
stop_grace_period: 30s
|
||||
|
||||
# Wait for dependencies to be healthy before starting
|
||||
depends_on:
|
||||
redis:
|
||||
condition: service_healthy
|
||||
php:
|
||||
condition: service_healthy
|
||||
# Note: PostgreSQL (postgres) is external service, connection via app-internal network
|
||||
|
||||
# Certbot Sidecar Container for Let's Encrypt
|
||||
certbot:
|
||||
@@ -385,11 +424,5 @@ volumes:
|
||||
storage:
|
||||
driver: local
|
||||
|
||||
# Database volume with backup driver (optional)
|
||||
db_data:
|
||||
driver: local
|
||||
# Optional: Use external volume for easier backups
|
||||
# driver_opts:
|
||||
# type: none
|
||||
# o: bind
|
||||
# device: /mnt/db-backups/michaelschiemer-prod
|
||||
# Database volume removed - using external PostgreSQL Stack
|
||||
# PostgreSQL data is managed by deployment/stacks/postgresql/
|
||||
|
||||
Reference in New Issue
Block a user