services:
  surreal:
    image: surrealdb/surrealdb:latest-dev
    ports:
    - 8000:8000
    volumes:
      - surrealdb_storage:/mydata
    command:
      - start
      - --log
      - debug
      - --user
      - root
      - --pass
      - root
      - rocksdb:/mydata/database.db
  minio:
    image: quay.io/minio/minio
    ports:
      - 9000:9000
      - 9001:9001
    environment:
      - MINIO_ROOT_USER=root
      - MINIO_ROOT_PASSWORD=an8charpassword
      - MINIO_PROMETHEUS_AUTH_TYPE=public
    volumes:
      - minio_storage:/data
    command:
      - server
      - /data
      - --console-address
      - ":9001"

  alloy:
    image: grafana/alloy:latest
    ports:
      - 12345:12345
    volumes:
      # if you change this, you also need to change it in the alloy config file
      - ./logs/:/tmp/alloy-logs
      - ./alloy.conf:/etc/alloy/config.alloy
      - alloy_storage:/var/lib/alloy
    command:  run --server.http.listen-addr=0.0.0.0:12345 --storage.path=/var/lib/alloy/data /etc/alloy/config.alloy

  #logs
  loki:
    image: grafana/loki:latest
    ports:
      - 3100:3100
    command: -config.file=/etc/loki/local-config.yaml
    volumes:
      - ./loki.yaml:/etc/loki/local-config.yaml

  # Metrics collector
  prometheus:
    image: prom/prometheus:latest
    expose:
      - 9090
    volumes:
      - ./prometheus.yaml:/etc/prometheus/prometheus.yml
      # persist data
      - prometheus_storage:/prometheus
    command: --web.enable-lifecycle --config.file=/etc/prometheus/prometheus.yml

  # Everything viewer
  grafana:
    image: grafana/grafana:latest
    volumes:
      - ./grafana.yaml:/etc/grafana/provisioning/datasources/datasources.yaml
      - ./dashboards:/var/lib/grafana/dashboards
      - grafana_storage:/var/lib/grafana
    environment:
      - GF_AUTH_ANONYMOUS_ENABLED=true
      - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
      - GF_AUTH_DISABLE_LOGIN_FORM=true
      - GF_FEATURE_TOGGLES_ENABLE=traceqlEditor
    ports:
      - 3000:3000
  
volumes:
  prometheus_storage:
  grafana_storage:
  alloy_storage:
  surrealdb_storage:
  minio_storage:
