From 163c3b6c169bebafccd284cbb0b03a83d3c46fd7 Mon Sep 17 00:00:00 2001 From: Quentin Date: Sun, 15 Nov 2020 14:43:23 +0100 Subject: [PATCH] Propose a script to spawn a cluster quickly --- example/dev-cluster.sh | 54 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 example/dev-cluster.sh diff --git a/example/dev-cluster.sh b/example/dev-cluster.sh new file mode 100755 index 00000000..e896b6ba --- /dev/null +++ b/example/dev-cluster.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +set -e + +SCRIPT_FOLDER="`dirname \"$0\"`" +REPO_FOLDER="${SCRIPT_FOLDER}/../" +GARAGE_DEBUG="${REPO_FOLDER}/target/debug/" +GARAGE_RELEASE="${REPO_FOLDER}/target/release/" +PATH="${GARAGE_DEBUG}:${GARAGE_RELEASE}:$PATH" +FANCYCOLORS=("41m" "42m" "44m" "45m" "100m" "104m") + +export RUST_BACKTRACE=1 +export RUST_LOG=garage=info +MAIN_LABEL="\e[${FANCYCOLORS[0]}[main]\e[49m" + +for count in $(seq 1 3); do +CONF_PATH="/tmp/config.$count.toml" +LABEL="\e[${FANCYCOLORS[$count]}[$count]\e[49m" + +cat > $CONF_PATH <&1|while read r; do echo -en "$LABEL $r\n"; done) & +done + +until garage status 2>&1|grep -q Healthy ; do + echo -en "${MAIN_LABEL} cluster starting...\n" + sleep 1 +done +echo -en "${MAIN_LABEL} cluster started\n" + +wait -- 2.45.2