aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorTrinity Pointard <trinity.pointard@gmail.com>2021-11-08 09:25:14 +0100
committerTrinity Pointard <trinity.pointard@gmail.com>2021-11-08 09:25:14 +0100
commit179d18fcecafc209d127604f78f18baa7f4926f1 (patch)
tree6bf4495f4b814219808c34d0da4200a0d45858c1 /example
parent610e5549033364a437a3e264716508ff2b6c43a0 (diff)
downloadmknet-179d18fcecafc209d127604f78f18baa7f4926f1.tar.gz
mknet-179d18fcecafc209d127604f78f18baa7f4926f1.zip
add support for upstream port and add garage example script
Diffstat (limited to 'example')
-rwxr-xr-xexample/deploy_garage.sh51
1 files changed, 51 insertions, 0 deletions
diff --git a/example/deploy_garage.sh b/example/deploy_garage.sh
new file mode 100755
index 0000000..8377673
--- /dev/null
+++ b/example/deploy_garage.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+set -euo pipefail
+IFS=$'\n\t'
+
+GARAGE_PATH=/home/trinity/tmp/garage/target/release/garage
+STORAGE_PATH=/tmp/garage-testnet
+export RPC_SECRET=3e9abff5f9e480afbadb46a77b7a26fe0e404258f0dc3fd5386b0ba8e0ad2fba
+
+NODE_STORAGE_PATH=${STORAGE_PATH}/${ZONE}/${HOST}
+BOOTSTRAP_FILE=${STORAGE_PATH}/bootstrap_peer
+export GARAGE_CONFIG_FILE=${NODE_STORAGE_PATH}/garage.toml
+
+
+mkdir -p ${NODE_STORAGE_PATH}
+cd ${NODE_STORAGE_PATH}
+rm ${BOOTSTRAP_FILE} 2>/dev/null || true
+
+cat > ${GARAGE_CONFIG_FILE} << EOF
+metadata_dir = "${NODE_STORAGE_PATH}/meta"
+data_dir = "${NODE_STORAGE_PATH}/data"
+
+replication_mode = "3"
+
+rpc_bind_addr = "[::]:3901"
+rpc_public_addr = "[${IP}]:3901"
+rpc_secret = "${RPC_SECRET}"
+
+bootstrap_peers=[]
+
+[s3_api]
+s3_region = "garage"
+api_bind_addr = "[::]:3900"
+
+[s3_web]
+bind_addr = "[::]:3902"
+root_domain = ".web.garage"
+index = "index.html"
+EOF
+
+RUST_LOG=garage=debug ${GARAGE_PATH} server 2>> ${NODE_STORAGE_PATH}/logs & disown
+sleep 2
+
+CONFIG_NODE_FPATH=(${STORAGE_PATH}/*{,/*}/garage.toml)
+
+SELF_ID=$(${GARAGE_PATH} node-id 2>/dev/null)
+SHORT_ID=$(echo ${SELF_ID} | cut -c-64)
+
+${GARAGE_PATH} -c ${CONFIG_NODE_FPATH[0]} node connect ${SELF_ID}
+sleep ${ID}
+${GARAGE_PATH} -c ${CONFIG_NODE_FPATH[0]} node configure -z ${ZONE:-unzonned-${HOST}} -c 1 -t ${HOST} ${SHORT_ID}