version: "3.9"

services:
  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
    ports:
      - "5432:5432"

  n8n:
    image: docker.n8n.io/n8nio/n8n
    container_name: hxki-n8n
    restart: unless-stopped
    depends_on:
      - postgres
    networks:
      - hxki-internal
    environment:
      NATS_URL: "nats://49.12.97.28:4222"
      DB_TYPE: postgresdb
      DB_POSTGRESDB_HOST: postgres
      DB_POSTGRESDB_PORT: 5432
      DB_POSTGRESDB_USER: hxki
      DB_POSTGRESDB_PASSWORD: supersecure
      DB_POSTGRESDB_DATABASE: hxki_roles
      N8N_HOST: 0.0.0.0
      N8N_PORT: 5678
      N8N_PROTOCOL: http
    ports:
      - "5678:5678"

networks:
  hxki-internal:
    external: true
