Skip to content

Commit 8fe629a

Browse files
deployment: wait for node healthcheck before starting the simulator (#14225)
1 parent 5cf7af6 commit 8fe629a

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

deployments/monitoring/local/docker-compose.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ x-sequencer-node: &sequencer_node
2424
- config:/config
2525
networks:
2626
- sequencer-network
27+
# Mark a node healthy once its HTTP gateway accepts connections, so the simulator waits for it
28+
# instead of racing the gateway bind. Uses bash /dev/tcp since the image has no curl.
29+
healthcheck:
30+
test: ["CMD", "bash", "-c", "</dev/tcp/localhost/${SEQUENCER_HTTP_PORT}"]
31+
interval: 5s
32+
timeout: 3s
33+
retries: 30
34+
start_period: 10s
2735

2836
services:
2937
prometheus:
@@ -115,8 +123,8 @@ services:
115123
jq --arg v "${STRK_USD_ORACLE_URL_HEADERS:-http://dummy_exchange_rate_oracle:9000/eth_to_strk_oracle}" '."l1_gas_price_provider_config.strk_to_usd_oracle_config.url_header_list" = $$v' "$$cfg" | sponge "$$cfg"
116124
jq --argjson v ${STRK_USD_ORACLE_LAG_SECONDS:-60} '."l1_gas_price_provider_config.strk_to_usd_oracle_config.lag_interval_seconds" = $$v' "$$cfg" | sponge "$$cfg"
117125
jq '."http_server_config.static_config.ip" = "0.0.0.0"' "$$cfg" | sponge "$$cfg"
118-
jq '."http_server_config.static_config.port" = 8081' "$$cfg" | sponge "$$cfg"
119-
jq '."monitoring_endpoint_config.port" = 8082' "$$cfg" | sponge "$$cfg"
126+
jq '."http_server_config.static_config.port" = ${SEQUENCER_HTTP_PORT}' "$$cfg" | sponge "$$cfg"
127+
jq '."monitoring_endpoint_config.port" = ${SEQUENCER_MONITORING_PORT}' "$$cfg" | sponge "$$cfg"
120128
jq '."components.l1_events_scraper.execution_mode" = "Disabled"' "$$cfg" | sponge "$$cfg"
121129
jq '."l1_events_scraper_config.#is_none" = true' "$$cfg" | sponge "$$cfg"
122130
jq '."l1_events_provider_config.dummy_mode" = true' "$$cfg" | sponge "$$cfg"
@@ -136,8 +144,8 @@ services:
136144
sequencer-node-0:
137145
<<: *sequencer_node
138146
ports:
139-
- "8081:8081"
140-
- "8082:8082"
147+
- "${SEQUENCER_HTTP_PORT}:${SEQUENCER_HTTP_PORT}"
148+
- "${SEQUENCER_MONITORING_PORT}:${SEQUENCER_MONITORING_PORT}"
141149
command:
142150
- "--config_file"
143151
- "/config/node_0/config.json"
@@ -172,7 +180,8 @@ services:
172180

173181
sequencer_simulator:
174182
depends_on:
175-
- sequencer-node-0
183+
sequencer-node-0:
184+
condition: service_healthy
176185
build:
177186
context: ${SEQUENCER_ROOT_DIR}
178187
dockerfile: ${SEQUENCER_ROOT_DIR}/deployments/images/sequencer/simulator.Dockerfile
@@ -184,9 +193,9 @@ services:
184193
command: >
185194
"./target/debug/sequencer_simulator \
186195
--http-url http://sequencer-node-0 \
187-
--http-port 8081 \
196+
--http-port ${SEQUENCER_HTTP_PORT} \
188197
--monitoring-url http://sequencer-node-0 \
189-
--monitoring-port 8082 \
198+
--monitoring-port ${SEQUENCER_MONITORING_PORT} \
190199
$$(if [ \"$$SIMULATOR_RUN_FOREVER\" = \"true\" ]; then echo '--run-forever'; fi)"
191200
networks:
192201
- sequencer-network

0 commit comments

Comments
 (0)