version: '3.8'

services:
  redis:
    image: redis:latest
    ports:
      - "6379:6379"
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 5s
      timeout: 3s
      retries: 5

  gateway:
    build: 
      context: ./axhub-gateway
    ports:
      - "8281:8081"
    volumes:
      - ./:/src
    depends_on:
      redis:
        condition: service_healthy
    environment:
      - TZ=Asia/Seoul
      - SPRING_REDIS_HOST=redis
      - SPRING_REDIS_PORT=6379
      - SPRING_DATA_REDIS_HOST=redis
      - SPRING_DATA_REDIS_PORT=6379
      - AXHUB_SOURCE_DIR=/src

  tool-sms:
    build: 
      context: ./axhub-tool-sms
    ports:
      - "8282:8082"
    depends_on:
      - redis
    environment:
      - TZ=Asia/Seoul
      - SPRING_REDIS_HOST=redis
      - SPRING_REDIS_PORT=6379
      - SPRING_DATA_REDIS_PORT=6379
      - AXHUB_GATEWAY_URL=http://gateway:8081
      - AXHUB_TOOL_URL=http://tool-sms:8082
      - GLOW_COMMUNICATION_MCI_HOST=http://gateway
      - GLOW_COMMUNICATION_MCI_PORT=8081
      - GLOW_COMMUNICATION_EXTMCI_HOST=http://gateway
      - GLOW_COMMUNICATION_EXTMCI_PORT=8081
      - GLOW_COMMUNICATION_EAI_HOST=tcp://gateway
      - GLOW_COMMUNICATION_EAI_PORT=8081
  tool-email:
    build: 
      context: ./axhub-tool-email
    ports:
      - "8283:8083"
    depends_on:
      - redis
    environment:
      - TZ=Asia/Seoul
      - SPRING_REDIS_HOST=redis
      - SPRING_REDIS_PORT=6379
      - SPRING_DATA_REDIS_PORT=6379
      - AXHUB_GATEWAY_URL=http://gateway:8081
      - AXHUB_TOOL_URL=http://tool-email:8083
      - GLOW_COMMUNICATION_MCI_HOST=http://gateway
      - GLOW_COMMUNICATION_MCI_PORT=8081
      - GLOW_COMMUNICATION_EXTMCI_HOST=http://gateway
      - GLOW_COMMUNICATION_EXTMCI_PORT=8081
      - GLOW_COMMUNICATION_EAI_HOST=tcp://gateway
      - GLOW_COMMUNICATION_EAI_PORT=8081
  tool-other:
    build: 
      context: ./axhub-tool-other
    ports:
      - "8284:8084"
    depends_on:
      - redis
    environment:
      - TZ=Asia/Seoul
      - SPRING_REDIS_HOST=redis
      - SPRING_REDIS_PORT=6379
      - SPRING_DATA_REDIS_PORT=6379
      - AXHUB_GATEWAY_URL=http://gateway:8081
      - AXHUB_TOOL_URL=http://tool-other:8084
      - GLOW_COMMUNICATION_MCI_HOST=http://gateway
      - GLOW_COMMUNICATION_MCI_PORT=8081
      - GLOW_COMMUNICATION_EXTMCI_HOST=http://gateway
      - GLOW_COMMUNICATION_EXTMCI_PORT=8081
      - GLOW_COMMUNICATION_EAI_HOST=tcp://gateway
      - GLOW_COMMUNICATION_EAI_PORT=8081
  tool-payment:
    build:
      context: ./axhub-tool-payment
    ports:
      - "8285:8085"
    depends_on:
      - redis
    environment:
      - TZ=Asia/Seoul
      - SPRING_REDIS_HOST=redis
      - SPRING_REDIS_PORT=6379
      - SPRING_DATA_REDIS_PORT=6379
      - AXHUB_GATEWAY_URL=http://gateway:8081
      - AXHUB_TOOL_URL=http://tool-payment:8085
      - GLOW_COMMUNICATION_MCI_HOST=http://gateway
      - GLOW_COMMUNICATION_MCI_PORT=8081
      - GLOW_COMMUNICATION_EXTMCI_HOST=http://gateway
      - GLOW_COMMUNICATION_EXTMCI_PORT=8081
      - GLOW_COMMUNICATION_EAI_HOST=tcp://gateway
      - GLOW_COMMUNICATION_EAI_PORT=8081
