Skip to content

Commit

Permalink
Use default HTTP and gRPC ports in the read-write local dev env (#2839)
Browse files Browse the repository at this point in the history
Signed-off-by: Marco Pracucci <marco@pracucci.com>

Signed-off-by: Marco Pracucci <marco@pracucci.com>
  • Loading branch information
pracucci authored Aug 26, 2022
1 parent 5f68cad commit 4babbb7
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 50 deletions.
8 changes: 4 additions & 4 deletions development/mimir-read-write-mode/config/grafana-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ prometheus:
scrape_configs:
- job_name: mimir-read-write-mode/mimir-write
static_configs:
- targets: ['mimir-write-1:8001', 'mimir-write-2:8002', 'mimir-write-3:8003']
- targets: ['mimir-write-1:8080', 'mimir-write-2:8080', 'mimir-write-3:8080']
labels:
cluster: 'docker-compose'
namespace: 'mimir-read-write-mode'
- job_name: mimir-read-write-mode/mimir-read
static_configs:
- targets: ['mimir-read-1:8004', 'mimir-read-2:8005']
- targets: ['mimir-read-1:8080', 'mimir-read-2:8080']
labels:
cluster: 'docker-compose'
namespace: 'mimir-read-write-mode'
- job_name: mimir-read-write-mode/mimir-backend
static_configs:
- targets: ['mimir-backend-1:8006', 'mimir-backend-2:8007']
- targets: ['mimir-backend-1:8080', 'mimir-backend-2:8080']
labels:
cluster: 'docker-compose'
namespace: 'mimir-read-write-mode'

remote_write:
- url: http://mimir-write-1:8001/api/v1/push
- url: http://mimir-write-1:8080/api/v1/push
6 changes: 3 additions & 3 deletions development/mimir-read-write-mode/config/mimir.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ memberlist:
ruler:
rule_path: /data/ruler
# Each ruler is configured to route alerts to the Alertmanager running within the same component.
alertmanager_url: http://mimir-backend-1:8006/alertmanager
alertmanager_url: http://localhost:8080/alertmanager

ruler_storage:
s3:
Expand All @@ -48,12 +48,12 @@ ruler_storage:
frontend:
# Currently we can't specify multiple addresses, so we're just using a single replica for the query-scheduler.
# See: https://github.com/grafana/mimir/issues/2012
scheduler_address: "mimir-backend-1:9006"
scheduler_address: "mimir-backend-1:9095"

frontend_worker:
# Currently we can't specify multiple addresses, so we're just using a single replica for the query-scheduler.
# See: https://github.com/grafana/mimir/issues/2012
scheduler_address: "mimir-backend-1:9006"
scheduler_address: "mimir-backend-1:9095"

alertmanager:
data_dir: /data/alertmanager
Expand Down
26 changes: 11 additions & 15 deletions development/mimir-read-write-mode/docker-compose.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ std.manifestYamlDoc({
'mimir-write-1': mimirService({
name: 'mimir-write-1',
target: 'write',
httpPort: 8001,
publishedHttpPort: 8001,
extraVolumes: ['.data-mimir-write-1:/data:delegated'],
}),
'mimir-write-2': mimirService({
name: 'mimir-write-2',
target: 'write',
httpPort: 8002,
publishedHttpPort: 8002,
extraVolumes: ['.data-mimir-write-2:/data:delegated'],
}),
'mimir-write-3': mimirService({
name: 'mimir-write-3',
target: 'write',
httpPort: 8003,
publishedHttpPort: 8003,
extraVolumes: ['.data-mimir-write-3:/data:delegated'],
}),
},
Expand All @@ -34,25 +34,25 @@ std.manifestYamlDoc({
'mimir-read-1': mimirService({
name: 'mimir-read-1',
target: 'read',
httpPort: 8004,
publishedHttpPort: 8004,
}),
'mimir-read-2': mimirService({
name: 'mimir-read-2',
target: 'read',
httpPort: 8005,
publishedHttpPort: 8005,
}),
},

backend:: {
'mimir-backend-1': mimirService({
name: 'mimir-backend-1',
target: 'backend',
httpPort: 8006,
publishedHttpPort: 8006,
}),
'mimir-backend-2': mimirService({
name: 'mimir-backend-2',
target: 'backend',
httpPort: 8007,
publishedHttpPort: 8007,
}),
},

Expand Down Expand Up @@ -84,18 +84,16 @@ std.manifestYamlDoc({
},

// This function builds docker-compose declaration for Mimir service.
// Default grpcPort is (httpPort + 1000).
local mimirService(serviceOptions) = {
local defaultOptions = {
local s = self,
name: error 'missing name',
target: error 'missing target',
httpPort: error 'missing httpPort',
grpcPort: self.httpPort + 1000,
publishedHttpPort: error 'missing publishedHttpPort',
dependsOn: ['minio'],
env: {},
extraVolumes: [],
memberlistBindPort: self.httpPort + 2000,
memberlistBindPort: self.publishedHttpPort + 2000,
},

local options = defaultOptions + serviceOptions,
Expand All @@ -109,9 +107,7 @@ std.manifestYamlDoc({
'./mimir',
'-config.file=./config/mimir.yaml' % options,
'-target=%(target)s' % options,
'-server.http-listen-port=%(httpPort)d' % options,
'-server.grpc-listen-port=%(grpcPort)d' % options,
'-activity-tracker.filepath=/activity/%(target)s-%(httpPort)d' % options,
'-activity-tracker.filepath=/activity/%(name)s' % options,
],
environment: [
'%s=%s' % [key, options.env[key]]
Expand All @@ -120,7 +116,7 @@ std.manifestYamlDoc({
],
hostname: options.name,
// Only publish HTTP port, but not gRPC one.
ports: ['%d:%d' % [options.httpPort, options.httpPort]],
ports: ['%d:8080' % options.publishedHttpPort],
depends_on: options.dependsOn,
volumes: ['./config:/mimir/config', './activity:/activity'] + options.extraVolumes,
},
Expand Down
42 changes: 14 additions & 28 deletions development/mimir-read-write-mode/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@
- "./mimir"
- "-config.file=./config/mimir.yaml"
- "-target=backend"
- "-server.http-listen-port=8006"
- "-server.grpc-listen-port=9006"
- "-activity-tracker.filepath=/activity/backend-8006"
- "-activity-tracker.filepath=/activity/mimir-backend-1"
"depends_on":
- "minio"
"environment": []
"hostname": "mimir-backend-1"
"image": "mimir"
"ports":
- "8006:8006"
- "8006:8080"
"volumes":
- "./config:/mimir/config"
- "./activity:/activity"
Expand All @@ -39,16 +37,14 @@
- "./mimir"
- "-config.file=./config/mimir.yaml"
- "-target=backend"
- "-server.http-listen-port=8007"
- "-server.grpc-listen-port=9007"
- "-activity-tracker.filepath=/activity/backend-8007"
- "-activity-tracker.filepath=/activity/mimir-backend-2"
"depends_on":
- "minio"
"environment": []
"hostname": "mimir-backend-2"
"image": "mimir"
"ports":
- "8007:8007"
- "8007:8080"
"volumes":
- "./config:/mimir/config"
- "./activity:/activity"
Expand All @@ -60,16 +56,14 @@
- "./mimir"
- "-config.file=./config/mimir.yaml"
- "-target=read"
- "-server.http-listen-port=8004"
- "-server.grpc-listen-port=9004"
- "-activity-tracker.filepath=/activity/read-8004"
- "-activity-tracker.filepath=/activity/mimir-read-1"
"depends_on":
- "minio"
"environment": []
"hostname": "mimir-read-1"
"image": "mimir"
"ports":
- "8004:8004"
- "8004:8080"
"volumes":
- "./config:/mimir/config"
- "./activity:/activity"
Expand All @@ -81,16 +75,14 @@
- "./mimir"
- "-config.file=./config/mimir.yaml"
- "-target=read"
- "-server.http-listen-port=8005"
- "-server.grpc-listen-port=9005"
- "-activity-tracker.filepath=/activity/read-8005"
- "-activity-tracker.filepath=/activity/mimir-read-2"
"depends_on":
- "minio"
"environment": []
"hostname": "mimir-read-2"
"image": "mimir"
"ports":
- "8005:8005"
- "8005:8080"
"volumes":
- "./config:/mimir/config"
- "./activity:/activity"
Expand All @@ -102,16 +94,14 @@
- "./mimir"
- "-config.file=./config/mimir.yaml"
- "-target=write"
- "-server.http-listen-port=8001"
- "-server.grpc-listen-port=9001"
- "-activity-tracker.filepath=/activity/write-8001"
- "-activity-tracker.filepath=/activity/mimir-write-1"
"depends_on":
- "minio"
"environment": []
"hostname": "mimir-write-1"
"image": "mimir"
"ports":
- "8001:8001"
- "8001:8080"
"volumes":
- "./config:/mimir/config"
- "./activity:/activity"
Expand All @@ -124,16 +114,14 @@
- "./mimir"
- "-config.file=./config/mimir.yaml"
- "-target=write"
- "-server.http-listen-port=8002"
- "-server.grpc-listen-port=9002"
- "-activity-tracker.filepath=/activity/write-8002"
- "-activity-tracker.filepath=/activity/mimir-write-2"
"depends_on":
- "minio"
"environment": []
"hostname": "mimir-write-2"
"image": "mimir"
"ports":
- "8002:8002"
- "8002:8080"
"volumes":
- "./config:/mimir/config"
- "./activity:/activity"
Expand All @@ -146,16 +134,14 @@
- "./mimir"
- "-config.file=./config/mimir.yaml"
- "-target=write"
- "-server.http-listen-port=8003"
- "-server.grpc-listen-port=9003"
- "-activity-tracker.filepath=/activity/write-8003"
- "-activity-tracker.filepath=/activity/mimir-write-3"
"depends_on":
- "minio"
"environment": []
"hostname": "mimir-write-3"
"image": "mimir"
"ports":
- "8003:8003"
- "8003:8080"
"volumes":
- "./config:/mimir/config"
- "./activity:/activity"
Expand Down

0 comments on commit 4babbb7

Please sign in to comment.