Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
253 lines (236 loc) · 9.93 KB
/
Copy pathdocker-compose.yml
File metadata and controls
253 lines (236 loc) · 9.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# The local stack: a dev Bedrock node, the four-sequencer committee devnet, the indexer and the
# explorer. `--profile monitoring` adds Prometheus, Loki and Tempo (with Alloy shipping container
# logs and receiving traces) and Grafana.
#
# Bedrock, sequencer and indexer state live in volumes, so the stack resumes where it stopped,
# rebuilds included. `docker compose down -v` (or `just clean`) starts over from a fresh chain.
#
# Every host port, image, key path and cross-service URL is `${VAR:-default}`; `.env.local` lists
# them all with their defaults. The `SEQUENCER_*` variables inside the containers are the
# sequencer's own options, see `sequencer_service start --help`.
include:
# A file of its own, since the Docker-backed tests start Bedrock from it alone.
- bedrock/docker-compose.yml
# All four sequencers run one config, whose genesis stakes all four channel signing keys: seq-0
# opens the channel already accrediting the whole committee, and the others join a channel that
# expects them. What differs per node is its key. `just regenerate-devnet-configs` rebuilds them.
#
# The image has the `mdns` feature, so the nodes find each other on the compose network without
# any gossip address configured.
x-sequencer: &sequencer
image: ${LEZ_COMPOSE_SEQUENCER_IMAGE:-lez/sequencer_service:mdns}
depends_on:
logos-blockchain-node-0: { condition: service_healthy }
indexer_service: { condition: service_healthy }
x-sequencer-environment: &sequencer_environment
SEQUENCER_CONFIG: /etc/sequencer_service/sequencer_config.json
SEQUENCER_CHANNEL_SIGNING_KEY_FILE: /run/secrets/channel_signing_key
SEQUENCER_FUNDING_PUBLIC_KEY: ${LEZ_COMPOSE_FUNDING_PUBLIC_KEY:-2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26}
SEQUENCER_BEDROCK_NODE_URL: ${LEZ_COMPOSE_SEQUENCER_BEDROCK_NODE_URL:-http://logos-blockchain-node-0:18080}
# Traces go to Alloy, which runs with `--profile monitoring`. Without it, a sequencer warns once
# that it cannot export, and drops them. Empty turns exporting off.
OTEL_EXPORTER_OTLP_ENDPOINT: ${LEZ_COMPOSE_SEQUENCER_OTLP_ENDPOINT-http://alloy:4318}
# Only seq-0 keeps the config's genesis and creates the channel. The others drop it, so one
# starting before the channel exists waits for it instead of creating a second one.
x-follower-environment: &follower_environment
<<: *sequencer_environment
SEQUENCER_WAIT_FOR_CHANNEL: "true"
services:
# Build-only: the shared base image (toolchain + r0vm) the sequencer and indexer builds take as
# their `risc0_base` context. It exits immediately if started.
risc0_base:
image: lez/risc0_base
build:
context: .
dockerfile: lez/docker/risc0-base.Dockerfile
# Creates the channel and produces the genesis block; the others follow it.
sequencer_service_0:
<<: *sequencer
# Only this node builds (or pulls) the image; compose builds per service, so a `build` on all
# four would compile the same image four times at once. The others run what it got.
build:
context: .
dockerfile: lez/sequencer/service/Dockerfile
additional_contexts:
risc0_base: "service:risc0_base"
args:
FEATURES: prove,mdns
container_name: sequencer_service_0
environment:
<<: *sequencer_environment
SEQUENCER_CREATE_CHANNEL: "true"
# Names the node in its traces, as the `sequencer` label does in metrics and logs.
OTEL_RESOURCE_ATTRIBUTES: service.instance.id=sequencer_0
ports:
- "${LEZ_COMPOSE_SEQ_0_RPC_PORT:-3040}:3040"
- "${LEZ_COMPOSE_SEQ_0_METRICS_PORT:-9000}:9000"
volumes:
- ${LEZ_COMPOSE_SEQUENCER_CONFIG_FILE:-./lez/configs/docker-all-in-one/devnet/sequencer_config.json}:/etc/sequencer_service/sequencer_config.json:ro
- ${LEZ_COMPOSE_SEQ_0_KEY_FILE:-./lez/configs/docker-all-in-one/devnet/seq-0/channel_signing_key}:/run/secrets/channel_signing_key:ro
- sequencer_data_0:/var/lib/sequencer_service
sequencer_service_1:
<<: *sequencer
container_name: sequencer_service_1
pull_policy: never
environment:
<<: *follower_environment
OTEL_RESOURCE_ATTRIBUTES: service.instance.id=sequencer_1
depends_on:
sequencer_service_0: { condition: service_healthy }
ports:
- "${LEZ_COMPOSE_SEQ_1_RPC_PORT:-3041}:3040"
- "${LEZ_COMPOSE_SEQ_1_METRICS_PORT:-9001}:9000"
volumes:
- ${LEZ_COMPOSE_SEQUENCER_CONFIG_FILE:-./lez/configs/docker-all-in-one/devnet/sequencer_config.json}:/etc/sequencer_service/sequencer_config.json:ro
- ${LEZ_COMPOSE_SEQ_1_KEY_FILE:-./lez/configs/docker-all-in-one/devnet/seq-1/channel_signing_key}:/run/secrets/channel_signing_key:ro
- sequencer_data_1:/var/lib/sequencer_service
sequencer_service_2:
<<: *sequencer
container_name: sequencer_service_2
pull_policy: never
environment:
<<: *follower_environment
OTEL_RESOURCE_ATTRIBUTES: service.instance.id=sequencer_2
depends_on:
sequencer_service_0: { condition: service_healthy }
ports:
- "${LEZ_COMPOSE_SEQ_2_RPC_PORT:-3042}:3040"
- "${LEZ_COMPOSE_SEQ_2_METRICS_PORT:-9002}:9000"
volumes:
- ${LEZ_COMPOSE_SEQUENCER_CONFIG_FILE:-./lez/configs/docker-all-in-one/devnet/sequencer_config.json}:/etc/sequencer_service/sequencer_config.json:ro
- ${LEZ_COMPOSE_SEQ_2_KEY_FILE:-./lez/configs/docker-all-in-one/devnet/seq-2/channel_signing_key}:/run/secrets/channel_signing_key:ro
- sequencer_data_2:/var/lib/sequencer_service
sequencer_service_3:
<<: *sequencer
container_name: sequencer_service_3
pull_policy: never
environment:
<<: *follower_environment
OTEL_RESOURCE_ATTRIBUTES: service.instance.id=sequencer_3
depends_on:
sequencer_service_0: { condition: service_healthy }
ports:
- "${LEZ_COMPOSE_SEQ_3_RPC_PORT:-3043}:3040"
- "${LEZ_COMPOSE_SEQ_3_METRICS_PORT:-9003}:9000"
volumes:
- ${LEZ_COMPOSE_SEQUENCER_CONFIG_FILE:-./lez/configs/docker-all-in-one/devnet/sequencer_config.json}:/etc/sequencer_service/sequencer_config.json:ro
- ${LEZ_COMPOSE_SEQ_3_KEY_FILE:-./lez/configs/docker-all-in-one/devnet/seq-3/channel_signing_key}:/run/secrets/channel_signing_key:ro
- sequencer_data_3:/var/lib/sequencer_service
indexer_service:
image: ${LEZ_COMPOSE_INDEXER_IMAGE:-lez/indexer_service}
build:
context: .
dockerfile: lez/indexer/service/Dockerfile
additional_contexts:
risc0_base: "service:risc0_base"
container_name: indexer_service
depends_on:
logos-blockchain-node-0: { condition: service_healthy }
ports:
- "${LEZ_COMPOSE_INDEXER_RPC_PORT:-8779}:8779"
volumes:
- ${LEZ_COMPOSE_INDEXER_CONFIG_FILE:-./lez/configs/docker-all-in-one/indexer_config.json}:/etc/indexer_service/indexer_config.json:ro
- indexer_data:/var/lib/indexer_service
explorer_service:
image: ${LEZ_COMPOSE_EXPLORER_IMAGE:-lez/explorer_service}
build:
context: .
dockerfile: lez/explorer_service/Dockerfile
container_name: explorer_service
depends_on:
indexer_service: { condition: service_healthy }
environment:
INDEXER_RPC_URL: ${LEZ_COMPOSE_EXPLORER_INDEXER_URL:-http://indexer_service:8779}
ports:
- "${LEZ_COMPOSE_EXPLORER_PORT:-8080}:8080"
# Scrapes the sequencers' metrics through their host ports, so it sees natively run ones
# (`just run-sequencer`) the same way as the compose ones.
prometheus:
image: prom/prometheus:v3.13.1
container_name: prometheus
profiles: [monitoring]
command:
- --config.file=/etc/prometheus/prometheus.yml
ports:
- "${LEZ_COMPOSE_PROMETHEUS_PORT:-9090}:9090"
volumes:
- ./monitoring/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus_data:/prometheus
extra_hosts:
- "host.docker.internal:host-gateway"
grafana:
image: grafana/grafana:13.1.1
container_name: grafana
profiles: [monitoring]
ports:
- "${LEZ_COMPOSE_GRAFANA_PORT:-3000}:3000"
environment:
# Dev-only: open Grafana with no login, full access.
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
- GF_AUTH_DISABLE_LOGIN_FORM=true
volumes:
- ./monitoring/grafana/provisioning:/etc/grafana/provisioning:ro
- ./monitoring/grafana/dashboards:/var/lib/grafana/dashboards:ro
- grafana_data:/var/lib/grafana
depends_on:
- prometheus
- loki
- tempo
loki:
image: grafana/loki:3.7.9
container_name: loki
profiles: [monitoring]
command:
- -config.file=/etc/loki/loki.yml
ports:
- "${LEZ_COMPOSE_LOKI_PORT:-3100}:3100"
volumes:
- ./monitoring/loki/loki.yml:/etc/loki/loki.yml:ro
- loki_data:/loki
# Stores the traces Alloy forwards.
tempo:
image: grafana/tempo:3.1.1
container_name: tempo
profiles: [monitoring]
command:
- -target=all
- -config.file=/etc/tempo/tempo.yml
ports:
- "${LEZ_COMPOSE_TEMPO_PORT:-3200}:3200"
volumes:
- ./monitoring/tempo/tempo.yml:/etc/tempo/tempo.yml:ro
- tempo_data:/var/tempo
# Reads every container's output through the Docker socket and ships this project's to Loki, and
# forwards the traces services send it over OTLP to Tempo.
alloy:
image: grafana/alloy:v1.21.3
container_name: alloy
profiles: [monitoring]
command:
- run
- --storage.path=/var/lib/alloy/data
- /etc/alloy/config.alloy
environment:
LEZ_COMPOSE_ALLOY_PROJECT_NAME: ${COMPOSE_PROJECT_NAME}
ports:
# OTLP over HTTP, for a natively run sequencer: `OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318`.
- "${LEZ_COMPOSE_OTLP_PORT:-4318}:4318"
volumes:
- ./monitoring/alloy/config.alloy:/etc/alloy/config.alloy:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- alloy_data:/var/lib/alloy/data
depends_on:
- loki
- tempo
volumes:
sequencer_data_0:
sequencer_data_1:
sequencer_data_2:
sequencer_data_3:
indexer_data:
prometheus_data:
loki_data:
tempo_data:
alloy_data:
grafana_data: