version: "3.9"

networks
  hxki-internal:
    external: true

services

  # -------------------------------------------
  # POSTGRES (für n8n)
  # -------------------------------------------
  postgres:
    image: postgres:16
    container_name: hxki-postgres
    restart: unless-stopped
    networks:
      - hxki-internal
    environment:
      POSTGRES_USER: hxki
      POSTGRES_PASSWORD: supersecure
      POSTGRES_DB: hxki_roles
    volumes:
      - /opt/hx-ki/postgres:/var/lib/postgresql/data

      - "5432:5432"

  # -------------------------------------------
  # N8N – DAS MASTER-NERVENSYSTEM
  # -------------------------------------------
  n8n:
    image: docker.n8n.io/n8nio/n8n:latest
    container_name: hxki-n8n
    restart: unless-stopped
    depends_on:
      - postgres
    networks:
      - hxki-internal
    environment:
      N8N_HOST: n8n.hx-ki.com
      N8N_PORT: 5678
      WEBHOOK_URL: https://n8n.hx-ki.com/
      N8N_PROTOCOL: https
      DB_TYPE: postgresdb
      DB_POSTGRESDB_HOST: postgres
      DB_POSTGRESDB_PORT: 5432
      DB_POSTGRESDB_USER: hxki
      DB_POSTGRESDB_PASSWORD: supersecure
      DB_POSTGRESDB_DATABASE: hxki_roles
      NATS_URL: nats://49.12.97.28:4222
    volumes:
      - /data/HXKI_WORKSPACE/router:/home/node/.n8n
      - /data/HXKI_WORKSPACE:/data/HXKI_WORKSPACE
volumes:
  caddy_data:
  caddy_config:
