Files
michaelschiemer/deployment/applications/docker-compose.staging.yml
Michael Schiemer 9b74ade5b0 feat: Fix discovery system critical issues
Resolved multiple critical discovery system issues:

## Discovery System Fixes
- Fixed console commands not being discovered on first run
- Implemented fallback discovery for empty caches
- Added context-aware caching with separate cache keys
- Fixed object serialization preventing __PHP_Incomplete_Class

## Cache System Improvements
- Smart caching that only caches meaningful results
- Separate caches for different execution contexts (console, web, test)
- Proper array serialization/deserialization for cache compatibility
- Cache hit logging for debugging and monitoring

## Object Serialization Fixes
- Fixed DiscoveredAttribute serialization with proper string conversion
- Sanitized additional data to prevent object reference issues
- Added fallback for corrupted cache entries

## Performance & Reliability
- All 69 console commands properly discovered and cached
- 534 total discovery items successfully cached and restored
- No more __PHP_Incomplete_Class cache corruption
- Improved error handling and graceful fallbacks

## Testing & Quality
- Fixed code style issues across discovery components
- Enhanced logging for better debugging capabilities
- Improved cache validation and error recovery

Ready for production deployment with stable discovery system.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-13 12:04:17 +02:00

193 lines
4.9 KiB
YAML

# Staging overlay for Custom PHP Framework
# Extends base docker-compose.yml with staging-specific configurations
version: '3.8'
services:
web:
environment:
- APP_ENV=staging
- PHP_IDE_CONFIG= # Remove IDE config in staging
ports:
# Expose both HTTP and HTTPS for staging testing
- "${APP_PORT:-8000}:80"
- "${APP_SSL_PORT:-443}:443/tcp"
- "443:443/udp"
volumes:
# Semi-readonly application code in staging
- ./:/var/www/html:cached
- ./ssl:/var/www/ssl:ro
healthcheck:
test: ["CMD", "curl", "-f", "-k", "https://localhost/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "5"
labels: "service=nginx,environment=staging"
deploy:
resources:
limits:
memory: 512M
cpus: '1.0'
reservations:
memory: 256M
cpus: '0.5'
php:
environment:
- APP_ENV=staging
- APP_DEBUG=true # Enable debug in staging
- PHP_IDE_CONFIG= # Remove IDE config
- XDEBUG_MODE=debug # Enable Xdebug in staging for debugging
build:
args:
- ENV=staging
- COMPOSER_INSTALL_FLAGS=--optimize-autoloader
user: "1000:1000" # Keep development user for staging
volumes:
# Cached application code for staging
- ./:/var/www/html:cached
- storage-data:/var/www/html/storage:rw
- var-data:/var/www/html/var:rw
- composer-cache:/root/.composer/cache
healthcheck:
test: ["CMD", "php", "/var/www/html/public/health.php"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "5"
labels: "service=php,environment=staging"
deploy:
resources:
limits:
memory: 1G
cpus: '2.0'
reservations:
memory: 512M
cpus: '1.0'
db:
environment:
- MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
- MYSQL_DATABASE=${DB_DATABASE}
- MYSQL_USER=${DB_USERNAME}
- MYSQL_PASSWORD=${DB_PASSWORD}
ports:
- "33060:3306" # Keep external port for staging database access
volumes:
- db_data:/var/lib/mysql
healthcheck:
test: ["CMD", "mariadb-admin", "ping", "-h", "127.0.0.1", "-u", "root", "-p${DB_ROOT_PASSWORD}"]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "5"
labels: "service=mariadb,environment=staging"
deploy:
resources:
limits:
memory: 1G
cpus: '1.0'
reservations:
memory: 512M
cpus: '0.5'
redis:
volumes:
# Use standard Redis configuration in staging
- ./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: 20s
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "5"
labels: "service=redis,environment=staging"
deploy:
resources:
limits:
memory: 512M
cpus: '1.0'
reservations:
memory: 256M
cpus: '0.5'
queue-worker:
environment:
- APP_ENV=staging
- APP_DEBUG=true # Enable debug for staging
- WORKER_DEBUG=true
- WORKER_SLEEP_TIME=${WORKER_SLEEP_TIME:-100000}
- WORKER_MAX_JOBS=${WORKER_MAX_JOBS:-500}
- WORKER_MEMORY_LIMIT=${WORKER_MEMORY_LIMIT:-512M}
build:
args:
- ENV=staging
- COMPOSER_INSTALL_FLAGS=--optimize-autoloader
user: "1000:1000"
volumes:
- ./:/var/www/html:cached
- ./storage/logs:/var/www/html/storage/logs:rw
- ./src/Framework/CommandBus/storage:/var/www/html/src/Framework/CommandBus/storage:rw
restart: unless-stopped
stop_grace_period: 45s
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "5"
labels: "service=queue-worker,environment=staging"
deploy:
resources:
limits:
memory: 768M
cpus: '1.0'
reservations:
memory: 384M
cpus: '0.5'
# Staging network configuration - more permissive than production
networks:
frontend:
driver: bridge
backend:
driver: bridge
cache:
driver: bridge
volumes:
redis_data:
driver: local
composer-cache:
driver: local
storage-data:
driver: local
var-data:
driver: local
db_data:
driver: local