2018-09-27 11:30:07 +02:00
|
|
|
#!/usr/bin/env bash
|
2019-03-11 15:47:16 +01:00
|
|
|
# start_ocean.sh
|
|
|
|
# Copyright (c) 2019 Ocean Protocol contributors
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
2019-10-10 12:28:19 +02:00
|
|
|
IP="localhost"
|
|
|
|
optspec=":-:"
|
|
|
|
while getopts "$optspec" optchar; do
|
|
|
|
case "${optchar}" in
|
|
|
|
-)
|
|
|
|
case "${OPTARG}" in
|
|
|
|
exposeip)
|
|
|
|
IP="${!OPTIND}"; OPTIND=$(( $OPTIND + 1 ))
|
|
|
|
;;
|
|
|
|
esac;;
|
|
|
|
esac
|
|
|
|
done
|
2018-09-27 11:30:07 +02:00
|
|
|
|
2019-01-28 11:45:47 +01:00
|
|
|
set -e
|
2019-01-28 11:36:00 +01:00
|
|
|
|
2018-11-29 12:32:38 +01:00
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
2018-12-28 12:22:39 +01:00
|
|
|
export BRIZO_ENV_FILE="${DIR}/brizo.env"
|
|
|
|
|
|
|
|
# Patch $DIR if spaces (BRIZO_ENV_FILE does not need patch)
|
2018-12-19 10:52:44 +01:00
|
|
|
DIR="${DIR/ /\\ }"
|
2018-11-29 12:32:38 +01:00
|
|
|
COMPOSE_DIR="${DIR}/compose-files"
|
2018-12-05 10:46:50 +01:00
|
|
|
|
2019-10-02 14:53:46 +02:00
|
|
|
# Default versions of Aquarius, Brizo, Keeper Contracts and Commons
|
2020-01-31 11:22:05 +01:00
|
|
|
export AQUARIUS_VERSION=${AQUARIUS_VERSION:-v1.0.7}
|
2020-02-10 13:35:14 +01:00
|
|
|
export BRIZO_VERSION=${BRIZO_VERSION:-v0.9.1}
|
2020-02-10 13:33:41 +01:00
|
|
|
export EVENTS_HANDLER_VERSION=${EVENTS_HANDLER_VERSION:-v0.4.5}
|
2020-01-17 12:59:14 +01:00
|
|
|
export KEEPER_VERSION=${KEEPER_VERSION:-v0.13.2}
|
2019-11-07 15:46:01 +01:00
|
|
|
export FAUCET_VERSION=${FAUCET_VERSION:-v0.3.2}
|
2020-02-03 11:02:42 +01:00
|
|
|
export COMMONS_SERVER_VERSION=${COMMONS_SERVER_VERSION:-v2.2.0}
|
|
|
|
export COMMONS_CLIENT_VERSION=${COMMONS_CLIENT_VERSION:-v2.2.0}
|
2019-12-10 14:48:40 +01:00
|
|
|
export AGENT_VERSION=${AGENT_VERSION:-latest}
|
2019-02-28 16:49:30 +01:00
|
|
|
|
2019-10-09 19:39:33 +02:00
|
|
|
export PARITY_IMAGE="parity/parity:v2.5.7-stable"
|
2019-05-06 09:05:04 +02:00
|
|
|
|
2018-12-05 10:46:50 +01:00
|
|
|
export PROJECT_NAME="ocean"
|
2019-01-16 16:06:27 +01:00
|
|
|
export FORCEPULL="false"
|
2018-12-17 10:22:39 +01:00
|
|
|
|
2019-03-11 15:47:16 +01:00
|
|
|
# Ocean filesystem artifacts
|
|
|
|
export OCEAN_HOME="${HOME}/.ocean"
|
|
|
|
|
2018-12-05 10:46:50 +01:00
|
|
|
# keeper options
|
2019-03-05 14:29:29 +01:00
|
|
|
export KEEPER_OWNER_ROLE_ADDRESS="${KEEPER_OWNER_ROLE_ADDRESS}"
|
2019-04-03 09:26:06 +02:00
|
|
|
export KEEPER_DEPLOY_CONTRACTS="true"
|
2019-03-11 15:47:16 +01:00
|
|
|
export KEEPER_ARTIFACTS_FOLDER="${OCEAN_HOME}/keeper-contracts/artifacts"
|
2019-09-03 13:40:29 +02:00
|
|
|
# Specify which ethereum client to run or connect to: development, spree or nile
|
2019-03-28 11:30:22 +01:00
|
|
|
export KEEPER_NETWORK_NAME="spree"
|
2019-03-26 09:27:49 +01:00
|
|
|
export NODE_COMPOSE_FILE="${COMPOSE_DIR}/nodes/spree_node.yml"
|
2018-12-05 10:46:50 +01:00
|
|
|
|
2018-09-27 11:30:07 +02:00
|
|
|
# Ganache specific option, these two options have no effect when not running ganache-cli
|
2018-11-29 12:32:38 +01:00
|
|
|
export GANACHE_DATABASE_PATH="${DIR}"
|
2018-12-05 10:46:50 +01:00
|
|
|
export GANACHE_REUSE_DATABASE="false"
|
|
|
|
|
2018-11-30 10:36:55 +01:00
|
|
|
# Specify the ethereum default RPC container provider
|
2019-10-10 12:28:19 +02:00
|
|
|
if [ ${IP} = "localhost" ]; then
|
|
|
|
export KEEPER_RPC_HOST="keeper-node"
|
|
|
|
else
|
|
|
|
export KEEPER_RPC_HOST=${IP}
|
|
|
|
fi
|
2019-07-26 18:03:42 +02:00
|
|
|
export KEEPER_RPC_PORT="8545"
|
2018-12-05 12:16:18 +01:00
|
|
|
export KEEPER_RPC_URL="http://"${KEEPER_RPC_HOST}:${KEEPER_RPC_PORT}
|
2019-04-03 09:26:06 +02:00
|
|
|
# Use this seed only on Spree! (Spree is the default.)
|
|
|
|
export KEEPER_MNEMONIC="taxi music thumb unique chat sand crew more leg another off lamp"
|
2018-09-27 11:30:07 +02:00
|
|
|
|
2018-12-27 15:14:20 +01:00
|
|
|
# Enable acl-contract validation in Secret-store
|
2019-01-28 11:36:00 +01:00
|
|
|
export CONFIGURE_ACL="true"
|
|
|
|
export ACL_CONTRACT_ADDRESS=""
|
2018-12-27 15:14:20 +01:00
|
|
|
|
2019-06-26 11:47:01 +02:00
|
|
|
# Default Aquarius parameters: use Elasticsearch
|
|
|
|
export DB_MODULE="elasticsearch"
|
2019-10-02 13:23:40 +02:00
|
|
|
export DB_HOSTNAME="172.15.0.11"
|
2019-06-26 11:47:01 +02:00
|
|
|
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=""
|
2019-06-28 16:27:28 +02:00
|
|
|
CHECK_ELASTIC_VM_COUNT=true
|
2019-02-08 10:57:56 +01:00
|
|
|
|
2019-09-09 10:08:12 +02:00
|
|
|
export BRIZO_WORKERS=${BRIZO_WORKERS:-5}
|
2019-08-28 22:07:46 +02:00
|
|
|
export BRIZO_LOG_LEVEL="INFO"
|
|
|
|
export EVENTS_HANDLER_LOG_LEVEL="INFO"
|
2019-10-15 13:10:14 +02:00
|
|
|
|
2019-10-14 15:14:23 +02:00
|
|
|
export BRIZO_IPFS_GATEWAY=https://ipfs.oceanprotocol.com
|
2019-10-10 12:28:19 +02:00
|
|
|
|
2019-08-28 11:16:16 +02:00
|
|
|
# Set a valid parity address and password to have seamless interaction with the `keeper`
|
|
|
|
# it has to exist on the secret store signing node and as well on the keeper node
|
2019-08-29 11:16:13 +02:00
|
|
|
export PROVIDER_ADDRESS=0x068ed00cf0441e4829d9784fcbe7b9e26d4bd8d0
|
|
|
|
export PROVIDER_PASSWORD=secret
|
|
|
|
export PROVIDER_KEYFILE="/accounts/provider.json"
|
|
|
|
export ACCOUNTS_FOLDER="../accounts"
|
2019-10-10 12:28:19 +02:00
|
|
|
if [ ${IP} = "localhost" ]; then
|
|
|
|
export SECRET_STORE_URL=http://secret-store:12001
|
|
|
|
export SIGNING_NODE_URL=http://secret-store-signing-node:8545
|
|
|
|
export AQUARIUS_URI=http://aquarius:5000
|
2020-01-23 13:33:16 +01:00
|
|
|
export FAUCET_URL=http://localhost:3001
|
2019-10-10 12:28:19 +02:00
|
|
|
export COMMONS_SERVER_URL=http://localhost:4000
|
|
|
|
export COMMONS_CLIENT_URL=http://localhost:3000
|
|
|
|
export COMMONS_KEEPER_RPC_HOST=http://localhost:8545
|
|
|
|
export COMMONS_SECRET_STORE_URL=http://localhost:12001
|
2020-01-23 09:20:15 +01:00
|
|
|
export BRIZO_URL=http://localhost:8030
|
2019-10-10 12:28:19 +02:00
|
|
|
else
|
|
|
|
export SECRET_STORE_URL=http://${IP}:12001
|
|
|
|
export SIGNING_NODE_URL=http://${IP}:8545
|
|
|
|
export AQUARIUS_URI=http://${IP}:5000
|
|
|
|
export FAUCET_URL=http://${IP}:3001
|
|
|
|
export COMMONS_SERVER_URL=http://${IP}:4000
|
|
|
|
export COMMONS_CLIENT_URL=http://${IP}:3000
|
|
|
|
export COMMONS_KEEPER_RPC_HOST=http://${IP}:8545
|
|
|
|
export COMMONS_SECRET_STORE_URL=http://${IP}:12001
|
2019-10-15 13:10:14 +02:00
|
|
|
export BRIZO_URL=http://${IP}:8030
|
2019-10-10 12:28:19 +02:00
|
|
|
fi
|
2019-07-18 15:41:41 +02:00
|
|
|
# Default Faucet options
|
|
|
|
export FAUCET_TIMESPAN=${FAUCET_TIMESPAN:-24}
|
2019-10-01 15:36:22 +02:00
|
|
|
|
|
|
|
#commons
|
|
|
|
export COMMONS_BRIZO_URL=${BRIZO_URL}
|
|
|
|
export COMMONS_AQUARIUS_URI=${AQUARIUS_URI}
|
|
|
|
export COMMONS_FAUCET_URL=${FAUCET_URL}
|
2019-10-14 15:14:23 +02:00
|
|
|
export COMMONS_IPFS_GATEWAY_URI=https://ipfs.oceanprotocol.com
|
|
|
|
export COMMONS_IPFS_NODE_URI=https://ipfs.oceanprotocol.com:443
|
2019-07-18 15:41:41 +02:00
|
|
|
|
2020-02-17 09:04:29 +01:00
|
|
|
#export OPERATOR_SERVICE_URL=http://127.0.0.1:8050
|
|
|
|
export OPERATOR_SERVICE_URL=https://operator-api.operator.dev-ocean.com
|
2019-11-20 17:31:58 +01:00
|
|
|
|
2019-12-10 14:48:40 +01:00
|
|
|
#agent
|
|
|
|
# private key for agent, public address: 0x6f2b82bB771687b69d0932c7386742804144ae7D
|
|
|
|
# NEVER USE this address in production !
|
|
|
|
export AGENT_PRIVATE_KEY='axis talent grab cushion figure couple plug ostrich file false jealous nest'
|
|
|
|
|
2019-01-22 11:36:44 +01:00
|
|
|
# Export User UID and GID
|
|
|
|
export LOCAL_USER_ID=$(id -u)
|
|
|
|
export LOCAL_GROUP_ID=$(id -g)
|
|
|
|
|
2019-10-02 15:20:06 +02:00
|
|
|
|
|
|
|
#add aquarius to /etc/hosts
|
|
|
|
|
2019-10-11 07:12:56 +02:00
|
|
|
if [ ${IP} = "localhost" ]; then
|
|
|
|
if grep -q "aquarius" /etc/hosts; then
|
|
|
|
echo "aquarius exists"
|
|
|
|
else
|
2019-10-11 07:25:26 +02:00
|
|
|
echo "127.0.0.1 aquarius" | sudo tee -a /etc/hosts
|
2019-10-11 07:12:56 +02:00
|
|
|
fi
|
|
|
|
fi
|
2019-10-02 15:20:06 +02:00
|
|
|
|
2018-10-10 12:21:56 +02:00
|
|
|
# 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
|
2018-10-02 13:38:55 +02:00
|
|
|
|
2018-10-10 12:21:56 +02:00
|
|
|
# reset
|
|
|
|
COLOR_RESET="\033[00m"
|
2018-09-27 13:15:43 +02:00
|
|
|
|
2019-01-28 11:36:00 +01:00
|
|
|
function get_acl_address {
|
2019-10-09 12:29:32 +02:00
|
|
|
# detect keeper version
|
2019-01-28 11:36:00 +01:00
|
|
|
local version="${1:-latest}"
|
2019-10-09 12:29:32 +02:00
|
|
|
|
|
|
|
# sesarch in the file for the keeper version
|
|
|
|
line=$(grep "^${version}=" "${DIR}/ACL/${KEEPER_NETWORK_NAME}_addresses.txt")
|
|
|
|
# set address
|
2019-01-28 11:45:47 +01:00
|
|
|
address="${line##*=}"
|
2019-10-09 12:29:32 +02:00
|
|
|
|
|
|
|
# if address is still empty
|
|
|
|
if [ -z "${address}" ]; then
|
|
|
|
# fetch from latest line
|
|
|
|
line=$(grep "^latest=" "${DIR}/ACL/${KEEPER_NETWORK_NAME}_addresses.txt")
|
|
|
|
# set address
|
|
|
|
address="${line##*=}"
|
|
|
|
fi
|
|
|
|
|
2019-01-28 11:36:00 +01:00
|
|
|
echo "${address}"
|
|
|
|
}
|
|
|
|
|
2018-10-10 12:21:56 +02:00
|
|
|
function show_banner {
|
|
|
|
local output=$(cat .banner)
|
|
|
|
echo -e "$COLOR_B$output$COLOR_RESET"
|
|
|
|
echo ""
|
|
|
|
}
|
2018-09-27 13:15:43 +02:00
|
|
|
|
2019-03-28 23:07:20 +01:00
|
|
|
function configure_secret_store {
|
|
|
|
# restore default secret store config (Issue #126)
|
|
|
|
if [ -e "$DIR/networks/secret-store/config/config.toml.save" ]; then
|
|
|
|
cp "$DIR/networks/secret-store/config/config.toml.save" \
|
|
|
|
"$DIR/networks/secret-store/config/config.toml"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2019-03-11 15:47:16 +01:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2019-04-03 09:26:06 +02:00
|
|
|
function clean_local_contracts {
|
2019-07-26 18:03:42 +02:00
|
|
|
rm -f "${KEEPER_ARTIFACTS_FOLDER}/ready"
|
|
|
|
rm -f "${KEEPER_ARTIFACTS_FOLDER}/*.spree.json"
|
|
|
|
rm -f "${KEEPER_ARTIFACTS_FOLDER}/*.development.json"
|
2019-04-03 09:26:06 +02:00
|
|
|
}
|
|
|
|
|
2019-06-28 16:27:28 +02:00
|
|
|
function check_max_map_count {
|
2019-07-12 08:37:45 +02:00
|
|
|
vm_max_map_count=$(docker run --rm busybox sysctl -q vm.max_map_count)
|
2019-06-28 16:27:28 +02:00
|
|
|
vm_max_map_count=${vm_max_map_count##* }
|
|
|
|
vm_max_map_count=262144
|
|
|
|
if [ $vm_max_map_count -lt 262144 ]; then
|
|
|
|
printf $COLOR_R'vm.max_map_count current kernel value ($vm_max_map_count) is too low for Elasticsearch\n'$COLOR_RESET
|
|
|
|
printf $COLOR_R'You must update vm.max_map_count to at least 262144\n'$COLOR_RESET
|
|
|
|
printf $COLOR_R'Please refer to https://www.elastic.co/guide/en/elasticsearch/reference/6.6/vm-max-map-count.html\n'$COLOR_RESET
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2019-03-11 15:47:16 +01:00
|
|
|
check_if_owned_by_root
|
2018-10-10 12:21:56 +02:00
|
|
|
show_banner
|
2018-10-02 13:13:10 +02:00
|
|
|
|
2018-11-29 12:32:38 +01:00
|
|
|
COMPOSE_FILES=""
|
2019-10-09 15:29:02 +02:00
|
|
|
COMPOSE_FILES+=" -f ${COMPOSE_DIR}/dashboard.yml"
|
2019-04-03 09:26:06 +02:00
|
|
|
COMPOSE_FILES+=" -f ${COMPOSE_DIR}/keeper_contracts.yml"
|
2018-11-29 12:32:38 +01:00
|
|
|
COMPOSE_FILES+=" -f ${COMPOSE_DIR}/network_volumes.yml"
|
2019-10-01 12:40:56 +02:00
|
|
|
COMPOSE_FILES+=" -f ${COMPOSE_DIR}/commons.yml"
|
2019-06-26 11:47:01 +02:00
|
|
|
COMPOSE_FILES+=" -f ${COMPOSE_DIR}/aquarius_elasticsearch.yml"
|
2018-11-29 12:32:38 +01:00
|
|
|
COMPOSE_FILES+=" -f ${COMPOSE_DIR}/brizo.yml"
|
2019-08-28 14:50:58 +02:00
|
|
|
COMPOSE_FILES+=" -f ${COMPOSE_DIR}/events_handler.yml"
|
2018-12-05 10:46:50 +01:00
|
|
|
COMPOSE_FILES+=" -f ${COMPOSE_DIR}/secret_store.yml"
|
2019-08-26 12:43:48 +02:00
|
|
|
COMPOSE_FILES+=" -f ${COMPOSE_DIR}/secret_store_signing_node.yml"
|
2019-07-18 12:03:03 +02:00
|
|
|
COMPOSE_FILES+=" -f ${COMPOSE_DIR}/faucet.yml"
|
2019-12-10 14:48:40 +01:00
|
|
|
COMPOSE_FILES+=" -f ${COMPOSE_DIR}/agent.yml"
|
2019-01-16 16:06:27 +01:00
|
|
|
DOCKER_COMPOSE_EXTRA_OPTS="${DOCKER_COMPOSE_EXTRA_OPTS:-}"
|
|
|
|
|
2018-10-10 12:21:56 +02:00
|
|
|
while :; do
|
|
|
|
case $1 in
|
2019-10-10 12:28:19 +02:00
|
|
|
--exposeip)
|
|
|
|
;;
|
2018-12-05 10:46:50 +01:00
|
|
|
#################################################
|
2019-09-17 16:00:30 +02:00
|
|
|
# Log level
|
|
|
|
#################################################
|
|
|
|
--debug)
|
|
|
|
export BRIZO_LOG_LEVEL="DEBUG"
|
|
|
|
export EVENTS_HANDLER_LOG_LEVEL="DEBUG"
|
|
|
|
;;
|
|
|
|
#################################################
|
2019-01-16 16:06:27 +01:00
|
|
|
# Disable color
|
|
|
|
#################################################
|
|
|
|
--no-ansi)
|
|
|
|
DOCKER_COMPOSE_EXTRA_OPTS+=" --no-ansi"
|
|
|
|
unset COLOR_R COLOR_G COLOR_Y COLOR_B COLOR_M COLOR_C COLOR_RESET
|
|
|
|
;;
|
|
|
|
#################################################
|
2018-12-05 10:46:50 +01:00
|
|
|
# Version switches
|
|
|
|
#################################################
|
2018-10-10 12:21:56 +02:00
|
|
|
--latest)
|
2019-06-04 16:49:58 +02:00
|
|
|
export AQUARIUS_VERSION="latest"
|
|
|
|
export BRIZO_VERSION="latest"
|
2019-08-28 14:50:58 +02:00
|
|
|
export EVENTS_HANDLER_VERSION="latest"
|
2019-06-04 16:49:58 +02:00
|
|
|
export KEEPER_VERSION="latest"
|
2019-07-26 18:03:42 +02:00
|
|
|
# TODO: Change label on Docker to refer `latest` to `master`
|
2019-07-18 12:03:03 +02:00
|
|
|
export FAUCET_VERSION="latest"
|
2019-12-10 14:48:40 +01:00
|
|
|
export AGENT_VERSION="latest"
|
|
|
|
export COMMONS_SERVER_VERSION="latest"
|
|
|
|
export COMMONS_CLIENT_VERSION="latest"
|
2018-10-10 12:21:56 +02:00
|
|
|
printf $COLOR_Y'Switched to latest components...\n\n'$COLOR_RESET
|
|
|
|
;;
|
2018-12-17 10:22:39 +01:00
|
|
|
--force-pull)
|
2019-01-16 16:06:27 +01:00
|
|
|
export FORCEPULL="true"
|
2019-02-28 12:18:53 +01:00
|
|
|
printf $COLOR_Y'Pulling the latest revision of the used Docker images...\n\n'$COLOR_RESET
|
2018-12-17 10:22:39 +01:00
|
|
|
;;
|
2018-12-05 10:46:50 +01:00
|
|
|
#################################################
|
|
|
|
# Exclude switches
|
|
|
|
#################################################
|
2019-10-19 11:40:25 +02:00
|
|
|
--no-pleuston)
|
|
|
|
COMPOSE_FILES="${COMPOSE_FILES/ -f ${COMPOSE_DIR}\/commons.yml/}"
|
|
|
|
printf $COLOR_Y'Starting without Commons...\n\n'$COLOR_RESET
|
|
|
|
;;
|
|
|
|
--no-commons)
|
2019-10-09 15:36:45 +02:00
|
|
|
COMPOSE_FILES="${COMPOSE_FILES/ -f ${COMPOSE_DIR}\/commons.yml/}"
|
2019-10-01 12:40:56 +02:00
|
|
|
printf $COLOR_Y'Starting without Commons...\n\n'$COLOR_RESET
|
2018-10-10 12:21:56 +02:00
|
|
|
;;
|
2019-08-28 14:50:58 +02:00
|
|
|
--no-events-handler)
|
|
|
|
COMPOSE_FILES="${COMPOSE_FILES/ -f ${COMPOSE_DIR}\/events_handler.yml/}"
|
2019-09-12 13:57:00 +02:00
|
|
|
printf $COLOR_Y'Starting without Events Handler...\n\n'$COLOR_RESET
|
2019-08-28 14:50:58 +02:00
|
|
|
;;
|
2018-12-06 09:16:50 +01:00
|
|
|
--no-brizo)
|
2018-12-19 10:52:44 +01:00
|
|
|
COMPOSE_FILES="${COMPOSE_FILES/ -f ${COMPOSE_DIR}\/brizo.yml/}"
|
2018-12-06 09:16:50 +01:00
|
|
|
printf $COLOR_Y'Starting without Brizo...\n\n'$COLOR_RESET
|
|
|
|
;;
|
|
|
|
--no-aquarius)
|
2019-06-26 11:47:01 +02:00
|
|
|
COMPOSE_FILES="${COMPOSE_FILES/ -f ${COMPOSE_DIR}\/aquarius_elasticsearch.yml/}"
|
2018-12-06 09:16:50 +01:00
|
|
|
printf $COLOR_Y'Starting without Aquarius...\n\n'$COLOR_RESET
|
|
|
|
;;
|
|
|
|
--no-secret-store)
|
2018-12-19 10:52:44 +01:00
|
|
|
COMPOSE_FILES="${COMPOSE_FILES/ -f ${COMPOSE_DIR}\/secret_store.yml/}"
|
2018-12-06 09:16:50 +01:00
|
|
|
printf $COLOR_Y'Starting without Secret Store...\n\n'$COLOR_RESET
|
|
|
|
;;
|
2019-07-18 12:03:03 +02:00
|
|
|
--no-faucet)
|
|
|
|
COMPOSE_FILES="${COMPOSE_FILES/ -f ${COMPOSE_DIR}\/faucet.yml/}"
|
|
|
|
printf $COLOR_Y'Starting without Faucet...\n\n'$COLOR_RESET
|
|
|
|
;;
|
2019-10-09 15:29:02 +02:00
|
|
|
--no-dashboard)
|
|
|
|
COMPOSE_FILES="${COMPOSE_FILES/ -f ${COMPOSE_DIR}\/dashboard.yml/}"
|
|
|
|
printf $COLOR_Y'Starting without Dashboard ...\n\n'$COLOR_RESET
|
|
|
|
;;
|
2019-10-09 15:36:45 +02:00
|
|
|
--no-acl-contract)
|
|
|
|
export CONFIGURE_ACL="false"
|
|
|
|
printf $COLOR_Y'Disabling acl validation in secret-store...\n\n'$COLOR_RESET
|
|
|
|
;;
|
2019-12-10 14:48:40 +01:00
|
|
|
--no-agent)
|
|
|
|
COMPOSE_FILES="${COMPOSE_FILES/ -f ${COMPOSE_DIR}\/agent.yml/}"
|
|
|
|
printf $COLOR_Y'Starting without Agent ...\n\n'$COLOR_RESET
|
|
|
|
;;
|
2019-01-16 16:06:27 +01:00
|
|
|
#################################################
|
|
|
|
# Only Secret Store
|
|
|
|
#################################################
|
|
|
|
--only-secret-store)
|
|
|
|
COMPOSE_FILES=""
|
|
|
|
COMPOSE_FILES+=" -f ${COMPOSE_DIR}/network_volumes.yml"
|
|
|
|
COMPOSE_FILES+=" -f ${COMPOSE_DIR}/secret_store.yml"
|
2019-08-26 13:02:06 +02:00
|
|
|
COMPOSE_FILES+=" -f ${COMPOSE_DIR}/secret_store_signing_node.yml"
|
2019-01-16 16:06:27 +01:00
|
|
|
NODE_COMPOSE_FILE=""
|
|
|
|
printf $COLOR_Y'Starting only Secret Store...\n\n'$COLOR_RESET
|
|
|
|
;;
|
2018-12-05 10:46:50 +01:00
|
|
|
#################################################
|
2019-06-26 11:47:01 +02:00
|
|
|
# MongoDB
|
2019-02-08 10:57:56 +01:00
|
|
|
#################################################
|
2019-06-26 11:47:01 +02:00
|
|
|
--mongodb)
|
|
|
|
COMPOSE_FILES+=" -f ${COMPOSE_DIR}/aquarius_mongodb.yml"
|
|
|
|
COMPOSE_FILES="${COMPOSE_FILES/ -f ${COMPOSE_DIR}\/aquarius_elasticsearch.yml/}"
|
2019-06-28 16:27:28 +02:00
|
|
|
CHECK_ELASTIC_VM_COUNT=false
|
2019-06-26 11:47:01 +02:00
|
|
|
export DB_MODULE="mongodb"
|
|
|
|
export DB_HOSTNAME="mongodb"
|
|
|
|
export DB_PORT="27017"
|
|
|
|
printf $COLOR_Y'Starting with MongoDB...\n\n'$COLOR_RESET
|
2019-02-08 10:57:56 +01:00
|
|
|
;;
|
|
|
|
#################################################
|
2018-12-05 10:46:50 +01:00
|
|
|
# Contract/Storage switches
|
|
|
|
#################################################
|
|
|
|
--reuse-ganache-database)
|
|
|
|
export GANACHE_REUSE_DATABASE="true"
|
2018-12-27 15:14:20 +01:00
|
|
|
printf $COLOR_Y'Starting and reusing the database...\n\n'$COLOR_RESET
|
|
|
|
;;
|
|
|
|
#################################################
|
2018-12-05 10:46:50 +01:00
|
|
|
# Node type switches
|
|
|
|
#################################################
|
|
|
|
# spins up a new ganache blockchain
|
|
|
|
--local-ganache-node)
|
2018-12-19 10:52:44 +01:00
|
|
|
export NODE_COMPOSE_FILE="${COMPOSE_DIR}/nodes/ganache_node.yml"
|
2019-08-26 12:45:13 +02:00
|
|
|
COMPOSE_FILES="${COMPOSE_FILES/ -f ${COMPOSE_DIR}\/secret_store.yml/}"
|
|
|
|
COMPOSE_FILES="${COMPOSE_FILES/ -f ${COMPOSE_DIR}\/secret_store_signing_node.yml/}"
|
2019-04-03 09:26:06 +02:00
|
|
|
export KEEPER_MNEMONIC=''
|
2018-12-05 10:46:50 +01:00
|
|
|
export KEEPER_NETWORK_NAME="development"
|
|
|
|
printf $COLOR_Y'Starting with local Ganache node...\n\n'$COLOR_RESET
|
2019-08-26 12:45:13 +02:00
|
|
|
printf $COLOR_Y'Starting without Secret Store...\n\n'$COLOR_RESET
|
|
|
|
printf $COLOR_Y'Starting without Secret Store signing node...\n\n'$COLOR_RESET
|
2018-12-05 10:46:50 +01:00
|
|
|
;;
|
2018-12-06 10:58:28 +01:00
|
|
|
# connects you to nile ocean testnet
|
|
|
|
--local-nile-node)
|
2018-12-19 10:52:44 +01:00
|
|
|
export NODE_COMPOSE_FILE="${COMPOSE_DIR}/nodes/nile_node.yml"
|
2019-04-03 09:26:06 +02:00
|
|
|
COMPOSE_FILES="${COMPOSE_FILES/ -f ${COMPOSE_DIR}\/keeper_contracts.yml/}"
|
|
|
|
export KEEPER_MNEMONIC=''
|
2018-12-06 10:58:28 +01:00
|
|
|
export KEEPER_NETWORK_NAME="nile"
|
2019-04-03 09:26:06 +02:00
|
|
|
export KEEPER_DEPLOY_CONTRACTS="false"
|
2019-01-28 11:36:00 +01:00
|
|
|
export ACL_CONTRACT_ADDRESS="$(get_acl_address ${KEEPER_VERSION})"
|
2018-12-06 10:58:28 +01:00
|
|
|
printf $COLOR_Y'Starting with local Nile node...\n\n'$COLOR_RESET
|
2018-12-05 14:03:41 +01:00
|
|
|
;;
|
2019-05-09 22:37:25 +02:00
|
|
|
# connects you to duero ocean testnet
|
|
|
|
--local-duero-node)
|
|
|
|
export NODE_COMPOSE_FILE="${COMPOSE_DIR}/nodes/duero_node.yml"
|
|
|
|
COMPOSE_FILES="${COMPOSE_FILES/ -f ${COMPOSE_DIR}\/keeper_contracts.yml/}"
|
|
|
|
export KEEPER_MNEMONIC=''
|
|
|
|
export KEEPER_NETWORK_NAME="duero"
|
|
|
|
export KEEPER_DEPLOY_CONTRACTS="false"
|
|
|
|
export ACL_CONTRACT_ADDRESS="$(get_acl_address ${KEEPER_VERSION})"
|
|
|
|
printf $COLOR_Y'Starting with local Duero node...\n\n'$COLOR_RESET
|
|
|
|
;;
|
2019-06-06 15:24:00 +02:00
|
|
|
# connects you to Pacific ocean network
|
|
|
|
--local-pacific-node)
|
|
|
|
export NODE_COMPOSE_FILE="${COMPOSE_DIR}/nodes/pacific_node.yml"
|
|
|
|
COMPOSE_FILES="${COMPOSE_FILES/ -f ${COMPOSE_DIR}\/keeper_contracts.yml/}"
|
|
|
|
export KEEPER_MNEMONIC=''
|
|
|
|
export KEEPER_NETWORK_NAME="pacific"
|
|
|
|
export KEEPER_DEPLOY_CONTRACTS="false"
|
|
|
|
export ACL_CONTRACT_ADDRESS="$(get_acl_address ${KEEPER_VERSION})"
|
|
|
|
printf $COLOR_Y'Starting with local Pacific node...\n\n'$COLOR_RESET
|
|
|
|
printf $COLOR_Y'Starting without Secret Store...\n\n'$COLOR_RESET
|
|
|
|
;;
|
2018-12-06 10:58:28 +01:00
|
|
|
# spins up spree local testnet
|
|
|
|
--local-spree-node)
|
2018-12-19 10:52:44 +01:00
|
|
|
export NODE_COMPOSE_FILE="${COMPOSE_DIR}/nodes/spree_node.yml"
|
2019-01-24 08:31:40 +01:00
|
|
|
# use this seed only on spree!
|
2019-01-24 09:20:49 +01:00
|
|
|
export KEEPER_MNEMONIC="taxi music thumb unique chat sand crew more leg another off lamp"
|
2018-12-06 10:58:28 +01:00
|
|
|
export KEEPER_NETWORK_NAME="spree"
|
|
|
|
printf $COLOR_Y'Starting with local Spree node...\n\n'$COLOR_RESET
|
2018-10-10 12:21:56 +02:00
|
|
|
;;
|
2019-12-05 10:43:07 +01:00
|
|
|
--local-spree-no-deploy)
|
|
|
|
export NODE_COMPOSE_FILE="${COMPOSE_DIR}/nodes/spree_node.yml"
|
|
|
|
# use this seed only on spree!
|
|
|
|
export KEEPER_MNEMONIC="taxi music thumb unique chat sand crew more leg another off lamp"
|
|
|
|
export KEEPER_NETWORK_NAME="spree"
|
|
|
|
export KEEPER_DEPLOY_CONTRACTS="false"
|
|
|
|
printf $COLOR_Y'Starting with local Spree node, and keeping existing contracts (no deployment)...\n\n'$COLOR_RESET
|
|
|
|
;;
|
2018-12-05 10:46:50 +01:00
|
|
|
#################################################
|
|
|
|
# Cleaning switches
|
|
|
|
#################################################
|
2018-11-30 10:55:15 +01:00
|
|
|
--purge)
|
2018-12-17 10:22:39 +01:00
|
|
|
printf $COLOR_R'Doing a deep clean ...\n\n'$COLOR_RESET
|
2019-08-26 09:14:05 +02:00
|
|
|
eval docker-compose --project-name=$PROJECT_NAME "$COMPOSE_FILES" -f "${NODE_COMPOSE_FILE}" down
|
2018-12-05 12:16:18 +01:00
|
|
|
docker network rm ${PROJECT_NAME}_default || true
|
2018-12-17 10:22:39 +01:00
|
|
|
docker network rm ${PROJECT_NAME}_backend || true
|
|
|
|
docker network rm ${PROJECT_NAME}_secretstore || true
|
2018-12-05 12:16:18 +01:00
|
|
|
docker volume rm ${PROJECT_NAME}_secret-store || true
|
2019-08-26 08:31:49 +02:00
|
|
|
docker volume rm ${PROJECT_NAME}_keeper-node-duero || true
|
|
|
|
docker volume rm ${PROJECT_NAME}_keeper-node-nile || true
|
|
|
|
docker volume rm ${PROJECT_NAME}_keeper-node-pacific || true
|
2019-07-18 12:03:03 +02:00
|
|
|
docker volume rm ${PROJECT_NAME}_faucet || true
|
2019-08-28 11:07:48 +02:00
|
|
|
read -p "Are you sure you want to delete $KEEPER_ARTIFACTS_FOLDER? (y/N): " -n 1 -r
|
2018-11-15 11:02:31 +01:00
|
|
|
echo
|
|
|
|
if [[ $REPLY =~ ^[Yy]$ ]]
|
|
|
|
then
|
2018-12-19 10:52:44 +01:00
|
|
|
rm -rf "${KEEPER_ARTIFACTS_FOLDER}"
|
2018-11-15 11:02:31 +01:00
|
|
|
fi
|
|
|
|
;;
|
2018-10-10 12:21:56 +02:00
|
|
|
--) # End of all options.
|
2018-11-29 12:32:38 +01:00
|
|
|
shift
|
|
|
|
break
|
|
|
|
;;
|
2018-10-10 12:21:56 +02:00
|
|
|
-?*)
|
2018-11-29 12:32:38 +01:00
|
|
|
printf $COLOR_R'WARN: Unknown option (ignored): %s\n'$COLOR_RESET "$1" >&2
|
|
|
|
break
|
|
|
|
;;
|
2018-10-10 12:21:56 +02:00
|
|
|
*)
|
2019-06-28 16:27:28 +02:00
|
|
|
[ ${CHECK_ELASTIC_VM_COUNT} = "true" ] && check_max_map_count
|
2018-10-10 12:21:56 +02:00
|
|
|
printf $COLOR_Y'Starting Ocean...\n\n'$COLOR_RESET
|
2019-03-28 23:07:20 +01:00
|
|
|
configure_secret_store
|
2019-07-26 18:03:42 +02:00
|
|
|
[ -n "${NODE_COMPOSE_FILE}" ] && COMPOSE_FILES+=" -f ${NODE_COMPOSE_FILE}"
|
2019-04-03 09:26:06 +02:00
|
|
|
[ ${KEEPER_DEPLOY_CONTRACTS} = "true" ] && clean_local_contracts
|
2019-08-08 10:18:49 +02:00
|
|
|
[ ${FORCEPULL} = "true" ] && eval docker-compose "$DOCKER_COMPOSE_EXTRA_OPTS" --project-name=$PROJECT_NAME "$COMPOSE_FILES" pull
|
2019-07-26 18:03:42 +02:00
|
|
|
eval docker-compose "$DOCKER_COMPOSE_EXTRA_OPTS" --project-name=$PROJECT_NAME "$COMPOSE_FILES" up --remove-orphans
|
2018-10-10 12:21:56 +02:00
|
|
|
break
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|