data seeding waits on contract migration
This commit is contained in:
parent
f19b5a61ca
commit
6d957eea6e
@ -20,5 +20,5 @@ RUN --mount=type=cache,mode=0755,target=/root/.cache/pip pip install \
|
|||||||
--extra-index-url $EXTRA_INDEX_URL -r requirements.txt
|
--extra-index-url $EXTRA_INDEX_URL -r requirements.txt
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
RUN chmod +x scripts/*
|
||||||
ENTRYPOINT [ ]
|
ENTRYPOINT [ ]
|
||||||
|
12
apps/data-seeding/scripts/run_job.sh
Normal file
12
apps/data-seeding/scripts/run_job.sh
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
if [[ $((RUN_MASK & 3)) -eq 3 ]]
|
||||||
|
then
|
||||||
|
>&2 echo -e "\033[;96mRUNNING\033[;39m RUN_MASK 3 - data seeding"
|
||||||
|
./scripts/run_ussd_user_imports.sh
|
||||||
|
if [ $? -ne "0" ]; then
|
||||||
|
>&2 echo -e "\033[;31mFAILED\033[;39m RUN_MASK 3 - data seeding"
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
>&2 echo -e "\033[;32mSUCCEEDED\033[;39m RUN_MASK 3 - data seeding"
|
||||||
|
fi
|
@ -1,8 +1,33 @@
|
|||||||
#! /bin/sh
|
#! /bin/bash
|
||||||
|
|
||||||
set -u
|
set -u
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
contract_migration_complete=0
|
||||||
|
retry_count=0
|
||||||
|
retry_sleep=30 #seconds
|
||||||
|
retry_limit="$((${TIMEOUT_MINUTES:-10}*60/2))"
|
||||||
|
while [[ $contract_migration_complete -ne 1 ]]
|
||||||
|
do
|
||||||
|
if [[ -f "$CIC_DATA_DIR/.env" ]] && grep -q CIC_DECLARATOR_ADDRESS $CIC_DATA_DIR/.env
|
||||||
|
then
|
||||||
|
echo "🤜💥🤛 data-seeding found the output of contract-migration!"
|
||||||
|
source /tmp/cic/config/.env
|
||||||
|
env
|
||||||
|
contract_migration_complete=1
|
||||||
|
elif [[ $retry_count -ge $retry_limit ]]
|
||||||
|
then
|
||||||
|
echo "😢 data-seeding timeout waiting for contract migration to finish." >&2
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "⏳ data-seeding waiting for contract-migration output $retry_count:$retry_limit ..."
|
||||||
|
((retry_count= $retry_count + $retry_sleep))
|
||||||
|
sleep $retry_sleep
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while getopts ":n:o:g:" opt; do
|
while getopts ":n:o:g:" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
n) NUMBER_OF_USERS="$OPTARG"
|
n) NUMBER_OF_USERS="$OPTARG"
|
||||||
|
@ -85,8 +85,7 @@ services:
|
|||||||
REDIS_DB: ${REDIS_DB:-0}
|
REDIS_DB: ${REDIS_DB:-0}
|
||||||
CELERY_BROKER_URL: ${CELERY_BROKER_URL:-redis://redis:6379}
|
CELERY_BROKER_URL: ${CELERY_BROKER_URL:-redis://redis:6379}
|
||||||
CELERY_RESULT_URL: ${CELERY_RESULT_URL:-redis://redis:6379}
|
CELERY_RESULT_URL: ${CELERY_RESULT_URL:-redis://redis:6379}
|
||||||
DEV_PIP_EXTRA_INDEX_URL: ${DEV_PIP_EXTRA_INDEX_URL:-https://pip.grassrootseconomics.net:8433}
|
RUN_MASK: ${RUN_MASK:-0}
|
||||||
RUN_MASK: ${RUN_MASK:-0} # bit flags; 1: contract migrations 2: seed data
|
|
||||||
DEV_FAUCET_AMOUNT: ${DEV_FAUCET_AMOUNT:-0}
|
DEV_FAUCET_AMOUNT: ${DEV_FAUCET_AMOUNT:-0}
|
||||||
#DEV_SARAFU_DEMURRAGE_LEVEL: ${DEV_SARAFU_DEMURRAGE_LEVEL:-196454828847045000000000000000000}
|
#DEV_SARAFU_DEMURRAGE_LEVEL: ${DEV_SARAFU_DEMURRAGE_LEVEL:-196454828847045000000000000000000}
|
||||||
DEV_ETH_GAS_PRICE: ${DEV_ETH_GAS_PRICE:-1}
|
DEV_ETH_GAS_PRICE: ${DEV_ETH_GAS_PRICE:-1}
|
||||||
@ -109,6 +108,40 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- contract-config:/tmp/cic/config
|
- contract-config:/tmp/cic/config
|
||||||
|
|
||||||
|
data-seeding:
|
||||||
|
image: registry.gitlab.com/grassrootseconomics/cic-internal-integration/data-seeding
|
||||||
|
build:
|
||||||
|
context: apps/data-seeding
|
||||||
|
dockerfile: docker/Dockerfile
|
||||||
|
args:
|
||||||
|
pip_index_url: ${PIP_DEFAULT_INDEX_URL:-https://pypi.org/simple}
|
||||||
|
pip_extra_args: $PIP_EXTRA_ARGS
|
||||||
|
# image: registry.gitlab.com/grassrootseconomics/cic-internal-integration/contract-migration:latest
|
||||||
|
environment:
|
||||||
|
CIC_REGISTRY_ADDRESS: $CIC_REGISTRY_ADDRESS
|
||||||
|
# ETH_PROVIDER should be broken out into host/port but cic-eth expects this
|
||||||
|
ETH_PROVIDER: http://eth:8545
|
||||||
|
# And these two are for wait-for-it (could parse this)
|
||||||
|
CIC_DATA_DIR: ${CIC_DATA_DIR:-/tmp/cic/config}
|
||||||
|
DEV_USE_DOCKER_WAIT_SCRIPT: 1
|
||||||
|
ETH_PROVIDER_HOST: eth
|
||||||
|
ETH_PROVIDER_PORT: 8545
|
||||||
|
REDIS_HOST: ${REDIS_HOST:-redis}
|
||||||
|
REDIS_PORT: ${REDIS_PORT:-6379}
|
||||||
|
REDIS_DB: ${REDIS_DB:-0}
|
||||||
|
CELERY_BROKER_URL: ${CELERY_BROKER_URL:-redis://redis:6379}
|
||||||
|
CELERY_RESULT_URL: ${CELERY_RESULT_URL:-redis://redis:6379}
|
||||||
|
RUN_MASK: ${RUN_MASK:-0} # 7
|
||||||
|
TOKEN_SYMBOL: ${TOKEN_SYMBOL:-GFT}
|
||||||
|
USER_USSD_HOST: cic-user-ussd-server
|
||||||
|
USER_USSD_PORT: 9000
|
||||||
|
KEYSTORE_FILE_PATH: "/root/keystore/UTC--2021-01-08T17-18-44.521011372Z--eb3907ecad74a0013c259d5874ae7f22dcbcc95c"
|
||||||
|
OUT_DIR: out
|
||||||
|
NUMBER_OF_USERS: 10
|
||||||
|
command: ["bash", "./scripts/run_job.sh"]
|
||||||
|
volumes:
|
||||||
|
- contract-config:/tmp/cic/config
|
||||||
|
|
||||||
cic-cache-tracker:
|
cic-cache-tracker:
|
||||||
image: registry.gitlab.com/grassrootseconomics/cic-internal-integration/cic-cache
|
image: registry.gitlab.com/grassrootseconomics/cic-internal-integration/cic-cache
|
||||||
build:
|
build:
|
||||||
|
Loading…
Reference in New Issue
Block a user