Getting closer
soaricarus_api CI / Check (pull_request) Successful in 6m2s
soaricarus_api CI / Rustfmt (pull_request) Successful in 6m11s
soaricarus_api CI / Test Suite (pull_request) Successful in 8m25s
soaricarus_api CI / Clippy (pull_request) Successful in 3m12s
soaricarus_api CI / build (pull_request) Successful in 4m34s

This commit is contained in:
2026-07-28 13:08:33 -04:00
parent e2a5e02aad
commit f07e0108cd
2 changed files with 83 additions and 47 deletions
+16 -16
View File
@@ -42,22 +42,22 @@ services:
# - ./path/to/your/web-api-repo:/app # - ./path/to/your/web-api-repo:/app
# --- songparser service --- # --- songparser service ---
songparser: # songparser:
build: # build:
context: ../songparser # context: ../songparser
ssh: ["default"] # ssh: ["default"]
dockerfile: Dockerfile # dockerfile: Dockerfile
container_name: songparser # container_name: songparser
restart: unless-stopped # restart: unless-stopped
env_file: # env_file:
- ../songparser/.env # - ../songparser/.env
depends_on: # depends_on:
- api # - api
- main_db # - main_db
- auth_api # - auth_api
- auth_db # - auth_db
networks: # networks:
- soaricarus-network # - soaricarus-network
# --- storage service --- # --- storage service ---
maze: maze:
build: build:
+67 -31
View File
@@ -21,66 +21,101 @@ EOF
echo "✅ Credentials saved to $CREDENTIALS_FILE" echo "✅ Credentials saved to $CREDENTIALS_FILE"
} }
echo "Sleeping for a bit"
sleep 5
GARAGE_COMMAND_EXEC="$GARAGE_BIN -c /etc/garage.toml server"
# Check if setup already completed # Check if setup already completed
if [ -f "$SETUP_DONE" ]; then if [ -f "$SETUP_DONE" ]; then
echo "️ Setup already completed. Starting Garage..." echo "️ Setup already completed. Starting Garage..."
exec $GARAGE_BIN "$@" exec $GARAGE_COMMANDS_EXEC
fi fi
echo "🔧 First-time setup - initializing Garage..." echo "🔧 First-time setup - initializing Garage..."
# Start Garage in background for setup (just the binary, no daemon subcommand) # Start Garage in background for setup (just the binary, no daemon subcommand)
echo "⏳ Starting Garage in background..." echo "⏳ Starting Garage in background..."
$GARAGE_BIN "$@" & echo "GARAGE_BIN: $GARAGE_COMMAND_EXEC"
GARAGE_PID=$! # $GARAGE_BIN "$@" &
# GARAGE_PID=$!
# $GARAGE_BIN -c /etc/garage.toml & GARAGE_PID=$!
$GARAGE_COMMAND_EXEC & GARAGE_PID=$!
# Wait for Garage to be ready echo "GARAGE_PID: $GARAGE_PID"
echo "⏳ Waiting for Garage API..."
until curl -s -f "http://localhost:3901/v0/status" > /dev/null 2>&1; do # echo "Command: $GARAGE_BIN $@"
echo " Not ready yet, sleeping 2s..."
sleep 2
done
echo "✅ Garage API is responding!"
# Apply cluster layout # Apply cluster layout
if ! $GARAGE_BIN layout show 2>/dev/null | grep -q "Current cluster layout"; then if ! $GARAGE_BIN layout show 2>/dev/null | grep -q "Current cluster layout"; then
echo "📦 Applying cluster layout..." echo "📦 Applying cluster layout..."
NODE_ID=$($GARAGE_BIN node id | head -n1) NODE_ID=$($GARAGE_BIN node id | head -n1)
$GARAGE_BIN layout assign --version 1 "$NODE_ID" echo "Node ID: $NODE_ID"
sleep 5
echo "Assigning layout"
# $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
# $GARAGE_BIN status
echo "Show layout"
$GARAGE_BIN layout show
sleep 5
echo "Applying layout"
$GARAGE_BIN layout apply --version 1 $GARAGE_BIN layout apply --version 1
echo " ✅ Layout applied" echo " ✅ Layout applied"
sleep 2 sleep 10
else else
echo "️ Layout already applied" echo "️ Layout already applied"
fi fi
# Create bucket # Create bucket
echo "Bucket: $BUCKET_NAME"
if ! $GARAGE_BIN bucket info "$BUCKET_NAME" 2>/dev/null; then if ! $GARAGE_BIN bucket info "$BUCKET_NAME" 2>/dev/null; then
echo "📦 Creating bucket: $BUCKET_NAME" echo "📦 Creating bucket: $BUCKET_NAME"
$GARAGE_BIN bucket create "$BUCKET_NAME" $GARAGE_BIN bucket create "$BUCKET_NAME"
sleep 10
else else
echo "️ Bucket $BUCKET_NAME already exists" echo "️ Bucket $BUCKET_NAME already exists"
fi fi
# Handle key # Handle key
if [ -n "$AWS_ACCESS_KEY_ID" ] && [ -n "$AWS_SECRET_ACCESS_KEY" ]; then #if [ -n "$AWS_ACCESS_KEY_ID" ] && [ -n "$AWS_SECRET_ACCESS_KEY" ]; then
echo "🔑 Using pre-defined credentials from .env" # echo "🔑 Using pre-defined credentials from .env"
if ! $GARAGE_BIN key info "$AWS_ACCESS_KEY_ID" 2>/dev/null; then # 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" # $GARAGE_BIN key import "$AWS_ACCESS_KEY_ID" "$AWS_SECRET_ACCESS_KEY" "app-key"
echo " ✅ Key imported: $AWS_ACCESS_KEY_ID" # echo " ✅ Key imported: $AWS_ACCESS_KEY_ID"
else # else
echo " ️ Key already exists: $AWS_ACCESS_KEY_ID" # echo " ️ Key already exists: $AWS_ACCESS_KEY_ID"
fi # fi
ACCESS_KEY="$AWS_ACCESS_KEY_ID" # ACCESS_KEY="$AWS_ACCESS_KEY_ID"
SECRET_KEY="$AWS_SECRET_ACCESS_KEY" # SECRET_KEY="$AWS_SECRET_ACCESS_KEY"
else #else
echo "🔑 Generating new key..." # echo "🔑 Generating new key..."
KEY_OUTPUT=$($GARAGE_BIN key create --name "app-key") # KEY_OUTPUT=$($GARAGE_BIN key create --name "app-key")
echo "$KEY_OUTPUT" # echo "$KEY_OUTPUT"
ACCESS_KEY=$(echo "$KEY_OUTPUT" | grep 'Key ID:' | awk '{print $3}') # ACCESS_KEY=$(echo "$KEY_OUTPUT" | grep 'Key ID:' | awk '{print $3}')
SECRET_KEY=$(echo "$KEY_OUTPUT" | grep 'Secret key:' | awk '{print $3}') # SECRET_KEY=$(echo "$KEY_OUTPUT" | grep 'Secret key:' | awk '{print $3}')
echo " ✅ Key generated: $ACCESS_KEY" # echo " ✅ Key generated: $ACCESS_KEY"
fi #fi
sleep 15
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"
# 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 # Grant permissions
$GARAGE_BIN bucket allow --read --write --owner "$BUCKET_NAME" --key "$ACCESS_KEY" $GARAGE_BIN bucket allow --read --write --owner "$BUCKET_NAME" --key "$ACCESS_KEY"
@@ -100,4 +135,5 @@ wait "$GARAGE_PID" 2>/dev/null || true
# Start Garage in foreground # Start Garage in foreground
echo "🚀 Starting Garage in foreground..." echo "🚀 Starting Garage in foreground..."
exec $GARAGE_BIN "$@" # exec $GARAGE_BIN "$@"
exec $GARAGE_COMMANDS_EXEC