services:

  postgres:
    image: postgres:16
    container_name: hxki-postgres
    restart: unless-stopped
    environment:
      POSTGRES_USER: hxki
      POSTGRES_PASSWORD: supersecure
      POSTGRES_DB: hxki_roles
    volumes:
      - /opt/hx-ki/postgres:/var/lib/postgresql/data
    networks:
      - hxki-internal

  mariadb:
    image: mariadb:10.11
    container_name: hxki-mariadb
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: supersecure
    volumes:
      - /opt/hx-ki/mariadb:/var/lib/mysql
    networks:
      - hxki-internal

  n8n:
    image: docker.n8n.io/n8nio/n8n:latest
    container_name: hxki-n8n
    restart: unless-stopped
    depends_on:
      - postgres
    environment:
      N8N_HOST: n8n.hx-ki.com
      DB_TYPE: postgresdb
      DB_POSTGRESDB_HOST: hxki-postgres
      DB_POSTGRESDB_PORT: 5432
      DB_POSTGRESDB_DATABASE: hxki_roles
      DB_POSTGRESDB_USER: hxki
      DB_POSTGRESDB_PASSWORD: supersecure

      N8N_PORT: 5678
    networks:
      - hxki-internal

  grafana:
    image: grafana/grafana-oss:latest
    container_name: hxki-grafana
    restart: unless-stopped
    networks:
      - hxki-internal

  gitea:
    image: gitea/gitea:latest
    container_name: hxki-gitea
    restart: unless-stopped
    networks:
      - hxki-internal

  mautic:
    image: mautic/mautic:5-apache
    container_name: hxki-mautic
    restart: unless-stopped
    networks:
      - hxki-internal

  caddy:
    image: caddy:2
    container_name: hxki-caddy
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /etc/caddy:/etc/caddy
      - /opt/hx-ki/caddy_data:/data
      - /opt/hx-ki/caddy_config:/config
    networks:
      - hxki-internal

networks:
  hxki-internal:
    external: true
