2018-09-27 11:30:07 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# Must be set to true for the first run, change it to "false" to avoid migrating the smart contracts on each run.
|
2018-11-30 16:22:10 +01:00
|
|
|
export DEPLOY_CONTRACTS="true"
|
2018-09-27 11:30:07 +02:00
|
|
|
# Ganache specific option, these two options have no effect when not running ganache-cli
|
|
|
|
export GANACHE_DATABASE_PATH="."
|
2018-09-27 13:15:43 +02:00
|
|
|
export REUSE_DATABASE="false"
|
2018-09-27 11:30:07 +02:00
|
|
|
# Specify which ethereum client to run or connect to: kovan, ganache, or ocean_poa_net_local
|
|
|
|
export KEEPER_NETWORK_NAME="ganache"
|
|
|
|
export ARTIFACTS_FOLDER=~/.ocean/keeper-contracts/artifacts
|
2018-11-15 11:02:31 +01:00
|
|
|
export PROJECT_NAME="ocean"
|
2018-11-30 02:27:10 +01:00
|
|
|
export BRIZO_ENV_FILE=./brizo.env
|
2018-09-27 11:30:07 +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
|
|
|
|
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
|
|
|
|
2018-10-10 12:21:56 +02:00
|
|
|
show_banner
|
2018-10-02 13:13:10 +02:00
|
|
|
|
2018-11-29 14:51:15 +01:00
|
|
|
# default to latest versions
|
|
|
|
export OCEAN_VERSION=latest
|
2018-10-10 12:21:56 +02:00
|
|
|
COMPOSE_FILE='docker-compose.yml'
|
2018-09-27 13:15:43 +02:00
|
|
|
|
2018-10-10 12:21:56 +02:00
|
|
|
while :; do
|
|
|
|
case $1 in
|
|
|
|
--latest)
|
|
|
|
export OCEAN_VERSION=latest
|
|
|
|
printf $COLOR_Y'Switched to latest components...\n\n'$COLOR_RESET
|
|
|
|
;;
|
2018-10-10 15:49:10 +02:00
|
|
|
--reuse-database)
|
2018-10-10 12:21:56 +02:00
|
|
|
export REUSE_DATABASE="true"
|
2018-10-11 14:33:30 +02:00
|
|
|
printf $COLOR_Y'Starting and reusing the database ...\n\n'$COLOR_RESET
|
2018-10-10 15:49:10 +02:00
|
|
|
;;
|
|
|
|
--no-pleuston)
|
2018-10-10 12:21:56 +02:00
|
|
|
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
|
|
|
|
;;
|
2018-11-30 10:55:15 +01:00
|
|
|
--purge)
|
2018-11-15 11:02:31 +01:00
|
|
|
docker network rm $PROJECT_NAME_backend || true
|
2018-11-30 10:55:15 +01:00
|
|
|
docker network rm $PROJECT_NAME_default || true
|
2018-11-15 11:02:31 +01:00
|
|
|
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
|
|
|
|
;;
|
2018-10-10 12:21:56 +02:00
|
|
|
--) # End of all options.
|
2018-11-30 10:55:15 +01:00
|
|
|
shift
|
|
|
|
break
|
|
|
|
;;
|
2018-10-10 12:21:56 +02:00
|
|
|
-?*)
|
2018-11-30 10:55:15 +01:00
|
|
|
printf $COLOR_R'WARN: Unknown option (ignored): %s\n'$COLOR_RESET "$1" >&2
|
|
|
|
break
|
|
|
|
;;
|
2018-10-10 12:21:56 +02:00
|
|
|
*)
|
|
|
|
printf $COLOR_Y'Starting Ocean...\n\n'$COLOR_RESET
|
2018-11-15 11:02:31 +01:00
|
|
|
docker-compose --project-name=$PROJECT_NAME -f $COMPOSE_FILE up
|
2018-10-10 12:21:56 +02:00
|
|
|
break
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|