# Runs all required Temporal service dependencies.
# Use to run service locally or run integration tests.
# Include platform specific file also:
# docker-compose -f docker-compose.yml -f docker-compose.linux.yml up
version: "3.5"

services:
  mysql:
    image: mysql:5.7
    container_name: temporal-dev-mysql
    ports:
      - "3306:3306"
    environment:
      MYSQL_ROOT_PASSWORD: root
    volumes:
      - ./mysql-init:/docker-entrypoint-initdb.d
    networks:
      - temporal-dev-network
  cassandra:
    image: cassandra:3.11
    container_name: temporal-dev-cassandra
    ports:
      - "9042:9042"
    environment:
      CASSANDRA_LISTEN_ADDRESS: 127.0.0.1
    networks:
      - temporal-dev-network
  postgresql:
    image: postgres:9.6
    container_name: temporal-dev-postgresql
    ports:
      - "5432:5432"
    environment:
      POSTGRES_USER: temporal
      POSTGRES_PASSWORD: temporal
    networks:
      - temporal-dev-network
  elasticsearch:
    image: elasticsearch:7.10.1
    container_name: temporal-dev-elasticsearch
    ports:
      - "9200:9200"
    environment:
      # Make ES available both on _local_ and _site_,
      # and use use _local_ for the publish_host.
      #
      # See here for details on network configuration:
      # https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html
      - network.host=_local_,_site_
      - network.publish_host=_local_
      # Set storage limit to low number.
      - cluster.routing.allocation.disk.threshold_enabled=true
      - cluster.routing.allocation.disk.watermark.low=512mb
      - cluster.routing.allocation.disk.watermark.high=256mb
      - cluster.routing.allocation.disk.watermark.flood_stage=128mb
      - discovery.type=single-node
      - ES_JAVA_OPTS=-Xms100m -Xmx100m
    networks:
      - temporal-dev-network
  prometheus:
    # Use http://localhost:9090/ to access Prometheus.
    image: prom/prometheus
    container_name: temporal-dev-prometheus
    command:
      - "--log.level=error"
      - "--config.file=/etc/prometheus/prometheus.yml"
      - "--storage.tsdb.path=/prometheus"
      - "--web.console.libraries=/usr/share/prometheus/console_libraries"
      - "--web.console.templates=/usr/share/prometheus/consoles"
  grafana:
    # Use http://localhost:3000/ to access Grafana (admin/admin).
    image: grafana/grafana
    container_name: temporal-dev-grafana
    depends_on:
      - prometheus
    volumes:
      - ./grafana/provisioning/:/etc/grafana/provisioning/
  temporal-web:
    image: temporalio/web:1.9.2
    container_name: temporal-dev-web

networks:
  temporal-dev-network:
    driver: bridge
    name: temporal-dev-network

