# Version 2 is the latest that is supported by docker-compose in
# Ubuntu Xenial.
version: '2'

services:
  gerritbot-matrix:
    image: {{ gerritbot_matrix_image }}
    network_mode: host
    restart: always
    logging:
      driver: syslog
      options:
        tag: "docker-matrix-gerritbot"
    environment:
      MATRIX_TOKEN: {{ gerritbot_matrix_access_token }}
      MATRIX_IDENTITY_TOKEN: {{ gerritbot_matrix_identity_token }}
    volumes:
      - /var/lib/matrix-gerritbot/config:/config
      - /var/lib/matrix-gerritbot/ssh:/root/.ssh
    healthcheck:
      test: "gerritbot-matrix check {{ gerritbot_matrix_prometheus_port }}"
      retries: 6
      timeout: "5s"
    command: >-
      --gerrit-host     {{ gerritbot_gerrit_host }}
      --gerrit-user     {{ gerritbot_gerrit_user }}
      --homeserver-url  {{ gerritbot_matrix_homeserver }}
      --identity-url    {{ gerritbot_matrix_identityserver }}
      --config-file     /config/gerritbot.dhall
      --monitoring-port {{ gerritbot_matrix_prometheus_port }}