version: '3.8'
services:
  redis:
    image: redis:7-alpine
    container_name: foodlinkk_redis
    ports:
      - "6379:6379"
    restart: unless-stopped


  tools-api:
    build: ./tools-api
    container_name: foodlinkk_tools_api
    environment:
      DB_HOST: foodlinkk_db
      DB_USER: aissa
      DB_PASSWORD: Foodlinkk#2026
      DB_NAME: foodlinkk
      BACKUP_ROOT: /data/backup-root
      GITEA_BACKUP_REMOTE: http://sysops:Foodlinkk%23SysOps2026@gitea:3001/aissa/foodlinkk-command-center.git
      GITEA_SYSOPS_USER: sysops
      GITEA_SYSOPS_EMAIL: sysops@foodlinkk.local
      GITEA_SYSOPS_NAME: sysops
      GITEA_BACKUP_BRANCH: main
      PROXMOX_HOST: 10.4.7.14
      VM106_IP: 10.4.7.18
      OLLAMA_URL: http://10.4.7.19:11434
      OLLAMA_MODEL: qwen3:8b
      CHROMA_HOST: 10.4.7.19
      CHROMA_PORT: "8000"
      DOC_INGEST_URL: http://10.4.7.19:8750
      BROWSER_USE_URL: http://browser-agent:7790
      BROWSER_AGENT_URL: http://browser-agent:7790
      COMFYUI_URL: http://10.4.7.18:8188
      SMTP_HOST: ${SMTP_HOST:-}
      SMTP_PORT: ${SMTP_PORT:-587}
      SMTP_USER: ${SMTP_USER:-}
      SMTP_PASS: ${SMTP_PASS:-}
      SMTP_FROM: ${SMTP_FROM:-}
    ports:
      - "8700:8700"
    volumes:
      - /home/aissa/foodlinkk-command-center:/data/backup-root:ro
    extra_hosts:
      - "foodlinkk_db:10.4.7.18"
    restart: unless-stopped

  cockpit:
    build: ./cockpit
    container_name: foodlinkk_cockpit
    environment:
      DB_HOST: foodlinkk_db
      DB_USER: aissa
      DB_PASSWORD: Foodlinkk#2026
      DB_NAME: foodlinkk
      VNC_CDP_URL: http://10.4.7.18:9223
      OLLAMA_URL: http://10.4.7.19:11434
      OLLAMA_MODEL: qwen3:8b
      TOOLS_API_URL: http://tools-api:8700
      CHROMA_HOST: 10.4.7.19
      CHROMA_PORT: "8000"
      DOC_INGEST_URL: http://10.4.7.19:8750
      BROWSER_AGENT_URL: http://browser-agent:7790
      COMFYUI_URL: http://10.4.7.18:8188
      HERMAN_ORCHESTRATOR_URL: http://10.4.7.19:8090
      NAS_CLIENTS_ROOT: /data/nas-clients
      NAS_SHARE_ROOT: /data/nas-share
    ports:
      - "8600:8600"
    volumes:
      - /home/aissa/nas-clients:/data/nas-clients
      - /mnt/synology:/data/nas-share:ro
    depends_on:
      - tools-api
    extra_hosts:
      - "foodlinkk_db:10.4.7.18"
    restart: unless-stopped

  browser-agent:
    build: ./browser-agent
    container_name: foodlinkk_browser_agent
    environment:
      DB_HOST: foodlinkk_db
      DB_USER: aissa
      DB_PASSWORD: Foodlinkk#2026
      DB_NAME: foodlinkk
      VNC_CDP_URL: http://10.4.7.18:9223
    ports:
      - "7790:7790"
    extra_hosts:
      - "foodlinkk_db:10.4.7.18"
    restart: unless-stopped
    shm_size: "1gb"

  gitea:
    image: gitea/gitea:1.21-rootless
    container_name: foodlinkk_gitea
    environment:
      GITEA__database__DB_TYPE: sqlite3
      GITEA__server__ROOT_URL: http://10.4.7.18:3001/
      GITEA__server__HTTP_PORT: 3001
      GITEA__security__INSTALL_LOCK: "true"
      GITEA__security__SECRET_KEY: foodlinkk-gitea-secret-2026
      GITEA__service__DISABLE_REGISTRATION: "true"
    ports:
      - "3001:3001"
    volumes:
      - gitea_data:/var/lib/gitea
    restart: unless-stopped

  email-agent:
    build: ./email-agent
    container_name: foodlinkk_email_agent
    environment:
      DB_HOST: foodlinkk_db
      DB_USER: aissa
      DB_PASSWORD: Foodlinkk#2026
      DB_NAME: foodlinkk
      TOOLS_API_URL: http://tools-api:8700
      SYNC_INTERVAL_SEC: 300
    ports:
      - "8801:8801"
    depends_on:
      - tools-api
    extra_hosts:
      - "foodlinkk_db:10.4.7.18"
    restart: unless-stopped

  prometheus:
    image: prom/prometheus:v2.53.0
    container_name: foodlinkk_prometheus
    volumes:
      - ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml:ro
    ports:
      - "9090:9090"
    restart: unless-stopped

  grafana:
    image: grafana/grafana:11.1.0
    container_name: foodlinkk_grafana
    environment:
      GF_SECURITY_ADMIN_USER: admin
      GF_SECURITY_ADMIN_PASSWORD: Foodlinkk#2026
      GF_SERVER_ROOT_URL: http://10.4.7.18:3002
    ports:
      - "3002:3000"
    depends_on:
      - prometheus
    restart: unless-stopped

volumes:
  gitea_data:
