From 1b058f812af0e49e95e687d7472c4795f9eaa2b3 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Thu, 15 Nov 2018 11:02:31 +0100 Subject: [PATCH 1/3] Added --clean-all option to clean volumes and network --- README.md | 13 +++++++------ start_ocean.sh | 14 +++++++++++++- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 8e26832..6e3be70 100644 --- a/README.md +++ b/README.md @@ -61,12 +61,13 @@ http://localhost:3000 The script provides the following options: -Option | Description ---- | --- +Option | Description +--- | --- `--latest` | Get the `latest` versions of all components, referring to their `develop` branches. `--no-pleuston` | Start up Ocean without an instance of `pleuston`. Helpful for development on `pleuston`. `--local-parity-node` | Runs a local parity POA node and Secret Store instead of ganache-cli. `--reuse-database` | Start up Ocean and reuse the Database from ganache. Helpful for development. +`--clean-all` | Remove the volumes, local folder and networks used by the script. For example, the following command would run the latest version of the stack, without Pleuston and with the Parity + Secret Store nodes: @@ -102,8 +103,8 @@ export REUSE_DATABASE="true" docker-compose --project-name=ocean -f docker-compose-no-pleuston.yml up ``` -Variable | Description ---- | --- +Variable | Description +--- | --- `REUSE_DATABASE` | The keeper-contracts component runs with ganache by default and every run will produce and deploy new instances of the keeper contracts. Ganache can be run with a specific database path by setting the env var `REUSE_DATABASE` to `"true"`. By default, the ganache database will be setup in the cwd. `DEPLOY_CONTRACTS` | skip deploying smart contracts by setting this to `"false"`, in this case `REUSE_DATABASE` should be set to `"true"` in the previous run when using ganache `KEEPER_NETWORK_NAME` | set to one of `"ganache"` (default), `"kovan"`, or `"ocean_poa_net_local"` @@ -111,8 +112,8 @@ Variable | Description A subset of the components can be run by modifying the docker-compose file directly or by using one of the other pre-built compose files: -Compose file | Description ---- | --- +Compose file | Description +--- | --- `docker-compose-no-pleuston.yml` | runs all components without the pleuston. This is useful for developing/debugging the front-end app. So first the docker compose container can be started then pleuston can be started separately from source. You can also use `./start_ocean.sh --no-pleuston` to do this `docker-compose-local-parity-node.yml` | similar to the above with no pleuston, but runs a local parity POA node instead of ganache-cli. You can also use `./start_ocean.sh --local-parity-node` instead diff --git a/start_ocean.sh b/start_ocean.sh index 6b5ff17..d10dbe5 100755 --- a/start_ocean.sh +++ b/start_ocean.sh @@ -8,6 +8,7 @@ export REUSE_DATABASE="false" # Specify which ethereum client to run or connect to: kovan, ganache, or ocean_poa_net_local export KEEPER_NETWORK_NAME="ganache" export ARTIFACTS_FOLDER=~/.ocean/keeper-contracts/artifacts +export PROJECT_NAME="ocean" # colors COLOR_R="\033[0;31m" # red @@ -51,6 +52,17 @@ while :; do COMPOSE_FILE='docker-compose-local-parity-node.yml' printf $COLOR_Y'Starting with local Parity node...\n\n'$COLOR_RESET ;; + --clean-all) + docker network rm $PROJECT_NAME_backend || true + docker volume rm $PROJECT_NAME_parity-node || true + docker volume rm $PROJECT_NAME_secret-store || true + read -p "Are you sure you want to delete $ARTIFACTS_FOLDER? " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]] + then + rm -rf $ARTIFACTS_FOLDER + fi + ;; --) # End of all options. shift break @@ -61,7 +73,7 @@ while :; do ;; *) printf $COLOR_Y'Starting Ocean...\n\n'$COLOR_RESET - docker-compose --project-name=ocean -f $COMPOSE_FILE up + docker-compose --project-name=$PROJECT_NAME -f $COMPOSE_FILE up break esac shift From e8ec5608a8a765bdf59584f87d48aefee604d3f9 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 30 Nov 2018 10:27:36 +0100 Subject: [PATCH 2/3] Fixed parity-node container not exists in all compose --- docker-compose-local-parity-node.yml | 2 -- docker-compose-no-pleuston.yml | 4 ++-- docker-compose.yml | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/docker-compose-local-parity-node.yml b/docker-compose-local-parity-node.yml index a1c742f..137f6a8 100644 --- a/docker-compose-local-parity-node.yml +++ b/docker-compose-local-parity-node.yml @@ -1,7 +1,5 @@ version: '2.1' -# Run: docker-compose --project-name=ocean up - services: mongodb: image: mongo:3.6 diff --git a/docker-compose-no-pleuston.yml b/docker-compose-no-pleuston.yml index f716e07..7b5f94d 100644 --- a/docker-compose-no-pleuston.yml +++ b/docker-compose-no-pleuston.yml @@ -1,7 +1,5 @@ version: '2.1' -# Run: docker-compose --project-name=ocean up - services: mongodb: image: mongo:3.6 @@ -52,6 +50,8 @@ services: - keeper-contracts env_file: - ${BRIZO_ENV_FILE} + environment: + KEEPER_URL: http://keeper-contracts:8545 volumes: - ${ARTIFACTS_FOLDER}:/usr/local/keeper-contracts/:ro diff --git a/docker-compose.yml b/docker-compose.yml index 7d46799..3e05634 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,5 @@ version: '2.1' -# Run: docker-compose --project-name=ocean up - services: mongodb: image: mongo:3.6 @@ -52,6 +50,8 @@ services: - keeper-contracts env_file: - ${BRIZO_ENV_FILE} + environment: + KEEPER_URL: "http://keeper-contracts:8545" volumes: - ${ARTIFACTS_FOLDER}:/usr/local/keeper-contracts/:ro From 502d556389eea35c54520badd20c4a075798c2a0 Mon Sep 17 00:00:00 2001 From: Javier Cortejoso Date: Fri, 30 Nov 2018 16:22:10 +0100 Subject: [PATCH 3/3] Deploy contracts enable again --- start_ocean.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start_ocean.sh b/start_ocean.sh index 9702e9f..6568dc1 100755 --- a/start_ocean.sh +++ b/start_ocean.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Must be set to true for the first run, change it to "false" to avoid migrating the smart contracts on each run. -export DEPLOY_CONTRACTS="false" +export DEPLOY_CONTRACTS="true" # Ganache specific option, these two options have no effect when not running ganache-cli export GANACHE_DATABASE_PATH="." export REUSE_DATABASE="false"