Merge pull request #32 from oceanprotocol/feature/default-stable

Dolphins and colors, default to stable components
This commit is contained in:
Matthias Kretschmann 2018-10-10 13:12:39 +02:00 committed by GitHub
commit 8f4701cd5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 115 additions and 40 deletions

26
.banner Normal file
View File

@ -0,0 +1,26 @@
Welcome to
,-._
_.-' '--.
.' _ -`\_
/ .----.`_.'----'
;/ `
/_;
._ ._ ._ ._
_.-._)`\_.-._)`\_.-._)`\_.-._)`\_.-._
___ ___ _ _
/ _ \ __ ___ __ _ _ _ | _ \_ _ ___| |_ ___ __ ___| |
| (_) / _/ -_) _` | ' \ | _/ '_/ _ \ _/ _ \/ _/ _ \ |
\___/\__\___\__,_|_||_| |_| |_| \___/\__\___/\__\___/_|
---
Get info: oceanprotocol.com
Get code: github.com/oceanprotocol
Get help: gitter.im/oceanprotocol/Lobby
---

View File

@ -13,12 +13,13 @@
## Table of Contents
* [Prerequisites](#prerequisites)
* [Get Started](#get-started)
* [Ocean Protocol components](#ocean-protocol-components)
- [Versions](#versions)
* [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)
---
@ -31,23 +32,23 @@ 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
cd docker-images/
./start_ocean.sh
```
Or
<img width="535" alt="screen shot 2018-10-10 at 12 20 48" src="https://user-images.githubusercontent.com/90316/46729966-22206600-cc87-11e8-9e1a-156d8a6c5e43.png">
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:
@ -56,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:
@ -66,30 +77,28 @@ The Ocean Docker compose starts the following components:
![Ocean Protocol Components](doc/img/ocean-components@2x.png)
### Versions
### Environment Variables
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:
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.:
```bash
export OCEAN_VERSION=latest
docker-compose --project-name=ocean up
export REUSE_DATABASE="true"
docker-compose --project-name=ocean -f docker-compose-no-pleuston.yml up
```
### Options
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.
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.
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:
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"
* 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
* `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

View File

@ -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,16 +9,57 @@ export REUSE_DATABASE="false"
export KEEPER_NETWORK_NAME="ganache"
export ARTIFACTS_FOLDER=~/.ocean/keeper-contracts/artifacts
if [ "$1" == "--no-pleuston" ]; then
# 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
export REUSE_DATABASE="true"
docker-compose --project-name=ocean -f docker-compose-no-pleuston.yml up
# reset
COLOR_RESET="\033[00m"
elif [ "$1" == "--local-parity-node" ]; then
function show_banner {
local output=$(cat .banner)
echo -e "$COLOR_B$output$COLOR_RESET"
echo ""
}
export KEEPER_NETWORK_NAME="ocean_poa_net_local"
docker-compose --project-name=ocean -f docker-compose-local-parity-node.yml up
show_banner
else
docker-compose --project-name=ocean up
fi
# default to stable versions
export OCEAN_VERSION=stable
COMPOSE_FILE='docker-compose.yml'
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