From f70ffb8e6b9f0f808b93df1f6c46ca4b93e56752 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Tue, 2 Oct 2018 13:38:55 +0200 Subject: [PATCH 1/6] default to stable versions, make latest optional --- start_ocean.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/start_ocean.sh b/start_ocean.sh index e21eea9..77b3978 100755 --- a/start_ocean.sh +++ b/start_ocean.sh @@ -1,6 +1,5 @@ #!/usr/bin/env bash -export OCEAN_VERSION=latest # 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="true" # Ganache specific option, these two options have no effect when not running ganache-cli @@ -10,6 +9,14 @@ export REUSE_DATABASE="false" export KEEPER_NETWORK_NAME="ganache" export ARTIFACTS_FOLDER=~/.ocean/keeper-contracts/artifacts +# default to `stable` versions of all components +# unless `--latest` argument is given +if [ "$1" == "--latest" ]; then + export OCEAN_VERSION=latest +else + export OCEAN_VERSION=stable +fi + if [ "$1" == "--no-pleuston" ] then export REUSE_DATABASE="true" From e0b569f8c07700d44f84b9d5515ce0da51dce5b9 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Tue, 2 Oct 2018 13:42:18 +0200 Subject: [PATCH 2/6] update docs --- README.md | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 73a8956..b165b24 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,6 @@ * [Prerequisites](#prerequisites) * [Get Started](#get-started) * [Ocean Protocol components](#ocean-protocol-components) - - [Versions](#versions) * [Contributing](#contributing) * [License](#license) @@ -38,16 +37,14 @@ git clone git@github.com:oceanprotocol/docker-images.git cd docker-images/ ./start_ocean.sh - ``` -Or +This will bring up the `stable` versions of all components, referring to their respective `master` branches. + +To get the `latest` versions of all components, referring to their `develop` branches, pass the argument `--latest`: ```bash -git clone git@github.com:oceanprotocol/docker-images.git -cd docker-images/ - -docker-compose --project-name=ocean up +./start_ocean.sh --latest ``` After getting everything running, you can open the **Pleuston Frontend** application in your browser: @@ -66,29 +63,20 @@ The Ocean Docker compose starts the following components: ![Ocean Protocol Components](doc/img/ocean-components@2x.png) -### Versions - -The version of the Ocean components can be configured setting the environment variable `OCEAN_VERSION`. By default `master` branch runs the latest stable version release, and `develop` branch runs the code generated in the `master` branch of the Ocean components. If you want to run the component's code of `develop` branch: - -```bash -export OCEAN_VERSION=latest -docker-compose --project-name=ocean up -``` - ### Options 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. The following env vars enable some customization: + * 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" +* KEEPER_NETWORK_NAME: set to one of "ganache" (default), "kovan", or "ocean_poa_net_local" * ARTIFACTS_FOLDER: this is where the deployed smart contracts abi files will be available. This can be pointed at any path you like. When running a separate pleuston instance, it may be necessary to copy the abi files from this artifacts folder to the @oceanprotocol/keeper-contracts/artifacts folder in pleuston -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: -* `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 +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: + +* `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` is 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 ## Contributing From 2e1f2cd5d5838bedfc108ff6fec405563946001b Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Tue, 2 Oct 2018 13:50:34 +0200 Subject: [PATCH 3/6] yay, multiple arguments --- start_ocean.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start_ocean.sh b/start_ocean.sh index 77b3978..3c6dab4 100755 --- a/start_ocean.sh +++ b/start_ocean.sh @@ -11,7 +11,7 @@ export ARTIFACTS_FOLDER=~/.ocean/keeper-contracts/artifacts # default to `stable` versions of all components # unless `--latest` argument is given -if [ "$1" == "--latest" ]; then +if [ "$1" == "--latest" ] || [ "$2" == "--latest" ]; then export OCEAN_VERSION=latest else export OCEAN_VERSION=stable From d5101677071af0a1b2b4a6d552ec588577940567 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 10 Oct 2018 12:21:56 +0200 Subject: [PATCH 4/6] start script rewrite with options, banner, and colors --- .banner | 26 ++++++++++++++++++++ start_ocean.sh | 65 +++++++++++++++++++++++++++++++++++++------------- 2 files changed, 75 insertions(+), 16 deletions(-) create mode 100644 .banner diff --git a/.banner b/.banner new file mode 100644 index 0000000..03e6ae0 --- /dev/null +++ b/.banner @@ -0,0 +1,26 @@ + + + Welcome to + + ,-._ + _.-' '--. + .' _ -`\_ + / .----.`_.'----' + ;/ ` + /_; + + ._ ._ ._ ._ + _.-._)`\_.-._)`\_.-._)`\_.-._)`\_.-._ + ___ ___ _ _ + / _ \ __ ___ __ _ _ _ | _ \_ _ ___| |_ ___ __ ___| | + | (_) / _/ -_) _` | ' \ | _/ '_/ _ \ _/ _ \/ _/ _ \ | + \___/\__\___\__,_|_||_| |_| |_| \___/\__\___/\__\___/_| + + --- + + Get info: oceanprotocol.com + Get code: github.com/oceanprotocol + Get help: gitter.im/oceanprotocol/Lobby + + --- + diff --git a/start_ocean.sh b/start_ocean.sh index 787fd57..4dd8f0b 100755 --- a/start_ocean.sh +++ b/start_ocean.sh @@ -9,24 +9,57 @@ export REUSE_DATABASE="false" export KEEPER_NETWORK_NAME="ganache" export ARTIFACTS_FOLDER=~/.ocean/keeper-contracts/artifacts -# default to `stable` versions of all components -# unless `--latest` argument is given -if [ "$1" == "--latest" ] || [ "$2" == "--latest" ]; then - export OCEAN_VERSION=latest -else - export OCEAN_VERSION=stable -fi +# colors +COLOR_R="\033[0;31m" # red +COLOR_G="\033[0;32m" # green +COLOR_Y="\033[0;33m" # yellow +COLOR_B="\033[0;34m" # blue +COLOR_M="\033[0;35m" # magenta +COLOR_C="\033[0;36m" # cyan -if [ "$1" == "--no-pleuston" ]; then +# reset +COLOR_RESET="\033[00m" - export REUSE_DATABASE="true" - docker-compose --project-name=ocean -f docker-compose-no-pleuston.yml up +function show_banner { + local output=$(cat .banner) + echo -e "$COLOR_B$output$COLOR_RESET" + echo "" +} -elif [ "$1" == "--local-parity-node" ]; then +show_banner - export KEEPER_NETWORK_NAME="ocean_poa_net_local" - docker-compose --project-name=ocean -f docker-compose-local-parity-node.yml up +# default to stable versions +export OCEAN_VERSION=stable +COMPOSE_FILE='docker-compose.yml' -else - docker-compose --project-name=ocean up -fi \ No newline at end of file +while :; do + case $1 in + --latest) + export OCEAN_VERSION=latest + printf $COLOR_Y'Switched to latest components...\n\n'$COLOR_RESET + ;; + --no-pleuston) + export REUSE_DATABASE="true" + COMPOSE_FILE='docker-compose-no-pleuston.yml' + printf $COLOR_Y'Starting without Pleuston...\n\n'$COLOR_RESET + ;; + --local-parity-node) + export KEEPER_NETWORK_NAME="ocean_poa_net_local" + COMPOSE_FILE='docker-compose-local-parity-node.yml' + printf $COLOR_Y'Starting with local Parity node...\n\n'$COLOR_RESET + ;; + --) # End of all options. + shift + break + ;; + -?*) + printf $COLOR_R'WARN: Unknown option (ignored): %s\n'$COLOR_RESET "$1" >&2 + break + ;; + *) + printf $COLOR_Y'Starting Ocean...\n\n'$COLOR_RESET + docker-compose --project-name=ocean -f $COMPOSE_FILE up + break + esac + shift +done From fa0e52d65f44f893ec34c47f83e01eca9fe6ddae Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 10 Oct 2018 12:34:02 +0200 Subject: [PATCH 5/6] add output screenshot --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b165b24..527d54a 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,8 @@ cd docker-images/ ./start_ocean.sh ``` +screen shot 2018-10-10 at 12 20 48 + This will bring up the `stable` versions of all components, referring to their respective `master` branches. To get the `latest` versions of all components, referring to their `develop` branches, pass the argument `--latest`: From 434d4c22d0f5136c989b6aab05f8e83d4ba04f95 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 10 Oct 2018 12:53:16 +0200 Subject: [PATCH 6/6] document script options & environment variables --- README.md | 49 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 527d54a..5770ca5 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,13 @@ ## Table of Contents -* [Prerequisites](#prerequisites) -* [Get Started](#get-started) -* [Ocean Protocol components](#ocean-protocol-components) -* [Contributing](#contributing) -* [License](#license) + - [Prerequisites](#prerequisites) + - [Get Started](#get-started) + - [Script Options](#script-options) + - [Ocean Protocol components](#ocean-protocol-components) + - [Environment Variables](#environment-variables) + - [Contributing](#contributing) + - [License](#license) --- @@ -30,7 +32,7 @@ You need to have the newest versions available of both: ## Get Started -Then bring up an instance of the whole Ocean Protocol network stack with: +Then bring up an instance of the whole Ocean Protocol network stack with the `start_ocean.sh` script: ```bash git clone git@github.com:oceanprotocol/docker-images.git @@ -55,6 +57,16 @@ After getting everything running, you can open the **Pleuston Frontend** applica http://localhost:3000 ``` +### Script Options + +The script provides the following options: + +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 instead of ganache-cli. + ## Ocean Protocol components The Ocean Docker compose starts the following components: @@ -65,21 +77,28 @@ The Ocean Docker compose starts the following components: ![Ocean Protocol Components](doc/img/ocean-components@2x.png) -### Options +### Environment Variables -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. +The `start_ocean.sh` script sets defaults for the following environment variables but you can use these in combination with the Docker Compose files for further customization, e.g.: -The following env vars enable some customization: +```bash +export REUSE_DATABASE="true" +docker-compose --project-name=ocean -f docker-compose-no-pleuston.yml up +``` -* 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" -* ARTIFACTS_FOLDER: this is where the deployed smart contracts abi files will be available. This can be pointed at any path you like. When running a separate pleuston instance, it may be necessary to copy the abi files from this artifacts folder to the @oceanprotocol/keeper-contracts/artifacts folder in pleuston +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"` +`ARTIFACTS_FOLDER` | this is where the deployed smart contracts abi files will be available. This can be pointed at any path you like. 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: -* `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` is 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 +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 ## Contributing