version: '2.4'
services:
  mysql:
    image: "mysql/mysql-server:5.7.12"
    restart: always
    networks:
      - mm-test
    environment:
      MYSQL_ROOT_HOST: "%"
      MYSQL_ROOT_PASSWORD: mostest
      MYSQL_PASSWORD: mostest
      MYSQL_USER: mmuser
      MYSQL_DATABASE: mattermost_test
    healthcheck:
      test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
      interval: 5s
      timeout: 10s
      retries: 3
    volumes:
      - ./docker/mysql.conf.d/source.cnf:/etc/mysql/conf.d/mysql.cnf
  mysql-read-replica:
    image: "mysql/mysql-server:5.7.12"
    restart: always
    networks:
      - mm-test
    ports:
      - 3307:3306
    environment:
      MYSQL_ROOT_HOST: "%"
      MYSQL_ROOT_PASSWORD: mostest
      MYSQL_PASSWORD: mostest
      MYSQL_USER: mmuser
      MYSQL_DATABASE: mattermost_test
    healthcheck:
      test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
      interval: 5s
      timeout: 10s
      retries: 3
    volumes:
      - ./docker/mysql.conf.d/replica.cnf:/etc/mysql/conf.d/mysql.cnf
  postgres:
    image: "postgres:10"
    restart: always
    networks:
      - mm-test
    environment:
      POSTGRES_USER: mmuser
      POSTGRES_PASSWORD: mostest
      POSTGRES_DB: mattermost_test
    command: postgres -c 'config_file=/etc/postgresql/postgresql.conf'
    volumes:
     - "./docker/postgres.conf:/etc/postgresql/postgresql.conf"
    healthcheck:
      test: [ "CMD", "pg_isready", "-h", "localhost" ]
      interval: 5s
      timeout: 10s
      retries: 3
  minio:
    image: "minio/minio:RELEASE.2019-10-11T00-38-09Z"
    command: "server /data"
    networks:
      - mm-test
    environment:
      MINIO_ACCESS_KEY: minioaccesskey
      MINIO_SECRET_KEY: miniosecretkey
      MINIO_SSE_MASTER_KEY: "my-minio-key:6368616e676520746869732070617373776f726420746f206120736563726574"
  inbucket:
    image: "inbucket/inbucket:stable"
    restart: always
    environment:
      INBUCKET_WEB_ADDR: "0.0.0.0:9001"
      INBUCKET_POP3_ADDR: "0.0.0.0:10110"
      INBUCKET_SMTP_ADDR: "0.0.0.0:10025"
    networks:
      - mm-test
  openldap:
    image: "osixia/openldap:1.4.0"
    restart: always
    networks:
      - mm-test
    environment:
      LDAP_TLS_VERIFY_CLIENT: "never"
      LDAP_ORGANISATION: "Mattermost Test"
      LDAP_DOMAIN: "mm.test.com"
      LDAP_ADMIN_PASSWORD: "mostest"
  elasticsearch:
    image: "mattermost/mattermost-elasticsearch-docker:7.17.3"
    networks:
      - mm-test
    environment:
      http.host: "0.0.0.0"
      http.port: 9200
      http.cors.enabled: "true"
      http.cors.allow-origin: "http://localhost:1358,http://127.0.0.1:1358"
      http.cors.allow-headers: "X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization"
      http.cors.allow-credentials: "true"
      transport.host: "127.0.0.1"
      ES_JAVA_OPTS: "-Xms512m -Xmx512m"
  dejavu:
    image: "appbaseio/dejavu:3.4.2"
    networks:
      - mm-test
  keycloak:
    image: "jboss/keycloak:10.0.2"
    restart: always
    environment:
      KEYCLOAK_USER: mmuser
      KEYCLOAK_PASSWORD: mostest
      DB_VENDOR: h2
      KEYCLOAK_IMPORT: /setup/realm.json
    networks:
      - mm-test
    volumes:
     - "./docker/keycloak:/setup"
  prometheus:
    image: "prom/prometheus"
    volumes:
      - "./docker/prometheus${IS_LINUX}.yml:/etc/prometheus/prometheus.yml"
    networks:
      - mm-test
  grafana:
    image: "grafana/grafana"
    volumes:
     - "./docker/grafana/grafana.ini:/etc/grafana/grafana.ini"
     - "./docker/grafana/provisioning:/etc/grafana/provisioning"
     - "./docker/grafana/dashboards:/var/lib/grafana/dashboards"
    networks:
      - mm-test
