diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 4a8b54a0..1f87c3c3 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -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 @@ -24,7 +29,7 @@ services: platform: linux/amd64 depends_on: l1_chain: - condition: service_started + condition: service_healthy build: context: ./fuel-core/ environment: @@ -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 diff --git a/docker/fuel-core/fuel_core.sh b/docker/fuel-core/fuel_core.sh index 2a70ba7c..36702b90 100644 --- a/docker/fuel-core/fuel_core.sh +++ b/docker/fuel-core/fuel_core.sh @@ -16,7 +16,7 @@ fi # wait for the base layer to be up echo "Waiting for l1 chain." -curl \ +until curl \ --fail \ --show-error \ --silent \ @@ -24,8 +24,11 @@ curl \ --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