---
  version: "3.7"
  services:
    gateway:
      logging:
        driver: none
      depends_on:
        - redis
        - tools_feedback
        - daemon
      ports:
      - "5004:80"
      build:
        context: ./fleetdash_gateway
      env_file:
        - ./test_environment/gateway.env
      environment:
        - VAULT_SP_KEY
        - VAULT_JWT_SECRET
        - FLEETDASH_GATEWAY__SLACK_CLIENT__WEBHOOK_URL
      restart: on-failure
      links:
        - redis
        - tools_feedback
        - daemon
    redis:
      logging:
        driver: none
      image: redis:latest
      command: ["redis-server", "--appendonly", "yes"]
      hostname: redis
      volumes:
        - redis-data:/data
      ports:
        - "6379:6379"
    postgres:
      logging:
        driver: none
      image: postgres
      restart: unless-stopped
      volumes:
        - postgres:/var/lib/postgresql/data
        - ./test_environment/init-postgres.sh:/docker-entrypoint-initdb.d/init-postgres.sh
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_PASSWORD=postgres
      ports:
        - 5432:5432
    allocation_db:
      logging:
        driver: none
      image: "postgres:9.3.24"
      environment:
        POSTGRES_PASSWORD: "secret"
        POSTGRES_USER: "allocation"
      networks:
        - allocation
    allocation_service:
      logging:
        driver: none
      depends_on:
        - allocation_db
      ports:
      - "5007:80"
      build:
        context: ./allocation
      environment:
        ALLOCATION__POSTGRES__PASSWORD: "secret"
        ALLOCATION__POSTGRES__USERNAME: "allocation"
        ALLOCATION__POSTGRES__DATABASE_NAME: "allocation"
        ALLOCATION__POSTGRES__HOST: "allocation_db"
      command: migrate-and-run
      restart: on-failure
      networks:
        - allocation
    daemon:
      logging:
        driver: none
      depends_on:
        - redis
      ports:
      - "5050:80"
      build:
        context: ./fleetdash_daemon
      env_file:
        - ./test_environment/daemon.env
      restart: on-failure
      links:
        - redis
    tools_feedback:
      logging:
        driver: none
      ports:
      - "5000:80"
      restart: on-failure
      build:
        context: ./feedback
    health_api:
      logging:
        driver: none
      depends_on:
        - postgres
      ports:
      - "8050:80"
      build:
        context: ./health_api
        args:
          - PACKAGE_NAME=health_api
      command: migrate-and-run
      env_file:
        - ./test_environment/health_api.env
      restart: on-failure
    predefined_missions:
      logging:
        driver: none
      ports:
      - "5008:80"
      restart: on-failure
      build:
        context: ./predefined_missions
  volumes:
    redis-data:
    postgres:

  networks:
    allocation:
