services:
  traefik:
    container_name: "${COMPOSE_PROJECT_NAME:-api}-traefik"

  redis:
    container_name: "${COMPOSE_PROJECT_NAME:-api}-redis"

  mysql-debug:
    container_name: "${COMPOSE_PROJECT_NAME:-api}-mysql-debug"
    ports: !reset []

  edge-broker:
    container_name: "${COMPOSE_PROJECT_NAME:-api}-edge-broker"
    ports:
      - "127.0.0.1:${EDGE_BROKER_CI_PORT:-14300}:4300"
    labels:
      - "traefik.http.routers.edge-broker-local-ci.rule=PathPrefix(`/api/edge-broker`)"
      - "traefik.http.routers.edge-broker-local-ci.entrypoints=web"
      - "traefik.http.routers.edge-broker-local-ci.middlewares=secure-headers@file,edge-broker-strip-local"
      - "traefik.http.routers.edge-broker-local-ci.priority=190"
      - "traefik.http.routers.edge-broker-local-ci.service=edge-broker"

  caddy:
    container_name: "${COMPOSE_PROJECT_NAME:-api}-caddy"
    depends_on: !reset []
    labels:
      - "traefik.http.routers.local-api-ci.rule=PathPrefix(`/api`)"
      - "traefik.http.routers.local-api-ci.entrypoints=web"
      - "traefik.http.routers.local-api-ci.middlewares=strip-api-prefix@file,secure-headers@file"
      - "traefik.http.routers.local-api-ci.priority=90"
      - "traefik.http.routers.local-api-ci.service=caddy"
    volumes:
      - ci_php_app:/var/www/html

  php1:
    container_name: "${COMPOSE_PROJECT_NAME:-api}-php1"
    depends_on: !reset []
    environment:
      AUTO_COMPOSER_INSTALL: "false"
      USE_ENV: "true"
      CONFIG_DB_TARGET: "debug"
      CONFIG_DB_HOST: "mysql-debug"
      CONFIG_DB_USER: "root"
      CONFIG_DB_PASSWORD: "debug_root_password"
      CONFIG_DB_DATABASE: "nnks_db_debug"
      CONFIG_DB_PORT: "3306"
      CONFIG_DB_DEBUG_HOST: "mysql-debug"
      CONFIG_DB_DEBUG_USER: "root"
      CONFIG_DB_DEBUG_PASSWORD: "debug_root_password"
      CONFIG_DB_DEBUG_DATABASE: "nnks_db_debug"
      CONFIG_DB_DEBUG_PORT: "3306"
      REDIS_CONFIG_HOST: "redis"
      REDIS_CONFIG_PORT: "6379"
      REDIS_CONFIG_DATABASE: "0"
      REDIS_CONFIG_DEBUG_HOST: "redis"
      REDIS_CONFIG_DEBUG_PORT: "6379"
      REDIS_CONFIG_DEBUG_DATABASE: "0"
      TRUCKWASH_TEST_BLOCK_REAL_SHELLY: "1"
      EDGE_GATEWAY_VIEW_CACHE_TTL: "0"
    volumes:
      - ci_php_app:/var/www/html

  php2:
    container_name: "${COMPOSE_PROJECT_NAME:-api}-php2"
    volumes:
      - ci_php_app:/var/www/html

  php3:
    container_name: "${COMPOSE_PROJECT_NAME:-api}-php3"
    volumes:
      - ci_php_app:/var/www/html

  php4:
    container_name: "${COMPOSE_PROJECT_NAME:-api}-php4"
    volumes:
      - ci_php_app:/var/www/html

  php5:
    container_name: "${COMPOSE_PROJECT_NAME:-api}-php5"
    volumes:
      - ci_php_app:/var/www/html

volumes:
  ci_php_app:

networks:
  default:
    ipam:
      config:
        - subnet: "${CI_DOCKER_SUBNET:-10.240.0.0/24}"
