|
| 1 | +version: '3.8' |
| 2 | + |
| 3 | +services: |
| 4 | + cache-warming-service: |
| 5 | + build: |
| 6 | + context: . |
| 7 | + dockerfile: Dockerfile |
| 8 | + container_name: cache_warming_service |
| 9 | + ports: |
| 10 | + - '${CACHE_WARMING_PORT:-3021}:3021' |
| 11 | + environment: |
| 12 | + - NODE_ENV=development |
| 13 | + - PORT=3021 |
| 14 | + - DB_HOST=postgres |
| 15 | + - DB_PORT=5432 |
| 16 | + - DB_USER=${DB_USER:-postgres} |
| 17 | + - DB_PASSWORD=${DB_PASSWORD:-password} |
| 18 | + - DB_NAME=${CACHE_WARMING_DB_NAME:-cache_warming_db} |
| 19 | + - REDIS_HOST=redis |
| 20 | + - REDIS_PORT=6379 |
| 21 | + - REDIS_PASSWORD=${REDIS_PASSWORD:-redis123} |
| 22 | + - CACHE_WARM_ON_STARTUP=${CACHE_WARM_ON_STARTUP:-true} |
| 23 | + - CACHE_WARMING_LIMIT=${CACHE_WARMING_LIMIT:-50} |
| 24 | + - CACHE_ADAPTIVE_WARMING_LIMIT=${CACHE_ADAPTIVE_WARMING_LIMIT:-30} |
| 25 | + - CACHE_HIT_RATE_TARGET=${CACHE_HIT_RATE_TARGET:-0.85} |
| 26 | + depends_on: |
| 27 | + postgres: |
| 28 | + condition: service_healthy |
| 29 | + redis: |
| 30 | + condition: service_healthy |
| 31 | + networks: |
| 32 | + - cache-warming-network |
| 33 | + |
| 34 | + postgres: |
| 35 | + image: postgres:15-alpine |
| 36 | + container_name: cache_warming_postgres |
| 37 | + ports: |
| 38 | + - '${CACHE_WARMING_DB_PORT:-5434}:5432' |
| 39 | + environment: |
| 40 | + POSTGRES_USER: ${DB_USER:-postgres} |
| 41 | + POSTGRES_PASSWORD: ${DB_PASSWORD:-password} |
| 42 | + POSTGRES_DB: ${CACHE_WARMING_DB_NAME:-cache_warming_db} |
| 43 | + volumes: |
| 44 | + - cache_warming_postgres_data:/var/lib/postgresql/data |
| 45 | + healthcheck: |
| 46 | + test: ['CMD-SHELL', 'pg_isready -U ${DB_USER:-postgres}'] |
| 47 | + interval: 5s |
| 48 | + timeout: 5s |
| 49 | + retries: 5 |
| 50 | + networks: |
| 51 | + - cache-warming-network |
| 52 | + |
| 53 | + redis: |
| 54 | + image: redis:7-alpine |
| 55 | + container_name: cache_warming_redis |
| 56 | + ports: |
| 57 | + - '${CACHE_WARMING_REDIS_PORT:-6381}:6379' |
| 58 | + command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD:-redis123} |
| 59 | + volumes: |
| 60 | + - cache_warming_redis_data:/data |
| 61 | + healthcheck: |
| 62 | + test: ['CMD', 'redis-cli', '-a', '${REDIS_PASSWORD:-redis123}', '--raw', 'incr', 'ping'] |
| 63 | + interval: 10s |
| 64 | + timeout: 3s |
| 65 | + retries: 5 |
| 66 | + networks: |
| 67 | + - cache-warming-network |
| 68 | + |
| 69 | +volumes: |
| 70 | + cache_warming_postgres_data: |
| 71 | + cache_warming_redis_data: |
| 72 | + |
| 73 | +networks: |
| 74 | + cache-warming-network: |
| 75 | + driver: bridge |
0 commit comments