Skip to content

Instantly share code, notes, and snippets.

@nosavvy33
Last active October 18, 2021 02:58
Show Gist options
  • Select an option

  • Save nosavvy33/56dc812c9d1202fa65d6acaa3e6ae39f to your computer and use it in GitHub Desktop.

Select an option

Save nosavvy33/56dc812c9d1202fa65d6acaa3e6ae39f to your computer and use it in GitHub Desktop.
Jaeger + ES + Kibana + HotROD
version: "3"
# JAEGER CHART IS BETAAAAA
services:
elasticsearch:
container_name: elasticsearch_database
image: docker.elastic.co/elasticsearch/elasticsearch:7.9.3
networks:
- elastic-jaeger
ports:
- "127.0.0.1:9200:9200" #HTTP request listening port (API calls)
- "127.0.0.1:9300:9300" #binary protocol for cluster nodes communication
restart: on-failure
environment: #environment variables accesible by the owning container
- cluster.name=jaeger-cluster
- discovery.type=single-node
- http.host=0.0.0.0
- transport.host=127.0.0.1
- ES_JAVA_OPTS=-Xms512m -Xmx512m
- xpack.security.enabled=false
volumes:
- esdata:/usr/share/elasticsearch/data
# kibana:
# image: docker.elastic.co/kibana/kibana:7.9.3
# ports:
# - "5601:5601"
# environment:
# - ELASTICSEARCH_HOSTS=http://elasticsearch:9200
# networks:
# - elastic-jaeger
# depends_on:
# - elasticsearch
jaeger-collector: # The collectors are stateless and thus many instances of jaeger-collector can be run in parallel
image: jaegertracing/jaeger-collector
ports:
- "14269:14269" # health port / /metrics
- "14268:14268" # can accept spans from clients
- "14267:14267"
- "14250:14250" # gRPC receives spans in model.proto format from jaeger-agent
- "9411:9411" # zipkin spans in thrift, json and proto formats
networks:
- elastic-jaeger
restart: on-failure
environment:
- SPAN_STORAGE_TYPE=elasticsearch
command: [
"--es.server-urls=http://elasticsearch:9200",
"--es.num-shards=1",
"--es.num-replicas=0",
"--log-level=error"
]
depends_on:
- elasticsearch
jaeger-agent: #Jaeger client libraries expect jaeger-agent process to run locally on each hos
image: jaegertracing/jaeger-agent
hostname: jaeger-agent
command: ["--reporter.grpc.host-port=jaeger-collector:14250"] #load balancing, this case jaeger agent 1 takes all for node discovery
ports:
- "5775:5775/udp" # zipkin.thrift
- "6831:6831/udp" #jaeger.thrift compact
- "6832:6832/udp" #jaeger.thrift binary
- "5778:5778" # serve configs, sampling strategies
networks:
- elastic-jaeger
restart: on-failure
environment:
- SPAN_STORAGE_TYPE=elasticsearch
depends_on:
- jaeger-collector
jaeger-query: # serves the API endpoints and a React/Javascript UI. The service is stateless and is typically run behind a load balancer
image: jaegertracing/jaeger-query
environment:
- SPAN_STORAGE_TYPE=elasticsearch
- no_proxy=localhost
ports:
- "16686:16686" # UI api endpoints
- "16687:16687" # admin port, health / /metrics
networks:
- elastic-jaeger
restart: on-failure
command: [
"--es.server-urls=http://elasticsearch:9200",
"--span-storage.type=elasticsearch",
"--log-level=debug"
]
depends_on:
- jaeger-agent
hotrod:
image: jaegertracing/example-hotrod:latest
ports:
- "8080:8080"
command: ["all"]
environment:
- JAEGER_AGENT_HOST=jaeger-agent
- JAEGER_AGENT_PORT=6831
networks:
- elastic-jaeger
depends_on:
- jaeger-agent
# jaeger-ingester reads from Kafka topic and writes to ES or Cassandra, NOT NECESSARY FOR THIS
prometheus:
image: prom/prometheus:v2.30.3
# volumes:
# - ./prometheus:/etc/prometheus
# - prometheus_data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/etc/prometheus/console_libraries'
- '--web.console.templates=/etc/prometheus/consoles'
- '--storage.tsdb.retention.time=200h'
- '--web.enable-lifecycle'
restart: unless-stopped
ports:
- "9090:9090"
networks:
- elastic-jaeger
depends_on:
- jaeger-agent
grafana:
image: grafana/grafana:8.2.1
# volumes:
# - grafana_data:/var/lib/grafana
# - ./grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards
# - ./grafana/provisioning/datasources:/etc/grafana/provisioning/datasources
environment:
# - GF_SECURITY_ADMIN_USER=${ADMIN_USER:-admin}
# - GF_SECURITY_ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin}
- GF_USERS_ALLOW_SIGN_UP=true
restart: unless-stopped
ports:
- "3000:3000"
networks:
- elastic-jaeger
depends_on:
- jaeger-agent
volumes:
esdata:
driver: local
networks:
elastic-jaeger:
driver: bridge #default driver: use to establish all-to-all communication
#http://localhost:16686/trace/419751de4ae9fbf6
#http://localhost:8080/
#http://localhost:9200/
#http://localhost:9090/
#http://localhost:3000/
#https://github.com/stefanprodan/dockprom/tree/master/grafana/provisioning/dashboards
#https://logz.io/blog/monitoring-dockerized-elk-stack/
#https://developers.redhat.com/blog/2019/08/28/build-a-monitoring-infrastructure-for-your-jaeger-installation#adapt_the_mixin
#https://www.jaegertracing.io/docs/1.27/operator/
#jb install github.com/jaegertracing/jaeger/monitoring/jaeger-mixin@master github.com/grafana/jsonnet-libs/grafana-builder@master github.com/coreos/kube-prometheus/jsonnet/kube-prometheus@master
# jb install https://github.com/jaegertracing/jaeger/tree/master/monitoring/jaeger-mixin@master https://github.com/grafana/jsonnet-libs@master https://github.com/prometheus-operator/kube-prometheus/tree/main/jsonnet/kube-prometheus@main
# jb install github.com/jaegertracing/jaeger/monitoring/jaeger-mixin@master github.com/grafana/jsonnet-libs/grafana-builder@master github.com/coreos/kube-prometheus/jsonnet/kube-prometheus@main
# jb install github.com/jaegertracing/jaeger/monitoring/jaeger-mixin@master github.com/grafana/jsonnet-libs/grafana-builder@master github.com/coreos/kube-prometheus/jsonnet/kube-prometheus@main
# https://github.com/jaegertracing/jaeger/issues/2956
# jaeger operator k8s still experimental https://github.com/jaegertracing/jaeger-operator
# docker run -d --name jaeger-docker -e COLLECTOR_ZIPKIN_HTTP_PORT=9411 -e SPAN_STORAGE_TYPE=elasticsearch -e ES_SERVER_URLS=http://host.docker.internal:9200 -p 5775:5775/udp -p 6831:6831/udp -p 6832:6832/udp -p 5778:5778 -p 16686:16686 -p 14268:14268 -p 14250:14250 -p 9411:9411 jaegertracing/all-in-one:1.27
# docker run --rm -it --link jaeger-docker -p8080-8083:8080-8083 -e JAEGER_AGENT_HOST="jaeger" jaegertracing/example-hotrod:1.27 all