diff --git a/.env b/.env new file mode 100644 index 0000000000..33b514d050 --- /dev/null +++ b/.env @@ -0,0 +1,5 @@ +#Default env variables for docker compose quickstart +#defaults are empty values +RPC_PORT_MAPPING= +WS_PORT_MAPPING= +EXPLORER_PORT_MAPPING= diff --git a/quickstart/docker-compose.yml b/quickstart/docker-compose.yml index 0054360d28..45510bfa0d 100644 --- a/quickstart/docker-compose.yml +++ b/quickstart/docker-compose.yml @@ -39,8 +39,8 @@ services: depends_on: - bootnode ports: - - "8545" - - "8546" + - "${RPC_PORT_MAPPING}8545" + - "${WS_PORT_MAPPING}8546" explorer: build: context: explorer @@ -48,6 +48,6 @@ services: depends_on: - rpcnode ports: - - "3000" + - "${EXPLORER_PORT_MAPPING}3000" volumes: public-keys: \ No newline at end of file diff --git a/quickstart/runPantheonPrivateNetwork.sh b/quickstart/runPantheonPrivateNetwork.sh index 25892117c9..0bb446ee81 100755 --- a/quickstart/runPantheonPrivateNetwork.sh +++ b/quickstart/runPantheonPrivateNetwork.sh @@ -1,8 +1,54 @@ #!/bin/sh -e +me=`basename "$0"` -QUICKSTART_FOLDER=quickstart +PARAMS="" +while (( "$#" )); do + case "$1" in + -h|--help) + echo "Usage:" + exit 0 + ;; + -s|--skip-build) + SKIP_BUILD=true + shift 1 + ;; + -d|--use-default-static-ports) + export RPC_PORT_MAPPING="8545:" + export WS_PORT_MAPPING="8546:" + export EXPLORER_PORT_MAPPING="3000:" -me=`basename "$0"` + break 2 + ;; + --rpc-port) + export RPC_PORT_MAPPING="${2}:" + shift 2 + ;; + --ws-port) + export WS_PORT_MAPPING="${2}:" + shift 2 + ;; + --explorer-port) + export EXPLORER_PORT_MAPPING="${2}:" + shift 2 + ;; + --) # end argument parsing + shift + break + ;; + -*|--*=) # unsupported flags + echo "Error: Unsupported flag $1, try ${me} -h or ${me} --help for complete usage help." >&2 + exit 1 + ;; + *) # preserve positional arguments + PARAMS="$PARAMS $1" + shift + ;; + esac +done +# set positional arguments in their proper place +eval set -- "$PARAMS" + +QUICKSTART_FOLDER=quickstart if [ ! -f gradlew ]; then echo "Please, run this script from the project root using : ${QUICKSTART_FOLDER}/${me}" @@ -12,7 +58,10 @@ fi COMPOSE_CONFIG_FILE_OPTION="-f ${QUICKSTART_FOLDER}/docker-compose.yml" # Build and run containers and network -docker-compose ${COMPOSE_CONFIG_FILE_OPTION} build --force-rm + +if [ ! ${SKIP_BUILD} ];then + docker-compose ${COMPOSE_CONFIG_FILE_OPTION} build --force-rm +fi docker-compose ${COMPOSE_CONFIG_FILE_OPTION} up -d --scale node=4 ${QUICKSTART_FOLDER}/listQuickstartServices.sh \ No newline at end of file