services:
  # --- n8n Workflow Automation ---
  n8n:
    image: docker.n8n.io/n8nio/n8n:latest
    container_name: canifa_n8n
    ports:
      - "5678:5678"
    environment:
      - N8N_HOST=0.0.0.0
      - N8N_PORT=5678
      - N8N_PROTOCOL=http
      - WEBHOOK_URL=http://localhost:5678/
      - GENERIC_TIMEZONE=Asia/Ho_Chi_Minh
      - TZ=Asia/Ho_Chi_Minh
      # Basic auth - đổi password trước khi dùng production nhé bro
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=admin
      - N8N_BASIC_AUTH_PASSWORD=canifa2026
    volumes:
      - n8n_data:/home/node/.n8n
    restart: unless-stopped
    networks:
      - backend_network

networks:
  backend_network:
    driver: bridge
    ipam:
      driver: default
      config:
        - subnet: "172.24.0.0/16"
          gateway: "172.24.0.1"

volumes:
  n8n_data:
    driver: local
