From 164f21d9eb68abd5b21946555956aaacf1a0c60c Mon Sep 17 00:00:00 2001 From: rzadp Date: Fri, 31 May 2019 16:24:45 +0200 Subject: [PATCH] Introducing common docker-compose --- {ui-e2e => e2e-commons}/docker-compose.yml | 6 +- e2e-commons/down.sh | 5 + e2e-commons/up.sh | 30 ++++++ oracle-e2e/docker-compose.yml | 110 --------------------- oracle-e2e/run-tests.sh | 19 +--- 5 files changed, 42 insertions(+), 128 deletions(-) rename {ui-e2e => e2e-commons}/docker-compose.yml (99%) create mode 100755 e2e-commons/down.sh create mode 100755 e2e-commons/up.sh delete mode 100644 oracle-e2e/docker-compose.yml diff --git a/ui-e2e/docker-compose.yml b/e2e-commons/docker-compose.yml similarity index 99% rename from ui-e2e/docker-compose.yml rename to e2e-commons/docker-compose.yml index 166458fd..5352da21 100644 --- a/ui-e2e/docker-compose.yml +++ b/e2e-commons/docker-compose.yml @@ -16,7 +16,7 @@ services: image: "rabbitmq:3-management" ports: - "15672:15672" - bridge: + oracle: build: context: .. dockerfile: oracle/Dockerfile @@ -45,7 +45,7 @@ services: - FOREIGN_POLLING_INTERVAL=500 - ALLOW_HTTP=yes command: "true" - bridge-erc20: + oracle-erc20: build: context: .. dockerfile: oracle/Dockerfile @@ -75,7 +75,7 @@ services: - FOREIGN_POLLING_INTERVAL=500 - ALLOW_HTTP=yes command: "true" - bridge-erc20-native: + oracle-erc20-native: build: context: .. dockerfile: oracle/Dockerfile diff --git a/e2e-commons/down.sh b/e2e-commons/down.sh new file mode 100755 index 00000000..4456352a --- /dev/null +++ b/e2e-commons/down.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +cd $(dirname $0) + +ps | grep node | grep -v grep | awk '{print "kill " $1}' | sh +docker-compose down diff --git a/e2e-commons/up.sh b/e2e-commons/up.sh new file mode 100755 index 00000000..88d1b371 --- /dev/null +++ b/e2e-commons/up.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +cd $(dirname $0) + +./down.sh +docker-compose build +docker-compose up -d parity1 parity2 redis rabbit e2e + +while [ "$1" != "" ]; do + if [ "$1" == "oracle" ]; then + docker-compose up -d oracle oracle-erc20 oracle-erc20-native + + docker-compose run -d oracle yarn watcher:signature-request + docker-compose run -d oracle yarn watcher:collected-signatures + docker-compose run -d oracle yarn watcher:affirmation-request + docker-compose run -d oracle-erc20 yarn watcher:signature-request + docker-compose run -d oracle-erc20 yarn watcher:collected-signatures + docker-compose run -d oracle-erc20 yarn watcher:affirmation-request + docker-compose run -d oracle-erc20-native yarn watcher:signature-request + docker-compose run -d oracle-erc20-native yarn watcher:collected-signatures + docker-compose run -d oracle-erc20-native yarn watcher:affirmation-request + docker-compose run -d oracle yarn sender:home + docker-compose run -d oracle yarn sender:foreign + fi + + if [ "$1" == "ui" ]; then + docker-compose up -d ui ui-erc20 ui-erc20-native + fi + + shift # Shift all the parameters down by one +done diff --git a/oracle-e2e/docker-compose.yml b/oracle-e2e/docker-compose.yml deleted file mode 100644 index 5b924365..00000000 --- a/oracle-e2e/docker-compose.yml +++ /dev/null @@ -1,110 +0,0 @@ -version: '3' -services: - parity1: - build: ../parity - ports: - - "8541:8545" - parity2: - build: ../parity - ports: - - "8542:8545" - redis: - image: "redis:4" - rabbit: - image: "rabbitmq:3-management" - ports: - - "15672:15672" - bridge: - build: - context: .. - dockerfile: oracle/Dockerfile - environment: - - NODE_ENV=production - - BRIDGE_MODE=NATIVE_TO_ERC - - QUEUE_URL=amqp://rabbit - - REDIS_URL=redis://redis - - HOME_RPC_URL=http://parity1:8545 - - FOREIGN_RPC_URL=http://parity2:8545 - - HOME_BRIDGE_ADDRESS=0x32198D570fffC7033641F8A9094FFDCaAEF42624 - - FOREIGN_BRIDGE_ADDRESS=0x2B6871b9B02F73fa24F4864322CdC78604207769 - - ERC20_TOKEN_ADDRESS=0xdbeE25CbE97e4A5CC6c499875774dc7067E9426B - - VALIDATOR_ADDRESS=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b - - VALIDATOR_ADDRESS_PRIVATE_KEY=8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9 - - REDIS_LOCK_TTL=1000 - - HOME_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/ - - HOME_GAS_PRICE_SPEED_TYPE=standard - - HOME_GAS_PRICE_FALLBACK=1000000000 - - HOME_GAS_PRICE_UPDATE_INTERVAL=600000 - - FOREIGN_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/ - - FOREIGN_GAS_PRICE_SPEED_TYPE=standard - - FOREIGN_GAS_PRICE_FALLBACK=10000000000 - - FOREIGN_GAS_PRICE_UPDATE_INTERVAL=600000 - - HOME_POLLING_INTERVAL=500 - - FOREIGN_POLLING_INTERVAL=500 - - ALLOW_HTTP=yes - command: "true" - bridge-erc: - build: - context: .. - dockerfile: oracle/Dockerfile - environment: - - NODE_ENV=production - - BRIDGE_MODE=ERC_TO_ERC - - QUEUE_URL=amqp://rabbit - - REDIS_URL=redis://redis - - HOME_RPC_URL=http://parity1:8545 - - FOREIGN_RPC_URL=http://parity2:8545 - - HOME_BRIDGE_ADDRESS=0x1feB40aD9420b186F019A717c37f5546165d411E - - FOREIGN_BRIDGE_ADDRESS=0x4a58D6d8D416a5fBCAcf3dC52eb8bE8948E25127 - - ERC20_TOKEN_ADDRESS=0x3C665A31199694Bf723fD08844AD290207B5797f - - BRIDGEABLE_TOKEN_ADDRESS=0x792455a6bCb62Ed4C4362D323E0590654CA4765c - - VALIDATOR_ADDRESS=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b - - VALIDATOR_ADDRESS_PRIVATE_KEY=8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9 - - REDIS_LOCK_TTL=1000 - - HOME_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/ - - HOME_GAS_PRICE_SPEED_TYPE=standard - - HOME_GAS_PRICE_FALLBACK=1000000000 - - HOME_GAS_PRICE_UPDATE_INTERVAL=600000 - - FOREIGN_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/ - - FOREIGN_GAS_PRICE_SPEED_TYPE=standard - - FOREIGN_GAS_PRICE_FALLBACK=10000000000 - - FOREIGN_GAS_PRICE_UPDATE_INTERVAL=600000 - - HOME_POLLING_INTERVAL=500 - - FOREIGN_POLLING_INTERVAL=500 - - ALLOW_HTTP=yes - command: "true" - bridge-erc-native: - build: - context: .. - dockerfile: oracle/Dockerfile - environment: - - NODE_ENV=production - - BRIDGE_MODE=ERC_TO_NATIVE - - QUEUE_URL=amqp://rabbit - - REDIS_URL=redis://redis - - HOME_RPC_URL=http://parity1:8545 - - FOREIGN_RPC_URL=http://parity2:8545 - - HOME_BRIDGE_ADDRESS=0x488Af810997eD1730cB3a3918cD83b3216E6eAda - - FOREIGN_BRIDGE_ADDRESS=0x488Af810997eD1730cB3a3918cD83b3216E6eAda - - ERC20_TOKEN_ADDRESS=0x3C665A31199694Bf723fD08844AD290207B5797f - - BRIDGEABLE_TOKEN_ADDRESS=0x792455a6bCb62Ed4C4362D323E0590654CA4765c - - VALIDATOR_ADDRESS=0xaaB52d66283F7A1D5978bcFcB55721ACB467384b - - VALIDATOR_ADDRESS_PRIVATE_KEY=8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9 - - REDIS_LOCK_TTL=1000 - - HOME_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/ - - HOME_GAS_PRICE_SPEED_TYPE=standard - - HOME_GAS_PRICE_FALLBACK=1000000000 - - HOME_GAS_PRICE_UPDATE_INTERVAL=600000 - - FOREIGN_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/ - - FOREIGN_GAS_PRICE_SPEED_TYPE=standard - - FOREIGN_GAS_PRICE_FALLBACK=10000000000 - - FOREIGN_GAS_PRICE_UPDATE_INTERVAL=600000 - - HOME_POLLING_INTERVAL=500 - - FOREIGN_POLLING_INTERVAL=500 - - ALLOW_HTTP=yes - command: "true" - e2e: - build: - context: .. - dockerfile: Dockerfile.e2e - command: "true" diff --git a/oracle-e2e/run-tests.sh b/oracle-e2e/run-tests.sh index 188b866a..e5211883 100755 --- a/oracle-e2e/run-tests.sh +++ b/oracle-e2e/run-tests.sh @@ -1,21 +1,10 @@ cd $(dirname $0) -docker-compose down -docker-compose up -d --build --force-recreate +../e2e-commons/up.sh oracle -docker-compose run e2e yarn workspace oracle-e2e run deploy -docker-compose run -d bridge yarn watcher:signature-request -docker-compose run -d bridge yarn watcher:collected-signatures -docker-compose run -d bridge yarn watcher:affirmation-request -docker-compose run -d bridge-erc yarn watcher:signature-request -docker-compose run -d bridge-erc yarn watcher:collected-signatures -docker-compose run -d bridge-erc yarn watcher:affirmation-request -docker-compose run -d bridge-erc-native yarn watcher:signature-request -docker-compose run -d bridge-erc-native yarn watcher:collected-signatures -docker-compose run -d bridge-erc-native yarn watcher:affirmation-request -docker-compose run -d bridge yarn sender:home -docker-compose run -d bridge yarn sender:foreign -docker-compose run e2e yarn workspace oracle-e2e run start +docker-compose -f ../e2e-commons/docker-compose.yml run e2e yarn workspace oracle-e2e run deploy + +docker-compose -f ../e2e-commons/docker-compose.yml run e2e yarn workspace oracle-e2e run start rc=$? docker-compose down