version: '3.8' services: db: image: postgres:15 container_name: customs_db environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: customs_data ports: - "5434:5432" volumes: - customs_pgdata:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres -d customs_data"] interval: 5s timeout: 5s retries: 5 restart: always clickhouse: image: clickhouse/clickhouse-server:23.8 container_name: customs_clickhouse ports: - "8123:8123" environment: CLICKHOUSE_DB: customs_data CLICKHOUSE_USER: default CLICKHOUSE_PASSWORD: password volumes: - customs_chdata:/var/lib/clickhouse healthcheck: test: ["CMD", "wget", "--spider", "-q", "-O", "-", "http://localhost:8123/ping"] interval: 5s timeout: 5s retries: 30 restart: always elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch:8.10.2 container_name: customs_es environment: - discovery.type=single-node - xpack.security.enabled=false - "ES_JAVA_OPTS=-Xms512m -Xmx512m" ports: - "9200:9200" volumes: - customs_esdata:/usr/share/elasticsearch/data healthcheck: test: ["CMD-SHELL", "curl -s http://localhost:9200 >/dev/null || exit 1"] interval: 10s timeout: 5s retries: 30 restart: always redis: image: redis:7 container_name: customs_redis ports: - "6380:6379" healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 5s retries: 10 restart: always api: build: . ports: - "8000:8000" depends_on: db: condition: service_healthy clickhouse: condition: service_healthy elasticsearch: condition: service_healthy redis: condition: service_started volumes: - .:/app environment: - DATABASE_URL=postgresql+asyncpg://postgres:postgres@db:5432/customs_data - CLICKHOUSE_URL=http://default:password@clickhouse:8123 - ELASTICSEARCH_URL=http://elasticsearch:9200 - REDIS_URL=redis://redis:6380/0 worker: build: . depends_on: db: condition: service_healthy redis: condition: service_started volumes: - .:/app environment: - DATABASE_URL=postgresql+asyncpg://postgres:postgres@db:5432/customs_data - CLICKHOUSE_URL=http://default:password@clickhouse:8123 - ELASTICSEARCH_URL=http://elasticsearch:9200 - CELERY_BROKER_URL=redis://redis:6380/0 command: ["bash", "-c", "celery -A packages.core.celery_app worker --loglevel=info"] celerybeat: build: . depends_on: redis: condition: service_started db: condition: service_healthy volumes: - .:/app environment: - DATABASE_URL=postgresql+asyncpg://postgres:postgres@db:5432/customs_data - CLICKHOUSE_URL=http://default:password@clickhouse:8123 - ELASTICSEARCH_URL=http://elasticsearch:9200 - CELERY_BROKER_URL=redis://redis:6380/0 command: ["bash", "-c", "celery -A packages.core.celery_app beat --loglevel=info"] scheduler: build: . depends_on: db: condition: service_healthy volumes: - .:/app environment: - DATABASE_URL=postgresql+asyncpg://postgres:postgres@db:5432/customs_data - CLICKHOUSE_URL=http://default:password@clickhouse:8123 - ELASTICSEARCH_URL=http://elasticsearch:9200 command: ["bash", "-c", "python infrastructure/scheduler/main.py"] volumes: customs_pgdata: customs_chdata: customs_esdata: