diff --git a/.env.example b/.env.example index 11a4bc7..6ee97dc 100644 --- a/.env.example +++ b/.env.example @@ -2,7 +2,15 @@ # Defaults are set in docker-compose.yml if these are unset. # Copy to .env and adjust if you need a different reviewed version. +# Image versions REDIS_VERSION=7.4 JAEGER_VERSION=2.22.0 PROMETHEUS_VERSION=v3.13.4 GRAFANA_VERSION=13.2.4 + +# Gateway resource limits (applied independently to each gateway) +GATEWAY_CPUS=1.0 +GATEWAY_MEMORY=512M + +# Redis resource limits +REDIS_MEMORY=256M diff --git a/README.md b/README.md index 01be8d7..646f7c5 100644 Binary files a/README.md and b/README.md differ diff --git a/docker-compose.yml b/docker-compose.yml index 5766c68..5ac0e41 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,6 +3,10 @@ services: redis: image: redis:${REDIS_VERSION:-7.4}-alpine container_name: traffic-control-redis + deploy: + resources: + limits: + memory: "${REDIS_MEMORY:-256M}" healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s @@ -23,6 +27,11 @@ services: gateway-1: image: distributed-traffic-control:latest container_name: traffic-control-gateway-1 + deploy: + resources: + limits: + cpus: "${GATEWAY_CPUS:-1.0}" + memory: "${GATEWAY_MEMORY:-512M}" depends_on: redis: condition: service_healthy @@ -49,6 +58,11 @@ services: gateway-2: image: distributed-traffic-control:latest container_name: traffic-control-gateway-2 + deploy: + resources: + limits: + cpus: "${GATEWAY_CPUS:-1.0}" + memory: "${GATEWAY_MEMORY:-512M}" depends_on: redis: condition: service_healthy @@ -75,6 +89,11 @@ services: gateway-3: image: distributed-traffic-control:latest container_name: traffic-control-gateway-3 + deploy: + resources: + limits: + cpus: "${GATEWAY_CPUS:-1.0}" + memory: "${GATEWAY_MEMORY:-512M}" depends_on: redis: condition: service_healthy