services:
  kami-db-migrate:
    image: git.domainpay.top/danial/kami-db-migrate:latest
    container_name: kami-migrate
    profiles:
      - all
      - migrate
    command:
      - "migrate"
      - "apply"
      - "--url"
      - "mysql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}"
      - "--dir"
      - "file://migrations"
      - "--baseline"
      - "20251213191759"
    restart: "no"
    networks:
      - 1panel-network
    labels:
      createdBy: Developer
  kami_merchant:
    image: git.domainpay.top/danial/kami_merchant_$BRANCH:$VERSION
    container_name: kami-merchant-$BRANCH-$VERSION
    restart: always
    environment:
      serverName: $OTEL_SERVICE_NAME
      gatewayAddr: $gatewayAddr
      shopAddr: $shopAddr
      portalAddr: $portalAddr
    profiles:
      - merchant
      - all
    ports:
      - "127.0.0.1:22307:12307"
    volumes:
      - /data/kami/merchant/conf/:/app/conf/
      - /data/kami/merchant/logs/:/app/logs/
    networks:
      - 1panel-network
    labels:
      createdBy: Developer
  kami_backend:
    image: git.domainpay.top/danial/kami_backend_$BRANCH:$VERSION
    container_name: kami-backend-$BRANCH-$VERSION
    restart: always
    environment:
      OTEL_EXPORTER_ENDPOINT: $OTEL_EXPORTER_ENDPOINT
      OTEL_SERVICE_NAME: $OTEL_SERVICE_NAME
      gatewayAddr: $gatewayAddr
      shopAddr: $shopAddr
      portalAddr: $portalAddr
    extra_hosts:
      - "host.docker.internal:host-gateway"
    profiles:
      - kami_backend
      - all
    ports:
      - "127.0.0.1:22401:12401"
    volumes:
      - /data/kami/kami_backend/log/:/app/resource/log/
      - /data/kami/kami_backend/manifest/config/:/app/manifest/config/
    networks:
      - 1panel-network
    labels:
      createdBy: Developer
  kami_shop:
    image: git.domainpay.top/danial/kami_shop_$BRANCH:$VERSION
    container_name: kami-shop-$BRANCH-$VERSION
    restart: always
    environment:
      serverName: $OTEL_SERVICE_NAME
      gatewayAddr: $gatewayAddr
      shopAddr: $shopAddr
      portalAddr: $portalAddr
    profiles:
      - shop
      - all
    ports:
      - "127.0.0.1:22305:12305"
    volumes:
      - /data/kami/shop/conf/:/app/conf/
      - /data/kami/shop/logs/:/app/logs/
    networks:
      - 1panel-network
    labels:
      createdBy: Developer
  kami_gateway:
    image: git.domainpay.top/danial/kami_gateway_$BRANCH:$VERSION
    container_name: kami-gateway-$BRANCH-$VERSION
    restart: always
    environment:
      OTEL_EXPORTER_ENDPOINT: $OTEL_EXPORTER_ENDPOINT
      OTEL_SERVICE_NAME: $OTEL_SERVICE_NAME
      gatewayAddr: $gatewayAddr
      shopAddr: $shopAddr
      portalAddr: $portalAddr
    extra_hosts:
      - "host.docker.internal:host-gateway"
    profiles:
      - gateway
      - all
    ports:
      - "127.0.0.1:22309:12309"
    volumes:
      - /data/kami/gateway/conf/:/app/conf/
      - /data/kami/gateway/logs/:/app/logs/
    networks:
      - 1panel-network
    labels:
      createdBy: Developer
  kami_boss:
    image: git.domainpay.top/danial/kami_boss_$BRANCH:$VERSION
    container_name: kami-boss-$BRANCH-$VERSION
    restart: always
    environment:
      serverName: $OTEL_SERVICE_NAME
      gatewayAddr: $gatewayAddr
      shopAddr: $shopAddr
      portalAddr: $portalAddr
    ports:
      - "127.0.0.1:22306:12306"
    profiles:
      - boss
      - all
    volumes:
      - /data/kami/kami_boss/conf/:/app/conf/
      - /data/kami/kami_boss/logs/:/app/logs/
    networks:
      - 1panel-network
    labels:
      createdBy: Developer
  kami_frontend:
    image: git.domainpay.top/danial/kami_frontend_$BRANCH:$VERSION
    container_name: kami-frontend-$BRANCH-$VERSION
    restart: always
    environment:
      serverName: $OTEL_SERVICE_NAME
      gatewayAddr: $gatewayAddr
      shopAddr: $shopAddr
      portalAddr: $portalAddr
    ports:
      - "127.0.0.1:22400:12400"
    networks:
      - 1panel-network
    labels:
      createdBy: Developer
    profiles:
      - frontend
      - all
  kami-spider-monorepo:
    image: git.domainpay.top/danial/kami-spider-monorepo-$BRANCH:$VERSION
    container_name: kami-spider-monorepo-$BRANCH-$VERSION
    restart: always
    profiles:
      - spider
      - all
    environment:
      DB_HOST: ${DB_SPIDER_HOST}
      DB_PORT: ${DB_SPIDER_PORT}
      DB_NAME: ${DB_SPIDER_NAME}
      DB_USER: ${DB_SPIDER_USER}
      DB_PASSWORD: ${DB_SPIDER_PASSWORD}
      DB_POOL_SIZE: 20
      DB_MAX_OVERFLOW: 50
      OTEL_SERVICE_NAME: ${OTEL_SERVICE_NAME}
      # Redis
      REDIS_HOST: ${REDIS_HOST}
      REDIS_PORT: ${REDIS_PORT}
      REDIS_DB: 4
      REDIS_PASSWORD: ${REDIS_PASSWORD}
      OTEL_EXPORTER_ENDPOINT: ${OTEL_EXPORTER_ENDPOINT}
    extra_hosts:
      - "host.docker.internal:host-gateway"
    networks:
      - 1panel-network
    labels:
      createdBy: Developer
  jd-token-server:
    image: git.domainpay.top/danial/jd-token-server-$BRANCH:$VERSION
    container_name: jd-token-server-$BRANCH-$VERSION
    restart: always
    profiles:
      - spider
      - all
    networks:
      - 1panel-network
    labels:
      createdBy: Developer

networks:
  1panel-network:
    external: true
