diff --git a/README.md b/README.md index e09df77..bb7fb07 100644 --- a/README.md +++ b/README.md @@ -52,10 +52,13 @@ If you're new to Barge, it's best to do something like: git clone git@github.com:oceanprotocol/barge.git cd barge -./start_ocean.sh --local-spree-node --no-pleuston +./start_ocean.sh --no-pleuston ``` -with no `--latest` or `--stable` option. That will run the current default versions of Aquarius, Brizo and Keeper Contracts (listed in the table below). It will also run the _latest_ version of Pleuston and a local Spree node (explained more below). If you don't specify what kind of local node to run (e.g. using `--local-spree-node`) then the default is to run a local Nile node (i.e. `--local-nile-node`). +with no `--latest` or `--stable` option. +That will run the current default versions of Aquarius, Brizo and Keeper Contracts (listed in the table below). +It will also run the _latest_ version of Pleuston and a local Spree node (explained more below). +If you don't specify what kind of local node to run then the default is to run a local Spree network (i.e. `--local-spree-node`). The `--no-pleuston` option was included because, at the time of writing, Pleuston wasn't working with the default versions of the other components. @@ -90,8 +93,9 @@ Option | Description `--no-aquarius` | Start up Ocean without the `aquarius` Building Block. `--no-brizo` | Start up Ocean without the `brizo` Building Block. `--no-secret-store` | Start up Ocean without the `secret-store` Building Block. +`--elasticsearch` | Start up Ocean with ElasticSearch as DB engine for Aquarius instead of MongoDB. `--local-ganache-node` | Runs a local `ganache` node. -`--local-spree-node` | Runs a node of the local `spree` network. +`--local-spree-node` | Runs a node of the local `spree` network. This is the default. `--local-nile-node` | Runs a node of the `nile` network and connects the node to the `nile` network. `--local-kovan-node` | Runs a light node of the `kovan` network and connects the node to the `kovan` network. `--reuse-ganache-database` | Configures a running `ganache` node to use a persistent database. @@ -117,7 +121,8 @@ Hostname | External Port | Internal Url | Local Url | Des ### Aquarius -By default it will start two containers. This Building Block can be disabled by setting the `--no-aquarius` flag. +By default it will start two containers (one for aquarius and one for its database engine). By default Barge will use MongoDB as DB Engine. You can use option `--elasticsearch` to use ElasticSearch intead. +This Building Block can be disabled by setting the `--no-aquarius` flag. Hostname | External Port | Internal Url | Local Url | Description -----------|---------------|----------------------|-----------------------|-------------- @@ -141,13 +146,13 @@ Hostname | External Port | Internal Url | Local Url --------------|---------------|-------------------------|-----------------------|-------------- `keeper-node` | `8545` | http://keeper-node:8545 | http://localhost:8545 | An Ethereum RPC node -This node can be one of the following types (with the default being `nile`): +This node can be one of the following types (with the default being `spree`): Node | Description ----------|------------- `ganache` | Runs a local [ganache-cli](https://github.com/trufflesuite/ganache-cli) node that is not persistent by default. The contracts from the desired `keeper-contracts` version will be deployed upon launch of this node. -`spree` | Runs a local node of the Spree Network. See [Spree Network](#spree-network) for details. The contracts from the desired `keeper-contracts` version will be deployed upon launch of this node. -`nile` | This is the default. Runs a local node of the Nile Network and connects to the [Nile Testnet](https://docs.oceanprotocol.com/concepts/testnets/#nile-testnet). +`spree` | This is the default. Runs a local node of the Spree Network. See [Spree Network](#spree-network) for details. The contracts from the desired `keeper-contracts` version will be deployed upon launch of this node. +`nile` | Runs a local node of the Nile Network and connects to the [Nile Testnet](https://docs.oceanprotocol.com/concepts/testnets/#nile-testnet). `kovan` | Runs a local node of the Kovan Network and connects to the [Kovan Testnet](https://docs.oceanprotocol.com/concepts/testnets/#kovan-testnet). ### Secret Store diff --git a/compose-files/aquarius.yml b/compose-files/aquarius.yml index 6ec1c17..9491abb 100644 --- a/compose-files/aquarius.yml +++ b/compose-files/aquarius.yml @@ -1,4 +1,4 @@ -version: '2.1' +version: '3' services: aquarius: image: oceanprotocol/aquarius:$AQUARIUS_VERSION @@ -7,14 +7,14 @@ services: networks: backend: ipv4_address: 172.15.0.15 - depends_on: - - mongodb environment: - DB_HOSTNAME: mongodb - - mongodb: - image: mongo:3.6 - command: mongod - networks: - backend: - ipv4_address: 172.15.0.11 + DB_MODULE: ${DB_MODULE} + DB_HOSTNAME: ${DB_HOSTNAME} + DB_PORT: ${DB_PORT} + DB_USERNAME: ${DB_USERNAME} + DB_PASSWORD: ${DB_PASSWORD} + DB_SSL: ${DB_SSL} + DB_VERIFY_CERTS: ${DB_VERIFY_CERTS} + DB_CA_CERTS: ${DB_CA_CERTS} + DB_CLIENT_KEY: ${DB_CLIENT_KEY} + DB_CLIENT_CERT: ${DB_CLIENT_CERT} diff --git a/compose-files/aquarius_elasticsearch.yml b/compose-files/aquarius_elasticsearch.yml new file mode 100644 index 0000000..408b7ff --- /dev/null +++ b/compose-files/aquarius_elasticsearch.yml @@ -0,0 +1,30 @@ +version: '3' +services: + elasticsearch: + image: elasticsearch:6.4.1 + networks: + backend: + ipv4_address: 172.15.0.11 + environment: + ES_JAVA_OPTS: "-Xms500m -Xmx500m" + + aquarius: + image: oceanprotocol/aquarius:${AQUARIUS_VERSION:-stable} + ports: + - 5000:5000 + networks: + backend: + ipv4_address: 172.15.0.15 + depends_on: + - elasticsearch + environment: + DB_MODULE: ${DB_MODULE} + DB_HOSTNAME: ${DB_HOSTNAME} + DB_PORT: ${DB_PORT} + DB_USERNAME: ${DB_USERNAME} + DB_PASSWORD: ${DB_PASSWORD} + DB_SSL: ${DB_SSL} + DB_VERIFY_CERTS: ${DB_VERIFY_CERTS} + DB_CA_CERTS: ${DB_CA_CERTS} + DB_CLIENT_KEY: ${DB_CLIENT_KEY} + DB_CLIENT_CERT: ${DB_CLIENT_CERT} diff --git a/compose-files/aquarius_mongodb.yml b/compose-files/aquarius_mongodb.yml new file mode 100644 index 0000000..f729df5 --- /dev/null +++ b/compose-files/aquarius_mongodb.yml @@ -0,0 +1,21 @@ +version: '3' +services: + mongodb: + image: mongo:3.6 + command: mongod + networks: + backend: + ipv4_address: 172.15.0.11 + aquarius: + image: oceanprotocol/aquarius:${AQUARIUS_VERSION:-stable} + ports: + - 5000:5000 + networks: + backend: + ipv4_address: 172.15.0.15 + depends_on: + - mongodb + environment: + DB_MODULE: ${DB_MODULE} + DB_HOSTNAME: ${DB_HOSTNAME} + DB_PORT: ${DB_PORT} diff --git a/compose-files/brizo.yml b/compose-files/brizo.yml index 3459b3b..c201cec 100644 --- a/compose-files/brizo.yml +++ b/compose-files/brizo.yml @@ -1,4 +1,4 @@ -version: '2.1' +version: '3' services: brizo: image: oceanprotocol/brizo:$BRIZO_VERSION diff --git a/compose-files/keeper_contracts.yml b/compose-files/keeper_contracts.yml index 096cf50..721b3bd 100644 --- a/compose-files/keeper_contracts.yml +++ b/compose-files/keeper_contracts.yml @@ -1,4 +1,4 @@ -version: '2.1' +version: '3' services: keeper-contracts: image: oceanprotocol/keeper-contracts:$KEEPER_VERSION @@ -7,6 +7,7 @@ services: ipv4_address: 172.15.0.14 environment: NMEMORIC: ${KEEPER_MNEMONIC} + OWNER_ROLE_ADDRESS: ${KEEPER_OWNER_ROLE_ADDRESS} DEPLOY_CONTRACTS: ${KEEPER_DEPLOY_CONTRACTS} LOCAL_CONTRACTS: ${KEEPER_DEPLOY_CONTRACTS} REUSE_DATABASE: ${GANACHE_REUSE_DATABASE} diff --git a/compose-files/network_volumes.yml b/compose-files/network_volumes.yml index 14bf031..bf1ce3c 100644 --- a/compose-files/network_volumes.yml +++ b/compose-files/network_volumes.yml @@ -1,4 +1,4 @@ -version: '2.1' +version: '3' networks: backend: @@ -7,7 +7,6 @@ networks: driver: default config: - subnet: 172.15.0.1/24 - gateway: 172.15.0.1 volumes: keeper-node: diff --git a/compose-files/nodes/ganache_node.yml b/compose-files/nodes/ganache_node.yml index 76b7aed..8b73eb5 100644 --- a/compose-files/nodes/ganache_node.yml +++ b/compose-files/nodes/ganache_node.yml @@ -1,4 +1,4 @@ -version: '2.1' +version: '3' services: keeper-node: image: trufflesuite/ganache-cli:latest diff --git a/compose-files/nodes/kovan_node.yml b/compose-files/nodes/kovan_node.yml index b44fe9e..1d78f7a 100644 --- a/compose-files/nodes/kovan_node.yml +++ b/compose-files/nodes/kovan_node.yml @@ -1,4 +1,4 @@ -version: '2.1' +version: '3' services: keeper-node: image: parity/parity:v2.3.2 @@ -13,7 +13,6 @@ services: --jsonrpc-hosts all --jsonrpc-apis all --unsafe-expose - --node-key 0xb3244c104fb56d28d3979f6cd14a8b5cf5b109171d293f4454c97c173a9f9374 volumes: - ../networks/kovan/keys:/home/parity/.local/share/io.parity.ethereum/keys/kovan ports: diff --git a/compose-files/nodes/nile_node.yml b/compose-files/nodes/nile_node.yml index 2606ec8..dfd0b1a 100644 --- a/compose-files/nodes/nile_node.yml +++ b/compose-files/nodes/nile_node.yml @@ -1,4 +1,4 @@ -version: '2.1' +version: '3' services: keeper-node: image: parity/parity:v2.3.2 @@ -9,14 +9,12 @@ services: --base-path /home/parity/base --engine-signer 0x00bd138abd70e2f00903268f3db08f2d25677c9e --ws-interface all - --light --jsonrpc-cors all --jsonrpc-interface all --jsonrpc-hosts all --jsonrpc-apis all --unsafe-expose --unlock 0x00bd138abd70e2f00903268f3db08f2d25677c9e - --node-key 0xb3244c104fb56d28d3979f6cd14a8b5cf5b109171d293f4454c97c173a9f9374 volumes: - ../networks/nile/config:/home/parity/parity/config - keeper-node:/home/parity/.local/share/io.parity.ethereum/ diff --git a/compose-files/nodes/spree_node.yml b/compose-files/nodes/spree_node.yml index 16c1651..b736724 100644 --- a/compose-files/nodes/spree_node.yml +++ b/compose-files/nodes/spree_node.yml @@ -1,4 +1,4 @@ -version: '2.1' +version: '3' services: keeper-node: image: parity/parity:v2.3.2 diff --git a/compose-files/pleuston.yml b/compose-files/pleuston.yml index ca9e52e..ef2c188 100644 --- a/compose-files/pleuston.yml +++ b/compose-files/pleuston.yml @@ -1,4 +1,4 @@ -version: '2.1' +version: '3' services: pleuston: image: oceanprotocol/pleuston:$PLEUSTON_VERSION diff --git a/compose-files/secret_store.yml b/compose-files/secret_store.yml index e8ab872..517d09a 100644 --- a/compose-files/secret_store.yml +++ b/compose-files/secret_store.yml @@ -1,4 +1,4 @@ -version: '2.1' +version: '3' services: secret-store: image: oceanprotocol/parity-ethereum:master diff --git a/kovan_acl_contract_addresses.txt b/kovan_acl_contract_addresses.txt index 78279f4..c89a0a5 100644 --- a/kovan_acl_contract_addresses.txt +++ b/kovan_acl_contract_addresses.txt @@ -14,4 +14,6 @@ v0.6.7=0x294aabd9559b547069c48b45d14bb1ea8d81e440 v0.6.8=0x294aabd9559b547069c48b45d14bb1ea8d81e440 v0.6.9=0x294aabd9559b547069c48b45d14bb1ea8d81e440 v0.6.10=0xa5a8c65a5db8f1d18ccbb4759692e4dbe1434974 +v0.6.11=0xa5a8c65a5db8f1d18ccbb4759692e4dbe1434974 +v0.6.12=0xa5a8c65a5db8f1d18ccbb4759692e4dbe1434974 latest=0xa5a8c65a5db8f1d18ccbb4759692e4dbe1434974 diff --git a/nile_acl_contract_addresses.txt b/nile_acl_contract_addresses.txt index 572a1da..b0f9759 100644 --- a/nile_acl_contract_addresses.txt +++ b/nile_acl_contract_addresses.txt @@ -14,4 +14,6 @@ v0.6.7=0x416276914b5a6dd1b88bb0e35096200b08131113 v0.6.8=0x416276914b5a6dd1b88bb0e35096200b08131113 v0.6.9=0x416276914b5a6dd1b88bb0e35096200b08131113 v0.6.10=0x6bd5fdc37b9c87ba73dda230e5dc18e9fda71ff9 -latest=0x6bd5fdc37b9c87ba73dda230e5dc18e9fda71ff9 +v0.6.11=0x2db2cec56a7ff5f330ee4c845c06043e1ff71c7f +v0.6.12=0x1be580a31d79a7facf1f5c70d8f2727f2ede75bd +latest=0x1be580a31d79a7facf1f5c70d8f2727f2ede75bd diff --git a/start_ocean.sh b/start_ocean.sh index 6fcefb5..659a83c 100755 --- a/start_ocean.sh +++ b/start_ocean.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash +# start_ocean.sh +# Copyright (c) 2019 Ocean Protocol contributors +# SPDX-License-Identifier: Apache-2.0 set -e @@ -18,12 +21,16 @@ export PLEUSTON_VERSION=${PLEUSTON_VERSION:-latest} # Maybe not fully working! export PROJECT_NAME="ocean" export FORCEPULL="false" +# Ocean filesystem artifacts +export OCEAN_HOME="${HOME}/.ocean" + # keeper options +export KEEPER_OWNER_ROLE_ADDRESS="${KEEPER_OWNER_ROLE_ADDRESS}" export KEEPER_DEPLOY_CONTRACTS="false" -export KEEPER_ARTIFACTS_FOLDER="${HOME}/.ocean/keeper-contracts/artifacts" +export KEEPER_ARTIFACTS_FOLDER="${OCEAN_HOME}/keeper-contracts/artifacts" # Specify which ethereum client to run or connect to: development, kovan, spree or nile -export KEEPER_NETWORK_NAME="nile" -export NODE_COMPOSE_FILE="${COMPOSE_DIR}/nodes/nile_node.yml" +export KEEPER_NETWORK_NAME="spree" +export NODE_COMPOSE_FILE="${COMPOSE_DIR}/nodes/spree_node.yml" # Ganache specific option, these two options have no effect when not running ganache-cli export GANACHE_DATABASE_PATH="${DIR}" @@ -39,6 +46,11 @@ export KEEPER_MNEMONIC='' export CONFIGURE_ACL="true" export ACL_CONTRACT_ADDRESS="" +# Default Aquarius parameters +export DB_MODULE="mongodb" +export DB_HOSTNAME="mongodb" +export DB_PORT="27017" + # Export User UID and GID export LOCAL_USER_ID=$(id -u) export LOCAL_GROUP_ID=$(id -g) @@ -68,12 +80,27 @@ function show_banner { echo "" } +function check_if_owned_by_root { + if [ -d "$OCEAN_HOME" ]; then + uid=$(ls -nd "$OCEAN_HOME" | awk '{print $3;}') + if [ "$uid" = "0" ]; then + printf $COLOR_R"WARN: $OCEAN_HOME is owned by root\n"$COLOR_RESET >&2 + else + uid=$(ls -nd "$KEEPER_ARTIFACTS_FOLDER" | awk '{print $3;}') + if [ "$uid" = "0" ]; then + printf $COLOR_R"WARN: $KEEPER_ARTIFACTS_FOLDER is owned by root\n"$COLOR_RESET >&2 + fi + fi + fi +} + +check_if_owned_by_root show_banner COMPOSE_FILES="" COMPOSE_FILES+=" -f ${COMPOSE_DIR}/network_volumes.yml" COMPOSE_FILES+=" -f ${COMPOSE_DIR}/pleuston.yml" -COMPOSE_FILES+=" -f ${COMPOSE_DIR}/aquarius.yml" +COMPOSE_FILES+=" -f ${COMPOSE_DIR}/aquarius_mongodb.yml" COMPOSE_FILES+=" -f ${COMPOSE_DIR}/brizo.yml" COMPOSE_FILES+=" -f ${COMPOSE_DIR}/secret_store.yml" @@ -121,7 +148,7 @@ while :; do printf $COLOR_Y'Starting without Brizo...\n\n'$COLOR_RESET ;; --no-aquarius) - COMPOSE_FILES="${COMPOSE_FILES/ -f ${COMPOSE_DIR}\/aquarius.yml/}" + COMPOSE_FILES="${COMPOSE_FILES/ -f ${COMPOSE_DIR}\/aquarius_mongodb.yml/}" printf $COLOR_Y'Starting without Aquarius...\n\n'$COLOR_RESET ;; --no-secret-store) @@ -140,6 +167,24 @@ while :; do printf $COLOR_Y'Starting only Secret Store...\n\n'$COLOR_RESET ;; ################################################# + # Elasticsearch + ################################################# + --elasticsearch) + COMPOSE_FILES+=" -f ${COMPOSE_DIR}/aquarius_elasticsearch.yml" + COMPOSE_FILES="${COMPOSE_FILES/ -f ${COMPOSE_DIR}\/aquarius_mongodb.yml/}" + export DB_MODULE="elasticsearch" + export DB_HOSTNAME="elasticsearch" + export DB_PORT="9200" + export DB_USERNAME="elastic" + export DB_PASSWORD="changeme" + export DB_SSL="false" + export DB_VERIFY_CERTS="false" + export DB_CA_CERTS="" + export DB_CLIENT_KEY="" + export DB_CLIENT_CERT="" + printf $COLOR_Y'Starting with Elasticsearch...\n\n'$COLOR_RESET + ;; + ################################################# # Contract/Storage switches ################################################# --reuse-ganache-database) @@ -159,9 +204,11 @@ while :; do # connects you to kovan --local-kovan-node) export NODE_COMPOSE_FILE="${COMPOSE_DIR}/nodes/kovan_node.yml" + COMPOSE_FILES="${COMPOSE_FILES/ -f ${COMPOSE_DIR}\/secret_store.yml/}" export KEEPER_NETWORK_NAME="kovan" export ACL_CONTRACT_ADDRESS="$(get_acl_address ${KEEPER_VERSION})" printf $COLOR_Y'Starting with local Kovan node...\n\n'$COLOR_RESET + printf $COLOR_Y'Starting without Secret Store...\n\n'$COLOR_RESET ;; # spins up a new ganache blockchain --local-ganache-node) @@ -176,9 +223,11 @@ while :; do # connects you to nile ocean testnet --local-nile-node) export NODE_COMPOSE_FILE="${COMPOSE_DIR}/nodes/nile_node.yml" + COMPOSE_FILES="${COMPOSE_FILES/ -f ${COMPOSE_DIR}\/secret_store.yml/}" export KEEPER_NETWORK_NAME="nile" export ACL_CONTRACT_ADDRESS="$(get_acl_address ${KEEPER_VERSION})" printf $COLOR_Y'Starting with local Nile node...\n\n'$COLOR_RESET + printf $COLOR_Y'Starting without Secret Store...\n\n'$COLOR_RESET ;; # spins up spree local testnet --local-spree-node) @@ -227,3 +276,4 @@ while :; do esac shift done +