services:
  postgres:
    image: postgres:10.23-alpine3.16
    restart: always
    environment:
      POSTGRES_DB: ejabberd
      POSTGRES_USER: ejabberd
      POSTGRES_PASSWORD: ejabberd
    volumes:
      - "/opt/ejabberd/postgres:/var/lib/postgresql/data"
    ports:
      - "5432:5432"
    networks:
      - ejabberd

  ejabberd:
    image: "registry.on-premise.itarian.com/op-ejabberd:19.8-1.0.0"
    hostname: ejabberd-server
    volumes:
      - /opt/ejabberd/logs:/opt/ejabberd/logs
      - /opt/ejabberd/certs:/opt/ejabberd/ssl
    environment:
      XMPP_DOMAIN:
      EJABBERD_DB_TYPE: pgsql
      EJABBERD_DB_SERVER: postgres
      EJABBERD_DB_DATABASE: ejabberd
      EJABBERD_DB_USERNAME: ejabberd
      EJABBERD_DB_PASSWORD: ejabberd
      EJABBERD_USERS: "admin@${XMPP_DOMAIN}:admin-pass"
      EJABBERD_MIGRATE_DB: 1
      API_KEY: api-key
      ERLANG_NODE: ejabberd@ejabberd-server
      JOIN_POINT:
      SERVICE_8080_NAME: ejabberd
      EJABBERD_LOGLEVEL: 4
    extra_hosts:
      - "${ITSM_WEB_HOST}:${ITSM_WEB_IP}"
    ports:
      - "443:5222"
      - "5222:5222"
      - "5269:5269"
      - "8080:8080"
      - "5443:5443"
      - "4369:4369"
      - "4370:4370"
      - "4371:4371"
      - "4372:4372"
      - "4373:4373"
      - "4374:4374"
      - "4375:4375"
      - "4376:4376"
      - "4377:4377"
      - "4378:4378"
    networks:
      - ejabberd
    restart: always

networks:
  ejabberd:
