diff --git a/apps/cic-cache/docker/start_tracker.sh b/apps/cic-cache/docker/start_tracker.sh index 60c39329..49650656 100644 --- a/apps/cic-cache/docker/start_tracker.sh +++ b/apps/cic-cache/docker/start_tracker.sh @@ -14,8 +14,8 @@ fi if [[ "$CONTRACT_MIGRATION_URL" ]]; then echo "waiting for $CONTRACT_MIGRATION_URL/readyz" - ./wait-for-it.sh $CONTRACT_MIGRATION_URL -t $WAIT_FOR_TIMEOUT - source ./get_readyz.sh # set env vars form endpoint + docker/wait-for-it.sh $CONTRACT_MIGRATION_URL -t $WAIT_FOR_TIMEOUT + source docker/get_readyz.sh # set env vars form endpoint /usr/local/bin/cic-cache-trackerd $@ else /usr/local/bin/cic-cache-trackerd $@ diff --git a/apps/cic-eth/docker/entrypoints/start_tracker.sh b/apps/cic-eth/docker/entrypoints/start_tracker.sh index ebf8b015..25831eaf 100644 --- a/apps/cic-eth/docker/entrypoints/start_tracker.sh +++ b/apps/cic-eth/docker/entrypoints/start_tracker.sh @@ -1,5 +1,17 @@ #!/bin/bash +set -e +set -u + . ./db.sh -/usr/local/bin/cic-eth-trackerd $@ +WAIT_FOR_TIMEOUT=${WAIT_FOR_TIMEOUT:-600} + +if [[ "$CONTRACT_MIGRATION_URL" ]]; then + echo "waiting for $CONTRACT_MIGRATION_URL/readyz" + ./wait-for-it.sh $CONTRACT_MIGRATION_URL -t $WAIT_FOR_TIMEOUT + source ./get_readyz.sh # set env vars form endpoint + /usr/local/bin/cic-eth-trackerd $@ +else + /usr/local/bin/cic-eth-trackerd $@ +fi diff --git a/apps/contract-migration/run_job.sh b/apps/contract-migration/run_job.sh index 077192fb..1f94812c 100755 --- a/apps/contract-migration/run_job.sh +++ b/apps/contract-migration/run_job.sh @@ -12,7 +12,10 @@ if [[ $((RUN_MASK & 1)) -eq 1 ]] then >&2 echo -e "\033[;96mRUNNING\033[;39m RUN_MASK 1 - contract deployment" ./reset.sh - ./docker/init_readyz.sh 2>&1 & + # cic-eth-xxx services rely on + export RUN_MASK_PHASE=1 + ./docker/init_readyz.sh & + echo 0 if [ $? -ne "0" ]; then >&2 echo -e "\033[;31mFAILED\033[;39m RUN_MASK 1 - contract deployment" exit 1; @@ -24,12 +27,11 @@ if [[ $((RUN_MASK & 2)) -eq 2 ]] then >&2 echo -e "\033[;96mRUNNING\033[;39m RUN_MASK 2 - custodial service initialization" ./seed_cic_eth.sh - ./docker/init_readyz.sh if [ $? -ne "0" ]; then >&2 echo -e "\033[;31mFAILED\033[;39m RUN_MASK 2 - custodial service initialization" exit 1; fi >&2 echo -e "\033[;32mSUCCEEDED\033[;39m RUN_MASK 2 - custodial service initialization" fi - - +# this will leave the container up and serving the results of the migration +wait diff --git a/docker-compose.yml b/docker-compose.yml index d7160b2b..f50cea58 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -363,6 +363,7 @@ services: environment: RPC_PROVIDER: ${RPC_PROVIDER:-http://eth:8545} ETH_PROVIDER: ${RPC_PROVIDER:-http://eth:8545} + RPC_HTTP_PROVIDER: ${RPC_PROVIDER:-http://eth:8545} DATABASE_USER: ${DATABASE_USER:-grassroots} DATABASE_HOST: ${DATABASE_HOST:-postgres} DATABASE_PASSWORD: ${DATABASE_PASSWORD:-tralala} @@ -454,6 +455,7 @@ services: CIC_TX_RETRY_DELAY: 60 BATCH_SIZE: ${RETRIER_BATCH_SIZE:-50} #DATABASE_DEBUG: 1 + CONTRACT_MIGRATION_URL: contract-migration:8000 restart: on-failure depends_on: - eth