mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
db migration
testing live in another VM environment for self hosting Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Wraps the Garage daemon: starts it in the background, runs one-time cluster
|
||||
# initialization using the local RPC connection, then hands control back to
|
||||
# the daemon process. Safe to re-run — all operations are idempotent.
|
||||
set -e
|
||||
|
||||
garage server &
|
||||
DAEMON_PID=$!
|
||||
|
||||
echo "Waiting for Garage to be ready..."
|
||||
until garage status > /dev/null 2>&1; do
|
||||
sleep 2
|
||||
done
|
||||
echo "Garage is up. Running cluster initialization..."
|
||||
|
||||
NODE_ID=$(garage node id 2>/dev/null | head -1 | awk '{print $1}')
|
||||
garage layout assign "$NODE_ID" -z dc1 -c 100G 2>/dev/null || true
|
||||
garage layout apply --version 1 2>/dev/null || true
|
||||
|
||||
garage bucket create "$S3_BUCKET" 2>/dev/null || true
|
||||
|
||||
# --yes skips the interactive confirmation prompt.
|
||||
garage key import "$S3_ACCESS_KEY" "$S3_SECRET_KEY" -n starr-app --yes 2>/dev/null || true
|
||||
|
||||
garage bucket allow "$S3_BUCKET" --read --write --owner --key "$S3_ACCESS_KEY" 2>/dev/null || true
|
||||
|
||||
# Flag file read by the healthcheck — ensures the backend waits for full init.
|
||||
touch /var/lib/garage/meta/.ready
|
||||
echo "Garage init complete."
|
||||
|
||||
wait $DAEMON_PID
|
||||
Reference in New Issue
Block a user