version: '3.9'

services:
  deepflow-server:
    container_name: deepflow-server
    image: ${DEEPFLOW_SERVER_IMAGE}
    restart: unless-stopped
    extra_hosts:
      - 'host.docker.internal:host-gateway'
    environment:
      DEEPFLOW_CLICKHOUSE_ADDR: ${DEEPFLOW_CLICKHOUSE_ADDR}
      DEEPFLOW_S3_ENDPOINT: ${DEEPFLOW_S3_ENDPOINT}
      DEEPFLOW_S3_BUCKET: ${DEEPFLOW_S3_BUCKET}
      DEEPFLOW_S3_ACCESS_KEY: ${DEEPFLOW_S3_ACCESS_KEY}
      DEEPFLOW_S3_SECRET_KEY: ${DEEPFLOW_S3_SECRET_KEY}
      DEEPFLOW_S3_REGION: ${DEEPFLOW_S3_REGION}
      DEEPFLOW_MYSQL_ADDR: ${DEEPFLOW_MYSQL_ADDR}
      DEEPFLOW_MYSQL_USER: ${DEEPFLOW_MYSQL_USER}
      DEEPFLOW_MYSQL_PASSWORD: ${DEEPFLOW_MYSQL_PASSWORD}
      DEEPFLOW_MYSQL_DATABASE: ${DEEPFLOW_MYSQL_DATABASE}
    ports:
      - '${DEEPFLOW_SERVER_GRPC_PORT}:20035'
      - '${DEEPFLOW_SERVER_HTTP_PORT}:20417'
    volumes:
      - ${DEEPFLOW_DATA}/server:/var/lib/deepflow

  deepflow-app:
    container_name: deepflow-app
    image: ${DEEPFLOW_APP_IMAGE}
    restart: unless-stopped
    depends_on:
      - deepflow-server
    environment:
      DEEPFLOW_SERVER_ADDR: http://deepflow-server:20417
    ports:
      - '${DEEPFLOW_APP_PORT}:80'
