services:
  keep-frontend:
    extends:
      file: docker-compose.common.yml
      service: keep-frontend-common
    image: us-central1-docker.pkg.dev/keephq/keep/keep-ui
    environment:
      - LANGUAGE=zh-CN
      - AUTH_TYPE=DB
      - API_URL=http://keep-backend:8080
      - NEXTAUTH_URL=http://192.168.1.13:3000
      - NEXTAUTH_SECRET=sJwnvqvwmjqqku46Wuc*
      - OPENAI_API_KEY=sk-NA%sgrcuz10srtt
      - OPENAI_AI_API_KEY=sk-NA%sgrcuz10srtt
      - OPEN_AI_ORGANIZATION_ID=deepseek-r1
      - OPENAI_BASE_URL=http://192.168.1.13:4000/v1
      - OPENAI_MODEL_NAME=deepseek-r1
    volumes:
      - ./state:/state
      - /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime
    depends_on:
      - keep-backend
    networks:
      - keep
    restart:
      unless-stopped

  keep-backend:
    extends:
      file: docker-compose.common.yml
      service: keep-backend-common
    image: us-central1-docker.pkg.dev/keephq/keep/keep-api
    environment:
      - LANGUAGE=zh-CN
      - AUTH_TYPE=DB
      - NEXTAUTH_URL=http://192.168.1.13:3000
      - PROMETHEUS_MULTIPROC_DIR=/tmp/prometheus
      - KEEP_METRICS=true
      - KEEP_JWT_SECRET=s7ytazmOr>yhJv9iryqv
      - KEEP_DEFAULT_USERNAME=gzzm_keep
      - KEEP_DEFAULT_PASSWORD=NA%sgrcuz10srtt
      - KEEP_FORCE_RESET_DEFAULT_PASSWORD=false
      - OPENAI_API_KEY=sk-NA%sgrcuz10srtt
      - OPENAI_AI_API_KEY=sk-NA%sgrcuz10srtt
      - OPEN_AI_ORGANIZATION_ID=deepseek-r1
      - OPENAI_BASE_URL=http://192.168.1.13:4000/v1
      - OPENAI_MODEL_NAME=deepseek-r1
      - KEEP_EXTERNAL_AI_TRANSFORMERS_URL=http://192.168.1.13:4000
    volumes:
      - ./state:/state
      - /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime
    networks:
      - keep
    restart:
      unless-stopped

  keep-websocket-server:
    extends:
      file: docker-compose.common.yml
      service: keep-websocket-server-common
    restart:
      unless-stopped

  pgsql:
    image: postgres:15
    container_name: keep_pgsql
    environment:
      - PGDATA=/pgdata
      - POSTGRES_DB=keep
      - POSTGRES_USER=keep
      - POSTGRES_PASSWORD=~1etMK4ew
    volumes:
      - ./data/pgdata:/pgdata
      - /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime
    ports:
      - "5432:5432"
    networks:
      - keep
    restart:
      unless-stopped
  grafana:
    image: grafana/grafana:latest
    profiles:
      - grafana
    ports:
      - "3001:3000"
    volumes:
      - ./grafana:/var/lib/grafana
      - ./grafana/provisioning:/etc/grafana/provisioning
      - ./grafana/dashboards:/etc/grafana/dashboards
      - /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime
    environment:
      - GF_SECURITY_ADMIN_USER=admin
      - GF_SECURITY_ADMIN_PASSWORD=admin
      - GF_USERS_ALLOW_SIGN_UP=false
    depends_on:
      - prometheus
    networks:
      - keep

  prometheus:
    image: prom/prometheus:latest
    profiles:
      - grafana
    ports:
      - "9090:9090"
    volumes:
      - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
      - /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime
    command:
      - "--config.file=/etc/prometheus/prometheus.yml"
    depends_on:
      - keep-backend
    networks:
      - keep
networks:
  keep:
    name: keep
    driver: bridge
