From 3648c65aa2848847d11adb568b6095755acfe40a Mon Sep 17 00:00:00 2001 From: phoenix Date: Wed, 5 Aug 2026 17:49:38 -0400 Subject: [PATCH] Removing unused garage files --- garage-init.sh | 17 ---- garage/Dockerfile | 18 ----- garage/entrypoint.sh | 161 ------------------------------------- garage/full-init-garage.sh | 109 ------------------------- garage/init-garage.sh | 36 --------- garage/init/Dockerfile | 19 ----- garage/init/entrypoint.sh | 0 garage/storage/Dockerfile | 19 ----- garage/storage/run.sh | 41 ---------- 9 files changed, 420 deletions(-) delete mode 100755 garage-init.sh delete mode 100644 garage/Dockerfile delete mode 100755 garage/entrypoint.sh delete mode 100644 garage/full-init-garage.sh delete mode 100755 garage/init-garage.sh delete mode 100644 garage/init/Dockerfile delete mode 100755 garage/init/entrypoint.sh delete mode 100644 garage/storage/Dockerfile delete mode 100755 garage/storage/run.sh diff --git a/garage-init.sh b/garage-init.sh deleted file mode 100755 index d8bd67a..0000000 --- a/garage-init.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -# Wait for Garage to be ready -echo "Waiting for Garage to be ready..." -until curl -s http://localhost:3902/health; do - sleep 2 -done - -# Set up the bucket -echo "Creating bucket..." -docker exec garage garage bucket create soaricarus-data - -# Set bucket permissions -echo "Setting bucket permissions..." -docker exec garage garage bucket allow soaricarus-data --read --write --owner - -echo "Garage setup complete!" diff --git a/garage/Dockerfile b/garage/Dockerfile deleted file mode 100644 index 5f4acaa..0000000 --- a/garage/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -# Use a base image with a shell (Alpine) -FROM alpine:latest - -# Install necessary tools -RUN apk add --no-cache curl - -# Copy the Garage binary from the official image -COPY --from=dxflrs/garage:v2.3.0 /garage /usr/local/bin/garage - -# Copy the entrypoint script -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x /entrypoint.sh - -# Set the entrypoint -ENTRYPOINT ["/entrypoint.sh"] - -# Pass through any arguments to Garage -CMD [] diff --git a/garage/entrypoint.sh b/garage/entrypoint.sh deleted file mode 100755 index 53161d9..0000000 --- a/garage/entrypoint.sh +++ /dev/null @@ -1,161 +0,0 @@ -#!/bin/sh -set -e - -BUCKET_NAME="${BUCKET_NAME:-soaricarus-storage}" -CREDENTIALS_FILE="/shared/garage-credentials.env" -SETUP_DONE="/shared/setup.done" -GARAGE_BIN="/usr/local/bin/garage" - -# Function to write credentials -write_credentials() { - local access_key="$1" - local secret_key="$2" - mkdir -p "$(dirname "$CREDENTIALS_FILE")" - cat > "$CREDENTIALS_FILE" << EOF -GARAGE_ACCESS_KEY_ID=$access_key -GARAGE_SECRET_ACCESS_KEY=$secret_key -GARAGE_BUCKET_NAME=$BUCKET_NAME -GARAGE_ENDPOINT=http://localhost:3900 -EOF - touch "$SETUP_DONE" - echo "✅ Credentials saved to $CREDENTIALS_FILE" -} - -sleep 20 - -echo "Starting garage" -GARAGE_COMMAND_EXEC="$GARAGE_BIN -c /etc/garage.toml server" - -sleep 10 - -# 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..." - -# Start Garage in background for setup (just the binary, no daemon subcommand) -echo "âŗ Starting Garage in background..." -echo "GARAGE_COMMAND_EXEC: $GARAGE_COMMAND_EXEC" -# $GARAGE_BIN "$@" & -# GARAGE_PID=$! -# $GARAGE_BIN -c /etc/garage.toml & GARAGE_PID=$! -$GARAGE_COMMAND_EXEC & GARAGE_PID=$! - -sleep 10 -sleep 10 -echo "GARAGE_PID: $GARAGE_PID" - -# echo "Command: $GARAGE_BIN $@" - -# Apply cluster layout -if ! $GARAGE_BIN layout show 2>/dev/null | grep -q "Current cluster layout"; then - sleep 5 - 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 10 - - echo "Assigning layout" - # $GARAGE_BIN layout assign --version 1 -z ny1 -c 4G $NODE_ID - $GARAGE_BIN --rpc-secret "$GARAGE_RPC_SECRET" layout assign -z ny1 -c 4G $NODE_ID - # $GARAGE_BIN status - # sleep 5 - # $GARAGE_BIN status - # 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" -else - echo "â„šī¸ Layout already applied" -fi - -sleep 10 - - -# Create bucket -echo "Bucket: $BUCKET_NAME" -if ! $GARAGE_BIN bucket info "$BUCKET_NAME" 2>/dev/null; then - echo "đŸ“Ļ Creating bucket: $BUCKET_NAME" - sleep 5 - $GARAGE_BIN bucket create "$BUCKET_NAME" - sleep 10 -else - echo "â„šī¸ Bucket $BUCKET_NAME already exists" -fi - - -# Handle key -#if [ -n "$AWS_ACCESS_KEY_ID" ] && [ -n "$AWS_SECRET_ACCESS_KEY" ]; then -# echo "🔑 Using pre-defined credentials from .env" -# if ! $GARAGE_BIN key info "$AWS_ACCESS_KEY_ID" 2>/dev/null; then -# $GARAGE_BIN key import "$AWS_ACCESS_KEY_ID" "$AWS_SECRET_ACCESS_KEY" "app-key" -# echo " ✅ Key imported: $AWS_ACCESS_KEY_ID" -# else -# echo " â„šī¸ Key already exists: $AWS_ACCESS_KEY_ID" -# fi -# ACCESS_KEY="$AWS_ACCESS_KEY_ID" -# SECRET_KEY="$AWS_SECRET_ACCESS_KEY" -#else -# echo "🔑 Generating new key..." -# KEY_OUTPUT=$($GARAGE_BIN key create --name "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" -#fi - -echo "🔑 Generating new key..." -KEY_OUTPUT=$($GARAGE_BIN key create "app-key") -echo "$KEY_OUTPUT" -sleep 15 - -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!" - -# 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" - -# Stop background Garage -echo "âšī¸ Stopping background Garage..." -kill "$GARAGE_PID" -wait "$GARAGE_PID" 2>/dev/null || true - -# Start Garage in foreground -echo "🚀 Starting Garage in foreground..." -# exec $GARAGE_BIN "$@" -sleep 20 -exec $GARAGE_COMMANDS_EXEC diff --git a/garage/full-init-garage.sh b/garage/full-init-garage.sh deleted file mode 100644 index c93be4b..0000000 --- a/garage/full-init-garage.sh +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/sh -set -e - -BUCKET_NAME="${BUCKET_NAME:-soaricarus-storage}" -CREDENTIALS_FILE="/shared/garage-credentials.env" -SETUP_DONE="/shared/setup.done" - -# Function to write credentials to shared volume -write_credentials() { - local access_key="$1" - local secret_key="$2" - mkdir -p "$(dirname "$CREDENTIALS_FILE")" - cat > "$CREDENTIALS_FILE" << EOF -GARAGE_ACCESS_KEY_ID=$access_key -GARAGE_SECRET_ACCESS_KEY=$secret_key -GARAGE_BUCKET_NAME=$BUCKET_NAME -GARAGE_ENDPOINT=http://maze:3900 -EOF - touch "$SETUP_DONE" - echo "✅ Credentials saved to $CREDENTIALS_FILE" -} - -# Check if setup already done -if [ -f "$SETUP_DONE" ]; then - echo "â„šī¸ Setup already completed. Starting Garage..." - # Source credentials if needed for the main Garage process - # shellcheck source=/dev/null - [ -f "$CREDENTIALS_FILE" ] && . "$CREDENTIALS_FILE" - exec /usr/local/bin/garage "$@" -fi - -echo "🔧 Running initial setup..." - -# Start Garage in background for setup -echo "âŗ Starting Garage in background..." -/usr/local/bin/garage "$@" & -GARAGE_PID=$! - -# Wait for Garage API 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!" - -# Apply layout if not already applied -if ! /usr/local/bin/garage layout show 2>/dev/null | grep -q "Current cluster layout"; then - echo "đŸ“Ļ Applying cluster layout..." - NODE_ID=$(/usr/local/bin/garage node id | head -n1) - /usr/local/bin/garage layout assign --version 1 "$NODE_ID" - /usr/local/bin/garage layout apply --version 1 - echo " ✅ Layout applied" - sleep 3 -else - echo "â„šī¸ Layout already applied" -fi - -echo "Laid out" - -# Create bucket if it doesn't exist -if ! /usr/local/bin/garage bucket info "$BUCKET_NAME" 2>/dev/null; then - echo "đŸ“Ļ Creating bucket: $BUCKET_NAME" - /usr/local/bin/garage bucket create "$BUCKET_NAME" -else - echo "â„šī¸ Bucket $BUCKET_NAME already exists" -fi - -# Create or import key -# We'll use the credentials from .env if provided, otherwise generate new ones -if [ -n "$AWS_ACCESS_KEY_ID" ] && [ -n "$AWS_SECRET_ACCESS_KEY" ]; then - echo "🔑 Using pre-defined AWS credentials from .env" - if ! /usr/local/bin/garage key info "$AWS_ACCESS_KEY_ID" 2>/dev/null; then - # Key doesn't exist, import it - /usr/local/bin/garage key import "$AWS_ACCESS_KEY_ID" "$AWS_SECRET_ACCESS_KEY" "app-key" - echo " ✅ Key imported: $AWS_ACCESS_KEY_ID" - else - echo " â„šī¸ Key already exists: $AWS_ACCESS_KEY_ID" - fi - ACCESS_KEY="$AWS_ACCESS_KEY_ID" - SECRET_KEY="$AWS_SECRET_ACCESS_KEY" -else - echo "🔑 Generating new key..." - KEY_OUTPUT=$(/usr/local/bin/garage key create --name "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" -fi - -# Grant permissions -/usr/local/bin/garage bucket allow --read --write --owner "$BUCKET_NAME" --key "$ACCESS_KEY" -echo " ✅ Permissions granted" - -# Write credentials to shared volume -write_credentials "$ACCESS_KEY" "$SECRET_KEY" - -echo "🎉 Setup complete!" -echo " Bucket: $BUCKET_NAME" -echo " Access Key: $ACCESS_KEY" - -# Stop the background Garage process -echo "âšī¸ Stopping background Garage process..." -kill "$GARAGE_PID" -wait "$GARAGE_PID" 2>/dev/null || true - -echo "🚀 Starting Garage in foreground..." -exec /usr/local/bin/garage "$@" - diff --git a/garage/init-garage.sh b/garage/init-garage.sh deleted file mode 100755 index 1650ede..0000000 --- a/garage/init-garage.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh -set -e - -BUCKET_NAME="${BUCKET_NAME:-soaricarus-storage}" -CREDENTIALS_FILE="/shared/garage-credentials.env" -SETUP_DONE="/shared/setup.done" - -echo "🔧 Running initial setup..." - -# Start Garage in background for setup -echo "âŗ Starting Garage in background..." -/usr/local/bin/garage "$@" & -GARAGE_PID=$! - -# Wait for Garage API 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!" - -# Apply layout if not already applied -#if ! /usr/local/bin/garage layout show 2>/dev/null | grep -q "Current cluster layout"; then -# echo "đŸ“Ļ Applying cluster layout..." -# NODE_ID=$(/usr/local/bin/garage node id | head -n1) -# echo $NODE_ID - # /usr/local/bin/garage layout assign --version 1 "$NODE_ID" - # /usr/local/bin/garage layout apply --version 1 -# echo " ✅ Layout applied" -# sleep 3 -#else - # echo "â„šī¸ Layout already applied" -# fi - -echo "Laid out" diff --git a/garage/init/Dockerfile b/garage/init/Dockerfile deleted file mode 100644 index 9979593..0000000 --- a/garage/init/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -# Use a base image with a shell (Alpine) -FROM alpine:latest - -# Install necessary tools -RUN apk add --no-cache curl - -# Copy the Garage binary from the official image -COPY --from=dxflrs/garage:v2.3.0 /garage /usr/local/bin/garage - -# Copy the entrypoint script -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x /entrypoint.sh - -# Set the entrypoint -ENTRYPOINT ["/entrypoint.sh"] - -# Pass through any arguments to Garage -CMD [] - diff --git a/garage/init/entrypoint.sh b/garage/init/entrypoint.sh deleted file mode 100755 index e69de29..0000000 diff --git a/garage/storage/Dockerfile b/garage/storage/Dockerfile deleted file mode 100644 index c5efaa6..0000000 --- a/garage/storage/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -# Use a base image with a shell (Alpine) -FROM alpine:latest - -# Install necessary tools -RUN apk add --no-cache curl - -# Copy the Garage binary from the official image -COPY --from=dxflrs/garage:v2.3.0 /garage /usr/local/bin/garage - -# Copy the entrypoint script -COPY run.sh /run.sh -RUN chmod +x /run.sh - -# Set the run -ENTRYPOINT ["/run.sh"] - -# Pass through any arguments to Garage -CMD [] - diff --git a/garage/storage/run.sh b/garage/storage/run.sh deleted file mode 100755 index a85fd41..0000000 --- a/garage/storage/run.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -set -e - -BUCKET_NAME="${BUCKET_NAME:-soaricarus-storage}" -CREDENTIALS_FILE="/shared/garage-credentials.env" -SETUP_DONE="/shared/setup.done" -GARAGE_BIN="/usr/local/bin/garage" - -# Function to write credentials -write_credentials() { - local access_key="$1" - local secret_key="$2" - mkdir -p "$(dirname "$CREDENTIALS_FILE")" - cat > "$CREDENTIALS_FILE" << EOF -GARAGE_ACCESS_KEY_ID=$access_key -GARAGE_SECRET_ACCESS_KEY=$secret_key -GARAGE_BUCKET_NAME=$BUCKET_NAME -GARAGE_ENDPOINT=http://localhost:3900 -EOF - touch "$SETUP_DONE" - echo "✅ Credentials saved to $CREDENTIALS_FILE" -} - -sleep 5 - -echo "Starting garage" -GARAGE_COMMAND_EXEC="$GARAGE_BIN -c /etc/garage.toml server" - -echo "Running" - - -# Start Garage in background for setup (just the binary, no daemon subcommand) -echo "âŗ Starting Garage in background..." -echo "GARAGE_COMMAND_EXEC: $GARAGE_COMMAND_EXEC" -# $GARAGE_BIN "$@" & -# GARAGE_PID=$! -# $GARAGE_BIN -c /etc/garage.toml & GARAGE_PID=$! -$GARAGE_COMMAND_EXEC & GARAGE_PID=$! - -sleep 10 -echo "GARAGE_PID: $GARAGE_PID"