Skip to content

Commit

Permalink
Add docker-compose setup using gossip. (cortexproject#3578)
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Štibraný <[email protected]>
  • Loading branch information
pstibrany authored Dec 10, 2020
1 parent 61122a4 commit 410bbbc
Show file tree
Hide file tree
Showing 15 changed files with 646 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!.gitignore
!cortex-tsdb
!cortex-alertmanager
!cortex-ruler
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
4 changes: 4 additions & 0 deletions development/tsdb-blocks-storage-s3-gossip/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.data-configstore
.data-ingester-1
.data-ingester-2
.data-minio
1 change: 1 addition & 0 deletions development/tsdb-blocks-storage-s3-gossip/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cortex
5 changes: 5 additions & 0 deletions development/tsdb-blocks-storage-s3-gossip/compose-down.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

SCRIPT_DIR=$(cd `dirname $0` && pwd)

docker-compose -f ${SCRIPT_DIR}/docker-compose.yml down
10 changes: 10 additions & 0 deletions development/tsdb-blocks-storage-s3-gossip/compose-up.sh
Original file line number Diff line number Diff line change
@@ -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 $@
142 changes: 142 additions & 0 deletions development/tsdb-blocks-storage-s3-gossip/config/cortex.yaml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
57 changes: 57 additions & 0 deletions development/tsdb-blocks-storage-s3-gossip/config/prometheus.yaml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions development/tsdb-blocks-storage-s3-gossip/dev.dockerfile
Original file line number Diff line number Diff line change
@@ -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 ./
Loading

0 comments on commit 410bbbc

Please sign in to comment.