2019-05-31 17:24:45 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
cd $(dirname $0)
|
2019-06-04 15:49:39 +03:00
|
|
|
set -e # exit when any command fails
|
2019-05-31 17:24:45 +03:00
|
|
|
|
|
|
|
./down.sh
|
2020-07-14 17:53:05 +03:00
|
|
|
docker-compose build parity1 parity2
|
2020-09-02 17:43:48 +03:00
|
|
|
|
|
|
|
if [ -z "$CI" ]; then
|
|
|
|
./build.sh $@
|
|
|
|
else
|
|
|
|
./pull.sh $@
|
|
|
|
fi
|
|
|
|
|
2019-07-26 11:14:25 +03:00
|
|
|
docker network create --driver bridge ultimate || true
|
2019-07-16 17:12:33 +03:00
|
|
|
docker-compose up -d parity1 parity2 e2e
|
2019-05-31 17:24:45 +03:00
|
|
|
|
2020-01-20 23:00:04 +03:00
|
|
|
startValidator () {
|
2021-05-09 16:34:19 +03:00
|
|
|
db_env="-e ORACLE_QUEUE_URL=amqp://$4 -e ORACLE_REDIS_URL=redis://$3"
|
|
|
|
|
|
|
|
docker-compose $1 run -d --name $3 redis
|
|
|
|
docker-compose $1 run -d --name $4 rabbit
|
|
|
|
|
2020-10-31 21:02:56 +03:00
|
|
|
if [[ -z "$MODE" || "$MODE" == erc-to-native ]]; then
|
2021-05-09 16:34:19 +03:00
|
|
|
docker-compose $1 run $2 $db_env -d oracle-erc20-native yarn watcher:signature-request
|
|
|
|
docker-compose $1 run $2 $db_env -d oracle-erc20-native yarn watcher:collected-signatures
|
|
|
|
docker-compose $1 run $2 $db_env -d oracle-erc20-native yarn watcher:affirmation-request
|
|
|
|
docker-compose $1 run $2 $db_env -d oracle-erc20-native yarn watcher:transfer
|
2020-10-31 21:02:56 +03:00
|
|
|
fi
|
|
|
|
if [[ -z "$MODE" || "$MODE" == amb ]]; then
|
2021-05-09 16:34:19 +03:00
|
|
|
docker-compose $1 run $2 $db_env -d oracle-amb yarn watcher:signature-request
|
|
|
|
docker-compose $1 run $2 $db_env -d oracle-amb yarn watcher:collected-signatures
|
|
|
|
docker-compose $1 run $2 $db_env -d oracle-amb yarn watcher:affirmation-request
|
|
|
|
docker-compose $1 run $2 $db_env -d oracle-amb yarn watcher:information-request
|
2020-10-31 21:02:56 +03:00
|
|
|
fi
|
2020-01-20 23:00:04 +03:00
|
|
|
|
2021-05-09 16:34:19 +03:00
|
|
|
docker-compose $1 run $2 $db_env -d oracle-amb yarn sender:home
|
|
|
|
docker-compose $1 run $2 $db_env -d oracle-amb yarn sender:foreign
|
|
|
|
docker-compose $1 run $2 $db_env -d oracle-amb yarn manager:shutdown
|
2020-07-29 13:30:36 +03:00
|
|
|
}
|
|
|
|
|
2019-05-31 17:24:45 +03:00
|
|
|
while [ "$1" != "" ]; do
|
|
|
|
if [ "$1" == "oracle" ]; then
|
2021-05-09 16:34:19 +03:00
|
|
|
startValidator "-p validator1" "" redis rabbit
|
2019-05-31 17:24:45 +03:00
|
|
|
fi
|
|
|
|
|
2020-01-20 23:00:04 +03:00
|
|
|
if [ "$1" == "oracle-validator-2" ]; then
|
|
|
|
oracle2Values="-e ORACLE_VALIDATOR_ADDRESS=0xdCC784657C78054aa61FbcFFd2605F32374816A4 -e ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=5a5c3645d0f04e9eb4f27f94ed4c244a225587405b8838e7456f7781ce3a9513"
|
2021-05-09 16:34:19 +03:00
|
|
|
startValidator "-p validator2" "$oracle2Values" redis2 rabbit2
|
2020-01-20 23:00:04 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" == "oracle-validator-3" ]; then
|
|
|
|
oracle3Values="-e ORACLE_VALIDATOR_ADDRESS=0xDcef88209a20D52165230104B245803C3269454d -e ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=f877f62a1c19f852cff1d29f0fb1ecac18821c0080d4cc0520c60c098293dca1"
|
2021-05-09 16:34:19 +03:00
|
|
|
startValidator "-p validator3" "$oracle3Values" redis3 rabbit3
|
2020-01-20 23:00:04 +03:00
|
|
|
fi
|
|
|
|
|
2020-07-29 13:30:36 +03:00
|
|
|
if [ "$1" == "alm" ]; then
|
|
|
|
docker-compose up -d alm
|
|
|
|
|
|
|
|
docker-compose run -d -p 3004:3000 alm serve -p 3000 -s .
|
|
|
|
fi
|
|
|
|
|
2019-06-03 14:47:52 +03:00
|
|
|
if [ "$1" == "deploy" ]; then
|
|
|
|
docker-compose run e2e e2e-commons/scripts/deploy.sh
|
|
|
|
fi
|
|
|
|
|
2019-06-03 16:49:40 +03:00
|
|
|
if [ "$1" == "blocks" ]; then
|
2020-02-11 20:50:34 +03:00
|
|
|
docker-compose up -d blocks
|
2019-06-03 16:49:40 +03:00
|
|
|
fi
|
|
|
|
|
2019-06-27 10:57:45 +03:00
|
|
|
if [ "$1" == "monitor" ]; then
|
2020-11-04 22:16:43 +03:00
|
|
|
case "$MODE" in
|
|
|
|
amb)
|
|
|
|
docker-compose up -d monitor-amb
|
|
|
|
;;
|
|
|
|
erc-to-native)
|
|
|
|
docker-compose up -d monitor-erc20-native
|
|
|
|
;;
|
|
|
|
*)
|
2021-05-08 18:50:46 +03:00
|
|
|
docker-compose up -d monitor-erc20-native monitor-amb
|
2020-11-04 22:16:43 +03:00
|
|
|
;;
|
|
|
|
esac
|
2019-06-27 10:57:45 +03:00
|
|
|
fi
|
|
|
|
|
2020-07-29 13:30:36 +03:00
|
|
|
if [ "$1" == "alm-e2e" ]; then
|
2021-05-09 16:34:19 +03:00
|
|
|
MODE=amb
|
|
|
|
|
|
|
|
startValidator "-p validator1" "" redis rabbit
|
2020-07-29 13:30:36 +03:00
|
|
|
|
|
|
|
oracle2Values="-e ORACLE_VALIDATOR_ADDRESS=0xdCC784657C78054aa61FbcFFd2605F32374816A4 -e ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=5a5c3645d0f04e9eb4f27f94ed4c244a225587405b8838e7456f7781ce3a9513"
|
2021-05-09 16:34:19 +03:00
|
|
|
startValidator "-p validator2" "$oracle2Values" redis2 rabbit2
|
2020-07-29 13:30:36 +03:00
|
|
|
|
|
|
|
oracle3Values="-e ORACLE_VALIDATOR_ADDRESS=0xDcef88209a20D52165230104B245803C3269454d -e ORACLE_VALIDATOR_ADDRESS_PRIVATE_KEY=f877f62a1c19f852cff1d29f0fb1ecac18821c0080d4cc0520c60c098293dca1"
|
2021-05-09 16:34:19 +03:00
|
|
|
startValidator "-p validator3" "$oracle3Values" redis3 rabbit3
|
2020-07-29 13:30:36 +03:00
|
|
|
fi
|
|
|
|
|
2019-05-31 17:24:45 +03:00
|
|
|
shift # Shift all the parameters down by one
|
|
|
|
done
|