From 10cec1d7c7ed431602fcb154a7d414b0e464578c Mon Sep 17 00:00:00 2001 From: phoenix Date: Thu, 30 Jul 2026 13:23:17 -0400 Subject: [PATCH] Getting closer --- garage/entrypoint.sh | 47 +++++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/garage/entrypoint.sh b/garage/entrypoint.sh index 5b68c9e..1536560 100755 --- a/garage/entrypoint.sh +++ b/garage/entrypoint.sh @@ -21,14 +21,23 @@ EOF echo "✅ Credentials saved to $CREDENTIALS_FILE" } +sleep 20 +echo "Garage secret" +echo "$GARAGE_RPC_SECRET" +echo "Should be printed" +sleep 20 + echo "Sleeping for a bit" sleep 5 +echo "Starting garage" GARAGE_COMMAND_EXEC="$GARAGE_BIN -c /etc/garage.toml server" # Check if setup already completed if [ -f "$SETUP_DONE" ]; then echo "â„šī¸ Setup already completed. Starting Garage..." + sleep 5 exec $GARAGE_COMMANDS_EXEC + exit fi echo "🔧 First-time setup - initializing Garage..." @@ -44,11 +53,21 @@ $GARAGE_COMMAND_EXEC & GARAGE_PID=$! echo "GARAGE_PID: $GARAGE_PID" # echo "Command: $GARAGE_BIN $@" +sleep 20 +echo "Garage secret" +echo "$GARAGE_RPC_SECRET" +echo "Should be printed" +sleep 20 # Apply cluster layout if ! $GARAGE_BIN layout show 2>/dev/null | grep -q "Current cluster layout"; then echo "đŸ“Ļ Applying cluster layout..." NODE_ID=$($GARAGE_BIN node id | head -n1) + if [ -z "$NODE_ID" ]; then + echo "$NODE_ID is empty" + sleep 5 + exit + fi echo "Node ID: $NODE_ID" sleep 5 @@ -56,13 +75,14 @@ if ! $GARAGE_BIN layout show 2>/dev/null | grep -q "Current cluster layout"; the # $GARAGE_BIN layout assign --version 1 -z ny1 -c 4G $NODE_ID $GARAGE_BIN layout assign -z ny1 -c 4G $NODE_ID # $GARAGE_BIN status - sleep 5 + # sleep 5 # $GARAGE_BIN status - echo "Show layout" - $GARAGE_BIN layout show - sleep 5 + # echo "Show layout" + # $GARAGE_BIN layout show + sleep 10 echo "Applying layout" $GARAGE_BIN layout apply --version 1 + # $GARAGE_BIN layout apply echo " ✅ Layout applied" sleep 10 else @@ -101,29 +121,32 @@ fi # echo " ✅ Key generated: $ACCESS_KEY" #fi -sleep 15 echo "🔑 Generating new key..." -KEY_OUTPUT=$($GARAGE_BIN key create --name "app-key") +KEY_OUTPUT=$($GARAGE_BIN key create "app-key") echo "$KEY_OUTPUT" ACCESS_KEY=$(echo "$KEY_OUTPUT" | grep 'Key ID:' | awk '{print $3}') SECRET_KEY=$(echo "$KEY_OUTPUT" | grep 'Secret key:' | awk '{print $3}') echo " ✅ Key generated: $ACCESS_KEY" +sleep 5 # Wait for Garage to be ready -echo "âŗ Waiting for Garage API..." -until curl -s -f "http://localhost:3900/v0/status" > /dev/null 2>&1; do - echo " Not ready yet, sleeping 2s..." - sleep 2 -done -echo "✅ Garage API is responding!" +# echo "âŗ Waiting for Garage API..." +# until curl -s -f "http://localhost:3900/v0/status" > /dev/null 2>&1; do +# echo " Not ready yet, sleeping 2s..." +# sleep 2 +# done +# echo "✅ Garage API is responding!" # Grant permissions $GARAGE_BIN bucket allow --read --write --owner "$BUCKET_NAME" --key "$ACCESS_KEY" echo " ✅ Permissions granted" +sleep 10 # Save credentials write_credentials "$ACCESS_KEY" "$SECRET_KEY" +sleep 10 + echo "🎉 Setup complete!" echo " Bucket: $BUCKET_NAME" echo " Access Key: $ACCESS_KEY"