From 33c00ed93b30c35e4909a155aad2c6e0a5c41b3b Mon Sep 17 00:00:00 2001 From: nolash Date: Thu, 11 Feb 2021 17:20:31 +0100 Subject: [PATCH] Set cic-eth seed script to run sequentially after contract migration --- apps/contract-migration/reset.sh | 4 ++-- apps/contract-migration/seed_cic_eth.sh | 8 +++++++- docker-compose.yml | 6 ++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/apps/contract-migration/reset.sh b/apps/contract-migration/reset.sh index 360c4f78..45fe1e47 100644 --- a/apps/contract-migration/reset.sh +++ b/apps/contract-migration/reset.sh @@ -19,7 +19,7 @@ echo \n # pushd /usr/src init_level_file=${CIC_DATA_DIR}/.init -echo -n 0 > $init_level_file +echo -n 1 > $init_level_file # Abort on any error (including if wait-for-it fails). set -e @@ -68,6 +68,6 @@ cat $CIC_DATA_DIR/envlist | bash from_env.sh > $CIC_DATA_DIR/.env_all set +a set +e -echo -n 1 > $init_level_file +echo -n 2 > $init_level_file exec "$@" diff --git a/apps/contract-migration/seed_cic_eth.sh b/apps/contract-migration/seed_cic_eth.sh index 4d0ecabf..d5ccf916 100644 --- a/apps/contract-migration/seed_cic_eth.sh +++ b/apps/contract-migration/seed_cic_eth.sh @@ -1,6 +1,12 @@ #!/bin/bash # defaults +initlevel=`cat ${CIC_DATA_DIR}/.init` +echo $inilevel +if [ $initlevel -lt 2 ]; then + >&2 echo "initlevel too low $initlevel" + exit 1 +fi source ${CIC_DATA_DIR}/.env source ${CIC_DATA_DIR}/.env_all DEV_PIP_EXTRA_INDEX_URL=${DEV_PIP_EXTRA_INDEX_URL:-https://pip.grassrootseconomics.net:8433} @@ -136,7 +142,7 @@ token_description_two=0x54686973206973207468652053617261667520746f6b656e00000000 >&2 echo "add keystore account $keystore_file to accounts index writers" >&2 eth-accounts-index-add -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -r $CIC_ACCOUNTS_INDEX_ADDRESS --writer $DEV_ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER -w $debug -echo -n 2 > $init_level_file +echo -n 0 > $init_level_file set +a set +e diff --git a/docker-compose.yml b/docker-compose.yml index 36cd8a76..20d3d32e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -117,8 +117,14 @@ services: CELERY_RESULT_URL: ${CELERY_RESULT_URL:-redis://redis:6379} DEV_PIP_EXTRA_INDEX_URL: ${DEV_PIP_EXTRA_INDEX_URL:-https://pip.grassrootseconomics.net:8433} command: ["./seed_cic_eth.sh"] + deploy: + restart_policy: + condition: on-failure depends_on: - eth + - postgres + - redis + - cic-eth-tasker volumes: - contract-config:/tmp/cic/config