Merge branch 'bvander/contract-migration-refactor' into 'master'
contract migration refactor See merge request grassrootseconomics/cic-internal-integration!70
This commit is contained in:
commit
992c5f3c00
@ -52,8 +52,6 @@ RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh |
|
||||
ENV NODE_PATH $NVM_DIR/versions/node//v$NODE_VERSION/lib/node_modules
|
||||
ENV PATH $NVM_DIR/versions/node//v$NODE_VERSION/bin:$PATH
|
||||
|
||||
# RUN pip install --user --extra-index-url $pip_extra_index_url cic-base[full_graph]==$cic_base_version
|
||||
|
||||
RUN useradd --create-home grassroots
|
||||
WORKDIR /home/grassroots
|
||||
USER grassroots
|
||||
@ -123,16 +121,13 @@ COPY --from=compile-image /home/grassroots/.local .local
|
||||
ENV PATH=/home/grassroots/.local/bin:$PATH
|
||||
|
||||
COPY contract-migration/testdata/pgp testdata/pgp
|
||||
COPY contract-migration/wait-for-it.sh .
|
||||
COPY contract-migration/reset.sh reset.sh
|
||||
COPY contract-migration/from_env.sh from_env.sh
|
||||
COPY contract-migration/seed_cic_eth.sh seed_cic_eth.sh
|
||||
COPY contract-migration/sarafu_declaration.json sarafu_declaration.json
|
||||
COPY contract-migration/keystore keystore
|
||||
COPY contract-migration/envlist .
|
||||
COPY contract-migration/*.sh ./
|
||||
|
||||
# RUN chown grassroots:grassroots .local/
|
||||
RUN chown grassroots:grassroots ./
|
||||
RUN chown grassroots:grassroots ./*
|
||||
RUN chmod gu+x *.sh
|
||||
|
||||
RUN mkdir -p /tmp/cic/config
|
||||
|
@ -19,6 +19,12 @@ echo \n
|
||||
# pushd /usr/src
|
||||
|
||||
init_level_file=${CIC_DATA_DIR}/.init
|
||||
if [ ! -f ${CIC_DATA_DIR}/.init ]; then
|
||||
echo "Creating .init file..."
|
||||
mkdir -p $CIC_DATA_DIR
|
||||
touch /tmp/cic/config/.init
|
||||
# touch $init_level_file
|
||||
fi
|
||||
echo -n 1 > $init_level_file
|
||||
|
||||
# Abort on any error (including if wait-for-it fails).
|
||||
@ -61,7 +67,7 @@ export DEV_ETH_ACCOUNTS_INDEX_ADDRESS=$CIC_ACCOUNTS_INDEX_ADDRESS
|
||||
export BANCOR_REGISTRY_ADDRESS=$BANCOR_REGISTRY_ADDRESS
|
||||
export CIC_REGISTRY_ADDRESS=$CIC_REGISTRY_ADDRESS
|
||||
export CIC_TRUST_ADDRESS=$DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER
|
||||
|
||||
export CIC_DECLARATOR_ADDRESS=$CIC_DECLARATOR_ADDRESS
|
||||
EOF
|
||||
|
||||
cat ./envlist | bash from_env.sh > $CIC_DATA_DIR/.env_all
|
||||
|
11
apps/contract-migration/run_job.sh
Normal file
11
apps/contract-migration/run_job.sh
Normal file
@ -0,0 +1,11 @@
|
||||
#! /bin/bash
|
||||
|
||||
if [[ $RUN_LEVEL -gt 0 ]]
|
||||
then
|
||||
./reset.sh
|
||||
fi
|
||||
|
||||
if [[ $RUN_LEVEL -gt 1 ]]
|
||||
then
|
||||
./seed_cic_eth.sh
|
||||
fi
|
@ -26,6 +26,7 @@ env_out_file=${CIC_DATA_DIR}/.env_seed
|
||||
init_level_file=${CIC_DATA_DIR}/.init
|
||||
truncate $env_out_file -s 0
|
||||
|
||||
pip install --extra-index-url https://pip.grassrootseconomics.net:8433 chainlib==0.0.1a22
|
||||
|
||||
set -e
|
||||
set -a
|
||||
@ -125,6 +126,7 @@ export CIC_TOKEN_INDEX_ADDRESS=$CIC_TOKEN_INDEX_ADDRESS
|
||||
>&2 echo "add declarations for sarafu token"
|
||||
token_description_one=`sha256sum sarafu_declaration.json | awk '{ print $1; }'`
|
||||
token_description_two=0x54686973206973207468652053617261667520746f6b656e0000000000000000
|
||||
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> foo $CIC_DECLARATOR_ADDRESSh"
|
||||
>&2 eth-address-declarator-add -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -r $CIC_DECLARATOR_ADDRESS -w $debug $DEV_ETH_SARAFU_TOKEN_ADDRESS $token_description_one
|
||||
>&2 eth-address-declarator-add -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -r $CIC_DECLARATOR_ADDRESS -w $debug $DEV_ETH_SARAFU_TOKEN_ADDRESS $token_description_two
|
||||
|
||||
|
@ -77,24 +77,6 @@ services:
|
||||
- bee-data:/tmp/cic/bee
|
||||
|
||||
contract-migration:
|
||||
build:
|
||||
context: apps/
|
||||
dockerfile: contract-migration/docker/Dockerfile
|
||||
environment:
|
||||
# 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)
|
||||
ETH_PROVIDER_HOST: eth
|
||||
ETH_PROVIDER_PORT: 8545
|
||||
CIC_CHAIN_SPEC: ${CIC_CHAIN_SPEC:-evm:bloxberg:8996}
|
||||
CIC_DATA_DIR: ${CIC_DATA_DIR:-/tmp/cic/config}
|
||||
command: ["./reset.sh"]
|
||||
depends_on:
|
||||
- eth
|
||||
volumes:
|
||||
- contract-config:/tmp/cic/config
|
||||
|
||||
seed-cic-eth:
|
||||
build:
|
||||
context: apps/
|
||||
dockerfile: contract-migration/docker/Dockerfile
|
||||
@ -118,10 +100,8 @@ services:
|
||||
CELERY_BROKER_URL: ${CELERY_BROKER_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}
|
||||
command: ["./seed_cic_eth.sh"]
|
||||
# deploy:
|
||||
#restart_policy:
|
||||
# condition: on-failure
|
||||
RUN_LEVEL: 2 #0: noop 1: contract migrations 2: seed data
|
||||
command: ["./run_job.sh"]
|
||||
depends_on:
|
||||
- eth
|
||||
- postgres
|
||||
@ -130,7 +110,6 @@ services:
|
||||
volumes:
|
||||
- contract-config:/tmp/cic/config
|
||||
|
||||
|
||||
cic-cache-tracker:
|
||||
build:
|
||||
context: apps
|
||||
|
Loading…
Reference in New Issue
Block a user