From 410bbbc15c0332e77464c030bdf5d49cf2d72bb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C5=A0tibran=C3=BD?= Date: Thu, 10 Dec 2020 17:25:28 +0100 Subject: [PATCH] Add docker-compose setup using gossip. (#3578) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Štibraný --- .../.data-ingester-1/.gitignore | 2 + .../.data-ingester-2/.gitignore | 2 + .../.data-minio/.gitignore | 5 + .../cortex-alertmanager/.gitignore | 2 + .../.data-minio/cortex-ruler/.gitignore | 2 + .../.data-minio/cortex-tsdb/.gitignore | 2 + .../.dockerignore | 4 + .../tsdb-blocks-storage-s3-gossip/.gitignore | 1 + .../compose-down.sh | 5 + .../compose-up.sh | 10 + .../config/cortex.yaml | 142 ++++++++ .../config/grafana-agent.yaml | 64 ++++ .../config/prometheus.yaml | 57 +++ .../dev.dockerfile | 10 + .../docker-compose.yml | 338 ++++++++++++++++++ 15 files changed, 646 insertions(+) create mode 100644 development/tsdb-blocks-storage-s3-gossip/.data-ingester-1/.gitignore create mode 100644 development/tsdb-blocks-storage-s3-gossip/.data-ingester-2/.gitignore create mode 100644 development/tsdb-blocks-storage-s3-gossip/.data-minio/.gitignore create mode 100644 development/tsdb-blocks-storage-s3-gossip/.data-minio/cortex-alertmanager/.gitignore create mode 100644 development/tsdb-blocks-storage-s3-gossip/.data-minio/cortex-ruler/.gitignore create mode 100644 development/tsdb-blocks-storage-s3-gossip/.data-minio/cortex-tsdb/.gitignore create mode 100644 development/tsdb-blocks-storage-s3-gossip/.dockerignore create mode 100644 development/tsdb-blocks-storage-s3-gossip/.gitignore create mode 100755 development/tsdb-blocks-storage-s3-gossip/compose-down.sh create mode 100755 development/tsdb-blocks-storage-s3-gossip/compose-up.sh create mode 100644 development/tsdb-blocks-storage-s3-gossip/config/cortex.yaml create mode 100644 development/tsdb-blocks-storage-s3-gossip/config/grafana-agent.yaml create mode 100644 development/tsdb-blocks-storage-s3-gossip/config/prometheus.yaml create mode 100644 development/tsdb-blocks-storage-s3-gossip/dev.dockerfile create mode 100644 development/tsdb-blocks-storage-s3-gossip/docker-compose.yml diff --git a/development/tsdb-blocks-storage-s3-gossip/.data-ingester-1/.gitignore b/development/tsdb-blocks-storage-s3-gossip/.data-ingester-1/.gitignore new file mode 100644 index 0000000000..d6b7ef32c8 --- /dev/null +++ b/development/tsdb-blocks-storage-s3-gossip/.data-ingester-1/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/development/tsdb-blocks-storage-s3-gossip/.data-ingester-2/.gitignore b/development/tsdb-blocks-storage-s3-gossip/.data-ingester-2/.gitignore new file mode 100644 index 0000000000..d6b7ef32c8 --- /dev/null +++ b/development/tsdb-blocks-storage-s3-gossip/.data-ingester-2/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/development/tsdb-blocks-storage-s3-gossip/.data-minio/.gitignore b/development/tsdb-blocks-storage-s3-gossip/.data-minio/.gitignore new file mode 100644 index 0000000000..521c201bb0 --- /dev/null +++ b/development/tsdb-blocks-storage-s3-gossip/.data-minio/.gitignore @@ -0,0 +1,5 @@ +* +!.gitignore +!cortex-tsdb +!cortex-alertmanager +!cortex-ruler diff --git a/development/tsdb-blocks-storage-s3-gossip/.data-minio/cortex-alertmanager/.gitignore b/development/tsdb-blocks-storage-s3-gossip/.data-minio/cortex-alertmanager/.gitignore new file mode 100644 index 0000000000..d6b7ef32c8 --- /dev/null +++ b/development/tsdb-blocks-storage-s3-gossip/.data-minio/cortex-alertmanager/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/development/tsdb-blocks-storage-s3-gossip/.data-minio/cortex-ruler/.gitignore b/development/tsdb-blocks-storage-s3-gossip/.data-minio/cortex-ruler/.gitignore new file mode 100644 index 0000000000..d6b7ef32c8 --- /dev/null +++ b/development/tsdb-blocks-storage-s3-gossip/.data-minio/cortex-ruler/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/development/tsdb-blocks-storage-s3-gossip/.data-minio/cortex-tsdb/.gitignore b/development/tsdb-blocks-storage-s3-gossip/.data-minio/cortex-tsdb/.gitignore new file mode 100644 index 0000000000..d6b7ef32c8 --- /dev/null +++ b/development/tsdb-blocks-storage-s3-gossip/.data-minio/cortex-tsdb/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/development/tsdb-blocks-storage-s3-gossip/.dockerignore b/development/tsdb-blocks-storage-s3-gossip/.dockerignore new file mode 100644 index 0000000000..085f68e84d --- /dev/null +++ b/development/tsdb-blocks-storage-s3-gossip/.dockerignore @@ -0,0 +1,4 @@ +.data-configstore +.data-ingester-1 +.data-ingester-2 +.data-minio diff --git a/development/tsdb-blocks-storage-s3-gossip/.gitignore b/development/tsdb-blocks-storage-s3-gossip/.gitignore new file mode 100644 index 0000000000..ec092519cb --- /dev/null +++ b/development/tsdb-blocks-storage-s3-gossip/.gitignore @@ -0,0 +1 @@ +cortex \ No newline at end of file diff --git a/development/tsdb-blocks-storage-s3-gossip/compose-down.sh b/development/tsdb-blocks-storage-s3-gossip/compose-down.sh new file mode 100755 index 0000000000..39f37303e9 --- /dev/null +++ b/development/tsdb-blocks-storage-s3-gossip/compose-down.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +SCRIPT_DIR=$(cd `dirname $0` && pwd) + +docker-compose -f ${SCRIPT_DIR}/docker-compose.yml down diff --git a/development/tsdb-blocks-storage-s3-gossip/compose-up.sh b/development/tsdb-blocks-storage-s3-gossip/compose-up.sh new file mode 100755 index 0000000000..7baee60321 --- /dev/null +++ b/development/tsdb-blocks-storage-s3-gossip/compose-up.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e + +SCRIPT_DIR=$(cd `dirname $0` && pwd) + +# -gcflags "all=-N -l" disables optimizations that allow for better run with combination with Delve debugger. +CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -mod=vendor -gcflags "all=-N -l" -o ${SCRIPT_DIR}/cortex ${SCRIPT_DIR}/../../cmd/cortex +docker-compose -f ${SCRIPT_DIR}/docker-compose.yml build distributor +docker-compose -f ${SCRIPT_DIR}/docker-compose.yml up $@ diff --git a/development/tsdb-blocks-storage-s3-gossip/config/cortex.yaml b/development/tsdb-blocks-storage-s3-gossip/config/cortex.yaml new file mode 100644 index 0000000000..700a013801 --- /dev/null +++ b/development/tsdb-blocks-storage-s3-gossip/config/cortex.yaml @@ -0,0 +1,142 @@ +auth_enabled: false + +distributor: + shard_by_all_labels: true + pool: + health_check_ingesters: true + +ingester_client: + grpc_client_config: + # Configure the client to allow messages up to 100MB. + max_recv_msg_size: 104857600 + max_send_msg_size: 104857600 + grpc_compression: gzip + +ingester: + lifecycler: + # We want to start immediately. + join_after: 0 + final_sleep: 0s + num_tokens: 512 + + ring: + kvstore: + store: memberlist + replication_factor: 1 + +memberlist: + join_members: + - distributor:10001 + - ingester-1:10002 + - ingester-2:10003 + - querier:10004 + - ruler-1:10021 + - ruler-2:10022 + - querier-with-scheduler:10013 + abort_if_cluster_join_fails: false + +querier: + query_ingesters_within: 3h + + # Used when the blocks sharding is disabled. + store_gateway_addresses: store-gateway-1:9008,store-gateway-2:9009 + +blocks_storage: + backend: s3 + + tsdb: + dir: /tmp/cortex-tsdb-ingester + ship_interval: 1m + block_ranges_period: [ 2h ] + retention_period: 3h + + bucket_store: + sync_dir: /tmp/cortex-tsdb-querier + consistency_delay: 5s + + index_cache: + backend: memcached + memcached: + addresses: dns+memcached:11211 + + chunks_cache: + backend: memcached + memcached: + addresses: dns+memcached:11211 + + metadata_cache: + backend: memcached + memcached: + addresses: dns+memcached:11211 + + s3: + endpoint: minio:9000 + bucket_name: cortex-tsdb + access_key_id: cortex + secret_access_key: supersecret + insecure: true + +ruler: + enable_api: true + storage: + type: s3 + s3: + bucketnames: cortex-ruler + s3forcepathstyle: true + s3: http://cortex:supersecret@minio.:9000 + enable_sharding: true + ring: + heartbeat_period: 5s + heartbeat_timeout: 15s + kvstore: + store: consul + consul: + host: consul:8500 + +alertmanager: + enable_api: true + storage: + type: s3 + s3: + bucketnames: cortex-alertmanager + s3forcepathstyle: true + s3: http://cortex:supersecret@minio.:9000 + +storage: + engine: blocks + +compactor: + compaction_interval: 30s + data_dir: /tmp/cortex-compactor + consistency_delay: 1m + sharding_enabled: true + sharding_ring: + kvstore: + store: consul + consul: + host: consul:8500 + +store_gateway: + sharding_enabled: true + sharding_ring: + replication_factor: 1 + heartbeat_period: 5s + heartbeat_timeout: 15s + kvstore: + store: consul + consul: + host: consul:8500 + +frontend_worker: + frontend_address: "query-frontend:9007" + match_max_concurrent: true + + # By setting scheduler_address, querier worker would use scheduler instead of frontend. + # scheduler_address: "query-scheduler:9012" + +query_range: + split_queries_by_interval: 24h + +limits: + # Limit max query time range to 31d + max_query_length: 744h diff --git a/development/tsdb-blocks-storage-s3-gossip/config/grafana-agent.yaml b/development/tsdb-blocks-storage-s3-gossip/config/grafana-agent.yaml new file mode 100644 index 0000000000..164b409852 --- /dev/null +++ b/development/tsdb-blocks-storage-s3-gossip/config/grafana-agent.yaml @@ -0,0 +1,64 @@ +server: + log_level: debug + http_listen_port: 9091 + +prometheus: + global: + scrape_interval: 5s + external_labels: + scraped_by: grafana-agent + configs: + - name: local + host_filter: false + scrape_configs: + - job_name: tsdb-blocks-storage-s3/distributor + static_configs: + - targets: ['distributor:8001'] + labels: + cluster: 'docker-compose' + namespace: 'tsdb-blocks-storage-s3' + - job_name: tsdb-blocks-storage-s3/ingester + static_configs: + - targets: ['ingester-1:8002', 'ingester-2:8003'] + labels: + cluster: 'docker-compose' + namespace: 'tsdb-blocks-storage-s3' + - job_name: tsdb-blocks-storage-s3/querier + static_configs: + - targets: ['querier:8004', 'querier-with-scheduler:8013'] + labels: + cluster: 'docker-compose' + namespace: 'tsdb-blocks-storage-s3' + - job_name: tsdb-blocks-storage-s3/ruler + static_configs: + - targets: ['ruler-1:8021', 'ruler-2:8022'] + labels: + cluster: 'docker-compose' + namespace: 'tsdb-blocks-storage-s3' + - job_name: tsdb-blocks-storage-s3/compactor + static_configs: + - targets: ['compactor:8006'] + labels: + cluster: 'docker-compose' + namespace: 'tsdb-blocks-storage-s3' + - job_name: tsdb-blocks-storage-s3/query-frontend + static_configs: + - targets: ['query-frontend:8007', 'query-frontend-with-scheduler:8012'] + labels: + cluster: 'docker-compose' + namespace: 'tsdb-blocks-storage-s3' + - job_name: tsdb-blocks-storage-s3/store-gateway + static_configs: + - targets: ['store-gateway-1:8008', 'store-gateway-2:8009'] + labels: + cluster: 'docker-compose' + namespace: 'tsdb-blocks-storage-s3' + - job_name: tsdb-blocks-storage-s3/query-scheduler + static_configs: + - targets: ['query-scheduler:8011'] + labels: + cluster: 'docker-compose' + namespace: 'tsdb-blocks-storage-s3' + + remote_write: + - url: http://distributor:8001/api/prom/push diff --git a/development/tsdb-blocks-storage-s3-gossip/config/prometheus.yaml b/development/tsdb-blocks-storage-s3-gossip/config/prometheus.yaml new file mode 100644 index 0000000000..be12319f07 --- /dev/null +++ b/development/tsdb-blocks-storage-s3-gossip/config/prometheus.yaml @@ -0,0 +1,57 @@ +global: + scrape_interval: 5s + external_labels: + scraped_by: prometheus + +scrape_configs: + - job_name: tsdb-blocks-storage-s3/distributor + static_configs: + - targets: ['distributor:8001'] + labels: + cluster: 'docker-compose' + namespace: 'tsdb-blocks-storage-s3' + - job_name: tsdb-blocks-storage-s3/ingester + static_configs: + - targets: ['ingester-1:8002', 'ingester-2:8003'] + labels: + cluster: 'docker-compose' + namespace: 'tsdb-blocks-storage-s3' + - job_name: tsdb-blocks-storage-s3/querier + static_configs: + - targets: ['querier:8004', 'query-frontend-with-scheduler:8013'] + labels: + cluster: 'docker-compose' + namespace: 'tsdb-blocks-storage-s3' + - job_name: tsdb-blocks-storage-s3/ruler + static_configs: + - targets: ['ruler-1:8021', 'ruler-2:8022'] + labels: + cluster: 'docker-compose' + namespace: 'tsdb-blocks-storage-s3' + - job_name: tsdb-blocks-storage-s3/compactor + static_configs: + - targets: ['compactor:8006'] + labels: + cluster: 'docker-compose' + namespace: 'tsdb-blocks-storage-s3' + - job_name: tsdb-blocks-storage-s3/query-frontend + static_configs: + - targets: ['query-frontend:8007', 'query-frontend-with-scheduler:8012'] + labels: + cluster: 'docker-compose' + namespace: 'tsdb-blocks-storage-s3' + - job_name: tsdb-blocks-storage-s3/store-gateway + static_configs: + - targets: ['store-gateway-1:8008', 'store-gateway-2:8009'] + labels: + cluster: 'docker-compose' + namespace: 'tsdb-blocks-storage-s3' + - job_name: tsdb-blocks-storage-s3/query-scheduler + static_configs: + - targets: ['query-scheduler:8011'] + labels: + cluster: 'docker-compose' + namespace: 'tsdb-blocks-storage-s3' + +remote_write: + - url: http://distributor:8001/api/prom/push diff --git a/development/tsdb-blocks-storage-s3-gossip/dev.dockerfile b/development/tsdb-blocks-storage-s3-gossip/dev.dockerfile new file mode 100644 index 0000000000..ddeebf6bda --- /dev/null +++ b/development/tsdb-blocks-storage-s3-gossip/dev.dockerfile @@ -0,0 +1,10 @@ +FROM golang:1.14 +ENV CGO_ENABLED=0 GOOS=linux GOARCH=amd64 +RUN go get github.com/go-delve/delve/cmd/dlv + +FROM alpine:3.12 + +RUN mkdir /cortex +WORKDIR /cortex +ADD ./cortex ./ +COPY --from=0 /go/bin/dlv ./ diff --git a/development/tsdb-blocks-storage-s3-gossip/docker-compose.yml b/development/tsdb-blocks-storage-s3-gossip/docker-compose.yml new file mode 100644 index 0000000000..727dacba51 --- /dev/null +++ b/development/tsdb-blocks-storage-s3-gossip/docker-compose.yml @@ -0,0 +1,338 @@ +version: '3.4' +services: + + consul: + image: consul + command: [ "agent", "-dev" ,"-client=0.0.0.0", "-log-level=info" ] + ports: + - 8500:8500 + + minio: + image: minio/minio + command: [ "server", "/data" ] + environment: + - MINIO_ACCESS_KEY=cortex + - MINIO_SECRET_KEY=supersecret + ports: + - 9000:9000 + volumes: + - .data-minio:/data:delegated + + memcached: + image: memcached:1.6 + + prometheus: + image: prom/prometheus:v2.16.0 + command: ["--config.file=/etc/prometheus/prometheus.yaml"] + volumes: + - ./config:/etc/prometheus + ports: + - 9090:9090 + + jaeger: + image: jaegertracing/all-in-one + ports: + - 16686:16686 + - "14268" + + # Scrape the metrics also with the Grafana agent (useful to test metadata ingestion + # until metadata remote write is not supported by Prometheus). + grafana-agent: + image: grafana/agent:v0.2.0 + command: ["-config.file=/etc/agent-config/grafana-agent.yaml", "-prometheus.wal-directory=/tmp"] + volumes: + - ./config:/etc/agent-config + ports: + - 9091:9091 + + distributor: + build: + context: . + dockerfile: dev.dockerfile + image: cortex + command: ["sh", "-c", "sleep 3 && exec ./dlv exec ./cortex --listen=:18001 --headless=true --api-version=2 --accept-multiclient --continue -- -config.file=./config/cortex.yaml -target=distributor -server.http-listen-port=8001 -server.grpc-listen-port=9001 -memberlist.bind-port=10001"] + depends_on: + - consul + - minio + environment: + - JAEGER_AGENT_HOST=jaeger + - JAEGER_AGENT_PORT=6831 + - JAEGER_TAGS=app=distributor + - JAEGER_SAMPLER_TYPE=const + - JAEGER_SAMPLER_PARAM=1 + ports: + - 8001:8001 + - 18001:18001 + volumes: + - ./config:/cortex/config + + ingester-1: + build: + context: . + dockerfile: dev.dockerfile + image: cortex + command: ["sh", "-c", "sleep 3 && exec ./dlv exec ./cortex --listen=:18002 --headless=true --api-version=2 --accept-multiclient --continue -- -config.file=./config/cortex.yaml -target=ingester -server.http-listen-port=8002 -server.grpc-listen-port=9002 -memberlist.bind-port=10002"] + depends_on: + - consul + - minio + environment: + - JAEGER_AGENT_HOST=jaeger + - JAEGER_AGENT_PORT=6831 + - JAEGER_TAGS=app=ingester-1 + - JAEGER_SAMPLER_TYPE=const + - JAEGER_SAMPLER_PARAM=1 + ports: + - 8002:8002 + - 18002:18002 + volumes: + - ./config:/cortex/config + - .data-ingester-1:/tmp/cortex-tsdb-ingester:delegated + + ingester-2: + build: + context: . + dockerfile: dev.dockerfile + image: cortex + command: ["sh", "-c", "sleep 3 && exec ./dlv exec ./cortex --listen=:18003 --headless=true --api-version=2 --accept-multiclient --continue -- -config.file=./config/cortex.yaml -target=ingester -server.http-listen-port=8003 -server.grpc-listen-port=9003 -memberlist.bind-port=10003"] + depends_on: + - consul + - minio + environment: + - JAEGER_AGENT_HOST=jaeger + - JAEGER_AGENT_PORT=6831 + - JAEGER_TAGS=app=ingester-2 + - JAEGER_SAMPLER_TYPE=const + - JAEGER_SAMPLER_PARAM=1 + ports: + - 8003:8003 + - 18003:18003 + volumes: + - ./config:/cortex/config + - .data-ingester-2:/tmp/cortex-tsdb-ingester:delegated + + querier: + build: + context: . + dockerfile: dev.dockerfile + image: cortex + command: ["sh", "-c", "sleep 3 && exec ./dlv exec ./cortex --listen=:18004 --headless=true --api-version=2 --accept-multiclient --continue -- -config.file=./config/cortex.yaml -target=querier -server.http-listen-port=8004 -server.grpc-listen-port=9004 -memberlist.bind-port=10004"] + depends_on: + - consul + - minio + environment: + - JAEGER_AGENT_HOST=jaeger + - JAEGER_AGENT_PORT=6831 + - JAEGER_TAGS=app=querier + - JAEGER_SAMPLER_TYPE=const + - JAEGER_SAMPLER_PARAM=1 + ports: + - 8004:8004 + - 18004:18004 + volumes: + - ./config:/cortex/config + + store-gateway-1: + build: + context: . + dockerfile: dev.dockerfile + image: cortex + command: ["sh", "-c", "sleep 3 && exec ./dlv exec ./cortex --listen=:18008 --headless=true --api-version=2 --accept-multiclient --continue -- -config.file=./config/cortex.yaml -target=store-gateway -server.http-listen-port=8008 -server.grpc-listen-port=9008"] + depends_on: + - consul + - minio + environment: + - JAEGER_AGENT_HOST=jaeger + - JAEGER_AGENT_PORT=6831 + - JAEGER_TAGS=app=store-gateway-1 + - JAEGER_SAMPLER_TYPE=const + - JAEGER_SAMPLER_PARAM=1 + ports: + - 8008:8008 + - 18008:18008 + volumes: + - ./config:/cortex/config + + store-gateway-2: + build: + context: . + dockerfile: dev.dockerfile + image: cortex + command: ["sh", "-c", "sleep 3 && exec ./dlv exec ./cortex --listen=:18009 --headless=true --api-version=2 --accept-multiclient --continue -- -config.file=./config/cortex.yaml -target=store-gateway -server.http-listen-port=8009 -server.grpc-listen-port=9009"] + depends_on: + - consul + - minio + environment: + - JAEGER_AGENT_HOST=jaeger + - JAEGER_AGENT_PORT=6831 + - JAEGER_TAGS=app=store-gateway-2 + - JAEGER_SAMPLER_TYPE=const + - JAEGER_SAMPLER_PARAM=1 + ports: + - 8009:8009 + - 18009:18009 + volumes: + - ./config:/cortex/config + + compactor: + build: + context: . + dockerfile: dev.dockerfile + image: cortex + command: ["sh", "-c", "sleep 3 && exec ./dlv exec ./cortex --listen=:18006 --headless=true --api-version=2 --accept-multiclient --continue -- -config.file=./config/cortex.yaml -target=compactor -server.http-listen-port=8006 -server.grpc-listen-port=9006"] + depends_on: + - consul + - minio + environment: + - JAEGER_AGENT_HOST=jaeger + - JAEGER_AGENT_PORT=6831 + - JAEGER_TAGS=app=compactor + - JAEGER_SAMPLER_TYPE=const + - JAEGER_SAMPLER_PARAM=1 + ports: + - 8006:8006 + - 18006:18006 + volumes: + - ./config:/cortex/config + + query-frontend: + build: + context: . + dockerfile: dev.dockerfile + image: cortex + command: ["sh", "-c", "sleep 3 && exec ./dlv exec ./cortex --listen=:18007 --headless=true --api-version=2 --accept-multiclient --continue -- -config.file=./config/cortex.yaml -target=query-frontend -server.http-listen-port=8007 -server.grpc-listen-port=9007 -store.max-query-length=8760h"] + depends_on: + - consul + - minio + environment: + - JAEGER_AGENT_HOST=jaeger + - JAEGER_AGENT_PORT=6831 + - JAEGER_TAGS=app=query-frontend + - JAEGER_SAMPLER_TYPE=const + - JAEGER_SAMPLER_PARAM=1 + ports: + - 8007:8007 + - 18007:18007 + volumes: + - ./config:/cortex/config + + alertmanager: + build: + context: . + dockerfile: dev.dockerfile + image: cortex + command: ["sh", "-c", "sleep 3 && exec ./dlv exec ./cortex --listen=:18010 --headless=true --api-version=2 --accept-multiclient --continue -- -config.file=./config/cortex.yaml -target=alertmanager -server.http-listen-port=8010 -server.grpc-listen-port=9010"] + depends_on: + - consul + - minio + ports: + - 8010:8010 + - 18010:18010 + volumes: + - ./config:/cortex/config + + ruler-1: + build: + context: . + dockerfile: dev.dockerfile + image: cortex + command: ["sh", "-c", "sleep 3 && exec ./dlv exec ./cortex --listen=:18021 --headless=true --api-version=2 --accept-multiclient --continue -- -config.file=./config/cortex.yaml -target=ruler -server.http-listen-port=8021 -server.grpc-listen-port=9021 -memberlist.bind-port=10021"] + depends_on: + - consul + - minio + environment: + - JAEGER_AGENT_HOST=jaeger + - JAEGER_AGENT_PORT=6831 + - JAEGER_TAGS=app=ruler-1 + - JAEGER_SAMPLER_TYPE=const + - JAEGER_SAMPLER_PARAM=1 + ports: + - 8021:8021 + - 18021:18021 + volumes: + - ./config:/cortex/config + + ruler-2: + build: + context: . + dockerfile: dev.dockerfile + image: cortex + command: ["sh", "-c", "sleep 3 && exec ./dlv exec ./cortex --listen=:18022 --headless=true --api-version=2 --accept-multiclient --continue -- -config.file=./config/cortex.yaml -target=ruler -server.http-listen-port=8022 -server.grpc-listen-port=9022 -memberlist.bind-port=10022"] + depends_on: + - consul + - minio + environment: + - JAEGER_AGENT_HOST=jaeger + - JAEGER_AGENT_PORT=6831 + - JAEGER_TAGS=app=ruler-2 + - JAEGER_SAMPLER_TYPE=const + - JAEGER_SAMPLER_PARAM=1 + ports: + - 8022:8022 + - 18022:18022 + volumes: + - ./config:/cortex/config + + query-scheduler: + build: + context: . + dockerfile: dev.dockerfile + image: cortex + command: ["sh", "-c", "sleep 3 && exec ./dlv exec ./cortex --listen=:18011 --headless=true --api-version=2 --accept-multiclient --continue -- -config.file=./config/cortex.yaml -target=query-scheduler -server.http-listen-port=8011 -server.grpc-listen-port=9011 -store.max-query-length=8760h -log.level=debug"] + depends_on: + - consul + - minio + environment: + - JAEGER_AGENT_HOST=jaeger + - JAEGER_AGENT_PORT=6831 + - JAEGER_TAGS=app=query-scheduler + - JAEGER_SAMPLER_TYPE=const + - JAEGER_SAMPLER_PARAM=1 + ports: + - 8011:8011 + - 18011:18011 + volumes: + - ./config:/cortex/config + + # This frontend uses query-scheduler, activated by `-frontend.scheduler-address` option. + query-frontend-with-scheduler: + build: + context: . + dockerfile: dev.dockerfile + image: cortex + command: ["sh", "-c", "sleep 3 && exec ./dlv exec ./cortex --listen=:18012 --headless=true --api-version=2 --accept-multiclient --continue -- -config.file=./config/cortex.yaml -target=query-frontend -server.http-listen-port=8012 -server.grpc-listen-port=9012 -store.max-query-length=8760h -frontend.scheduler-address=query-scheduler:9011 -log.level=debug"] + depends_on: + - consul + - minio + environment: + - JAEGER_AGENT_HOST=jaeger + - JAEGER_AGENT_PORT=6831 + - JAEGER_TAGS=app=query-frontend2 + - JAEGER_SAMPLER_TYPE=const + - JAEGER_SAMPLER_PARAM=1 + ports: + - 8012:8012 + - 18012:18012 + volumes: + - ./config:/cortex/config + + # This querier is connecting to query-scheduler, instead of query-frontend. This is achieved by setting -querier.scheduler-address="..." + querier-with-scheduler: + build: + context: . + dockerfile: dev.dockerfile + image: cortex + command: ["sh", "-c", "sleep 3 && exec ./dlv exec ./cortex --listen=:18013 --headless=true --api-version=2 --accept-multiclient --continue -- -config.file=./config/cortex.yaml -target=querier -server.http-listen-port=8013 -server.grpc-listen-port=9013 -querier.scheduler-address=query-scheduler:9011 -querier.frontend-address= -log.level=debug -memberlist.bind-port=10013"] + depends_on: + - consul + - minio + environment: + - JAEGER_AGENT_HOST=jaeger + - JAEGER_AGENT_PORT=6831 + - JAEGER_TAGS=app=querier-scheduler + - JAEGER_SAMPLER_TYPE=const + - JAEGER_SAMPLER_PARAM=1 + ports: + - 8013:8013 + - 18013:18013 + volumes: + - ./config:/cortex/config