version: '3'

services:
#  app:
#    build:
#      context: .
#      dockerfile: Dockerfile
#    ports:
#      - '8080:8080'
#    depends_on:
#      - redis
#      - postgres
#      - tempo

  postgres:
    image: postgres
    environment:
      POSTGRES_USER: 'login'
      POSTGRES_PASSWORD: 'pass'
      POSTGRES_DB: 'postgres'
    ports:
      - '5432:5432'

  redis:
    image: redis:alpine
    ports:
      - '6379:6379'

  redis-ui:
    image: rediscommander/redis-commander
    ports:
      - '8081:8081'
    environment:
      - REDIS_HOST=redis
      - REDIS_PORT=6379
    depends_on:
      - redis

  tempo:
    image: grafana/tempo:latest
    command: [ "-config.file=/etc/tempo.yaml" ]
    volumes:
      - ./observability/tempo.yaml:/etc/tempo.yaml
    ports:
      - '3200:3200'  # tempo
      - '4317:4317'  # otlp grpc

  prometheus:
    image: prom/prometheus:v2.53.4
    command:
      - --config.file=/etc/prometheus.yaml
      - --web.enable-remote-write-receiver
      - --enable-feature=exemplar-storage
    volumes:
      - ./observability/prometheus.yaml:/etc/prometheus.yaml
    ports:
      - '9090:9090'

  grafana:
    image: grafana/grafana:latest
    volumes:
      - ./observability/grafana/datasources.yaml:/etc/grafana/provisioning/datasources/datasources.yaml
      - ./observability/grafana/dashboard.yaml:/etc/grafana/provisioning/dashboards/dashboard.yaml
      - ./observability/grafana/default.json:/var/lib/grafana/dashboards/default.json
    environment:
      - GF_PATHS_PROVISIONING=/etc/grafana/provisioning
      - GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH=/var/lib/grafana/dashboards/default.json
      - GF_AUTH_ANONYMOUS_ENABLED=true
      - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
      - GF_AUTH_DISABLE_LOGIN_FORM=true
      - GF_FEATURE_TOGGLES_ENABLE=traceqlEditor traceQLStreaming metricsSummary
    ports:
      - '3001:3000'