Skip to content

Commit

Permalink
feat: fuel core should wait until l1 is healthy
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurgeron committed Sep 19, 2024
1 parent 09f4708 commit f9ebf18
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
9 changes: 7 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ services:
# expose the service to the host for integration testing
- 8545:9545
- ${DEPLOYMENTS_PORT:-8080}:8081
healthcheck:
test: ["CMD", "curl", "-f", "-H", "Content-Type: application/json", "-d", "{\"jsonrpc\":\"2.0\",\"id\":0,\"method\":\"net_version\",\"params\":[]}", "http://localhost:9545"]
interval: 5s
timeout: 5s
retries: 10000
networks:
- app-network

Expand All @@ -24,7 +29,7 @@ services:
platform: linux/amd64
depends_on:
l1_chain:
condition: service_started
condition: service_healthy
build:
context: ./fuel-core/
environment:
Expand All @@ -34,7 +39,7 @@ services:
# expose the service to the host for integration testing
- ${FUEL_CORE_HTTP_PORT:-4000}:4001
healthcheck:
test: curl --fail http://localhost:4001/v1/health || exit 1
test: ["CMD", "curl", "-f", "http://localhost:4001/v1/health || exit 1"]
interval: 10s
timeout: 10s
retries: 100
Expand Down
9 changes: 6 additions & 3 deletions docker/fuel-core/fuel_core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,19 @@ fi

# wait for the base layer to be up
echo "Waiting for l1 chain."
curl \
until curl \
--fail \
--show-error \
--silent \
-H "Content-Type: application/json" \
--retry-connrefused \
--retry $RETRIES \
--retry-delay 1 \
-d $JSON \
$L1_CHAIN_HTTP > /dev/null
-d "$JSON" \
"$L1_CHAIN_HTTP" > /dev/null; do
echo "Waiting for l1 chain..."
sleep 5
done
echo "Connected to l1 chain."

# get the deployments file from the deployer
Expand Down

0 comments on commit f9ebf18

Please sign in to comment.