Files

82 lines
2.2 KiB
Bash
Raw Permalink Normal View History

2025-11-26 15:31:41 +01:00
#!/bin/bash
# RunPod container startup script
# This script initializes the container environment and starts all services
set -e
echo "========================================"
echo " RunPod AI Orchestrator - Starting"
echo "========================================"
2025-11-27 23:23:08 +01:00
# [1/6] Start SSH server (required by RunPod)
echo "[1/6] Starting SSH server..."
2025-11-26 15:31:41 +01:00
mkdir -p ~/.ssh
chmod 700 ~/.ssh
echo "$PUBLIC_KEY" >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh/authorized_keys
service ssh start
echo " ✓ SSH server started"
2025-11-27 23:23:08 +01:00
# [2/6] Cloning repositories
echo "[2/6] Cloning repositories..."
2025-11-26 15:31:41 +01:00
ssh-keyscan -p 2222 -t rsa dev.pivoine.art >> ~/.ssh/known_hosts
chmod 700 ~/.ssh/known_hosts
if [ ! -d "$PWD/bin" ] ; then
git clone https://dev.pivoine.art/valknar/bin.git "$PWD/bin"
echo " ✓ bin cloned"
else
2025-11-26 18:04:53 +01:00
cd "$PWD/bin" && git fetch && git reset --hard origin/main
2025-11-26 15:31:41 +01:00
echo " ✓ bin updated"
cd -
fi
if [ ! -d "$PWD/orchestrator" ] ; then
git clone https://dev.pivoine.art/valknar/runpod-ai-orchestrator.git "$PWD/orchestrator"
echo " ✓ orchestrator cloned"
else
2025-11-26 18:04:53 +01:00
cd "$PWD/orchestrator" && git fetch && git reset --hard origin/main
2025-11-26 15:31:41 +01:00
echo " ✓ orchestrator updated"
cd -
fi
2025-11-27 23:23:08 +01:00
# [3/6] Add $PWD/bin to PATH for arty and custom scripts
echo "[3/6] Configuring PATH..."
2025-11-26 15:31:41 +01:00
ln -sf "$PWD/bin/artifact_git_download.sh" /usr/local/bin/arty
2025-11-28 11:11:52 +01:00
cp -s $PWD/bin/*.sh /usr/local/bin/
2025-11-26 15:31:41 +01:00
echo " ✓ PATH updated: $PWD/bin added"
2025-11-27 23:23:08 +01:00
# [4/6] Setting up with arty
echo "[4/6] Setting up with arty..."
2025-11-27 11:41:21 +01:00
if [ ! "$SKIP_ARTY_SETUP" ] ; then
cd "$PWD/orchestrator"
arty setup
cd -
echo " ✓ Setup complete"
else
echo " ⏭ Skipping"
fi
2025-11-26 15:31:41 +01:00
2025-11-27 23:23:08 +01:00
# [5/6] Setting up tailscale
echo "[5/6] Starting tailscale..."
2025-11-27 11:51:21 +01:00
cd "$PWD/orchestrator"
arty tailscale/start
cd -
echo " ✓ Started successfully"
2025-11-27 23:23:08 +01:00
# [6/6] Starting supervisor
echo "[6/6] Starting supervisor..."
2025-11-27 11:51:21 +01:00
cd "$PWD/orchestrator"
arty supervisor/start
cd -
echo " ✓ Started successfully"
2025-11-26 15:31:41 +01:00
# Display connection information
echo ""
echo "========================================"
echo " Container Ready"
echo "========================================"
echo "========================================"
# Keep container running
echo "Container is running. Press Ctrl+C to stop."
sleep infinity