1
0
mirror of https://github.com/oceanprotocol/barge.git synced 2024-11-22 17:50:13 +01:00
barge/start_ocean.sh

96 lines
3.2 KiB
Bash
Executable File

#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
COMPOSE_DIR="${DIR}/compose-files"
# 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
export GANACHE_DATABASE_PATH="${DIR}"
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=$HOME/.ocean/keeper-contracts/artifacts
export BRIZO_ENV_FILE=$DIR/brizo.env
export PROJECT_NAME="ocean"
# Specify the ethereum default RPC container provider
export RPC_URL='keeper-contracts'
# 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
# reset
COLOR_RESET="\033[00m"
function show_banner {
local output=$(cat .banner)
echo -e "$COLOR_B$output$COLOR_RESET"
echo ""
}
show_banner
# default to latest versions
export OCEAN_VERSION=latest
COMPOSE_FILES=""
COMPOSE_FILES+=" -f ${COMPOSE_DIR}/network_volumes.yml"
COMPOSE_FILES+=" -f ${COMPOSE_DIR}/mongo.yml"
COMPOSE_FILES+=" -f ${COMPOSE_DIR}/keeper_contracts.yml"
COMPOSE_FILES+=" -f ${COMPOSE_DIR}/pleuston.yml"
COMPOSE_FILES+=" -f ${COMPOSE_DIR}/aquarius.yml"
COMPOSE_FILES+=" -f ${COMPOSE_DIR}/brizo.yml"
while :; do
case $1 in
--latest)
export OCEAN_VERSION=latest
printf $COLOR_Y'Switched to latest components...\n\n'$COLOR_RESET
;;
--reuse-database)
export REUSE_DATABASE="true"
printf $COLOR_Y'Starting and reusing the database ...\n\n'$COLOR_RESET
;;
--no-pleuston)
COMPOSE_FILES=${COMPOSE_FILES/ -f ${COMPOSE_DIR}\/pleuston.yml/}
printf $COLOR_Y'Starting without Pleuston...\n\n'$COLOR_RESET
;;
--local-parity-node)
COMPOSE_FILES+=" -f ${COMPOSE_DIR}/parity_client.yml"
COMPOSE_FILES+=" -f ${COMPOSE_DIR}/secret_store.yml"
export RPC_URL='parity-node'
export KEEPER_NETWORK_NAME="ocean_poa_net_local"
printf $COLOR_Y'Starting with local Parity node...\n\n'$COLOR_RESET
;;
--purge)
docker network rm $PROJECT_NAME_backend || true
docker network rm $PROJECT_NAME_default || 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
;;
-?*)
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=$PROJECT_NAME $COMPOSE_FILES up
break
esac
shift
done