196 lines
4.7 KiB
YAML
196 lines
4.7 KiB
YAML
# Production Docker Compose Configuration
|
|
# Use: docker-compose -f docker-compose.yml -f docker-compose.prod.yml up
|
|
|
|
version: "3.8"
|
|
|
|
services:
|
|
nginx-proxy-manager:
|
|
# Production-specific NPM configuration
|
|
environment:
|
|
DISABLE_IPV6: 'true'
|
|
# Production logging
|
|
NPM_LOG_LEVEL: warn
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 512M
|
|
cpus: '0.5'
|
|
reservations:
|
|
memory: 256M
|
|
cpus: '0.25'
|
|
|
|
postgres:
|
|
# Production database configuration
|
|
environment:
|
|
POSTGRES_DB: atlas_prod
|
|
# Use stronger authentication in production
|
|
POSTGRES_INITDB_ARGS: "--auth-host=scram-sha-256"
|
|
volumes:
|
|
# Production database volume with backup location
|
|
- postgres_prod_data:/var/lib/postgresql/data
|
|
- ./backend/backups:/backups
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 2G
|
|
cpus: '1.0'
|
|
reservations:
|
|
memory: 1G
|
|
cpus: '0.5'
|
|
# Production database tuning
|
|
command: >
|
|
postgres
|
|
-c max_connections=100
|
|
-c shared_buffers=256MB
|
|
-c effective_cache_size=1GB
|
|
-c maintenance_work_mem=64MB
|
|
-c checkpoint_completion_target=0.9
|
|
-c wal_buffers=16MB
|
|
-c default_statistics_target=100
|
|
-c random_page_cost=1.1
|
|
-c effective_io_concurrency=200
|
|
-c work_mem=4MB
|
|
-c min_wal_size=1GB
|
|
-c max_wal_size=4GB
|
|
|
|
minio:
|
|
# Production MinIO configuration
|
|
environment:
|
|
# Production console settings
|
|
MINIO_CONSOLE_QUIET_MODE: "on"
|
|
MINIO_BROWSER_REDIRECT_URL: https://storage.your-domain.com
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 1G
|
|
cpus: '0.5'
|
|
reservations:
|
|
memory: 512M
|
|
cpus: '0.25'
|
|
|
|
api:
|
|
# Production API configuration
|
|
environment:
|
|
# Production profile
|
|
SPRING_PROFILES_ACTIVE: prod
|
|
|
|
# Production database
|
|
DB_URL: postgres:5432/atlas_prod
|
|
|
|
# Production logging
|
|
LOGGING_LEVEL_ROOT: WARN
|
|
LOGGING_LEVEL_COM_ATLAS: INFO
|
|
|
|
# Production security
|
|
ENABLE_DEBUG_MODE: false
|
|
|
|
# Production URLs (update these)
|
|
PUBLIC_API_URL: https://api.your-domain.com
|
|
PUBLIC_FRONT_URL: https://your-domain.com
|
|
|
|
# Performance tuning
|
|
JAVA_OPTS: >
|
|
-Xms1g
|
|
-Xmx2g
|
|
-XX:+UseG1GC
|
|
-XX:MaxGCPauseMillis=200
|
|
-XX:+UseStringDeduplication
|
|
-XX:+OptimizeStringConcat
|
|
-Dspring.jpa.hibernate.ddl-auto=validate
|
|
-Dspring.jpa.show-sql=false
|
|
|
|
volumes:
|
|
# Production logs
|
|
- ./backend/logs:/app/logs
|
|
- ./backend/logos:/app/logos:ro
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 3G
|
|
cpus: '2.0'
|
|
reservations:
|
|
memory: 1.5G
|
|
cpus: '1.0'
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8080/api/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 60s
|
|
|
|
frontend:
|
|
# Production frontend configuration
|
|
environment:
|
|
# Production URLs
|
|
VITE_API_BASE_URL: https://api.your-domain.com/api
|
|
VITE_APP_NAME: "Atlas CMMS"
|
|
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 256M
|
|
cpus: '0.5'
|
|
reservations:
|
|
memory: 128M
|
|
cpus: '0.25'
|
|
|
|
# Production monitoring and logging
|
|
watchtower:
|
|
image: containrrr/watchtower:latest
|
|
container_name: atlas_watchtower
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
environment:
|
|
# Update check interval (24 hours)
|
|
WATCHTOWER_POLL_INTERVAL: 86400
|
|
# Only update Atlas CMMS containers
|
|
WATCHTOWER_SCOPE: atlas-cmms
|
|
# Send notifications (configure webhook URL)
|
|
WATCHTOWER_NOTIFICATION_URL: ${WATCHTOWER_WEBHOOK_URL:-}
|
|
networks:
|
|
- atlas-network
|
|
restart: unless-stopped
|
|
|
|
# Log aggregation (optional)
|
|
loki:
|
|
image: grafana/loki:2.9.0
|
|
container_name: atlas_loki
|
|
ports:
|
|
- "3100:3100"
|
|
volumes:
|
|
- loki_data:/loki
|
|
- ./monitoring/loki-config.yml:/etc/loki/local-config.yaml
|
|
networks:
|
|
- atlas-network
|
|
restart: unless-stopped
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 512M
|
|
cpus: '0.5'
|
|
|
|
# Metrics collection (optional)
|
|
prometheus:
|
|
image: prom/prometheus:v2.45.0
|
|
container_name: atlas_prometheus
|
|
ports:
|
|
- "9090:9090"
|
|
volumes:
|
|
- prometheus_data:/prometheus
|
|
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml
|
|
networks:
|
|
- atlas-network
|
|
restart: unless-stopped
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 512M
|
|
cpus: '0.5'
|
|
|
|
volumes:
|
|
postgres_prod_data:
|
|
driver: local
|
|
loki_data:
|
|
driver: local
|
|
prometheus_data:
|
|
driver: local |