version: '3.8' services: # Load balancer nginx-lb: image: nginx:alpine ports: - "80:80" - "443:443" volumes: - ./nginx-lb.conf:/etc/nginx/nginx.conf - ./ssl:/etc/nginx/ssl depends_on: - big-pickle deploy: resources: limits: cpus: '0.5' memory: 256M restart: unless-stopped # Big pickle application instances big-pickle: build: . deploy: replicas: 100 resources: limits: cpus: '0.1' memory: 64M reservations: cpus: '0.05' memory: 32M restart_policy: condition: on-failure delay: 5s max_attempts: 3 healthcheck: test: ["CMD", "curl", "-f", "http://localhost/health"] interval: 30s timeout: 10s retries: 3 start_period: 40s restart: unless-stopped # Monitoring prometheus: image: prom/prometheus:latest ports: - "9090:9090" volumes: - ./prometheus.yml:/etc/prometheus/prometheus.yml command: - '--config.file=/etc/prometheus/prometheus.yml' - '--storage.tsdb.path=/prometheus' - '--web.console.libraries=/etc/prometheus/console_libraries' - '--web.console.templates=/etc/prometheus/consoles' - '--storage.tsdb.retention.time=200h' - '--web.enable-lifecycle' deploy: resources: limits: cpus: '0.5' memory: 512M restart: unless-stopped # Visualization grafana: image: grafana/grafana:latest ports: - "3000:3000" environment: - GF_SECURITY_ADMIN_PASSWORD=admin123 volumes: - grafana-storage:/var/lib/grafana deploy: resources: limits: cpus: '0.3' memory: 256M restart: unless-stopped volumes: grafana-storage: networks: default: driver: bridge driver_opts: com.docker.network.driver.mtu: 1500