Add subspace-tv FastAPI service with Unraid deployment
Includes FastAPI application with device authentication, Docker configuration, Bruno API tests, and git-based deployment scripts for Unraid. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
60
deploy.sh
Executable file
60
deploy.sh
Executable file
@@ -0,0 +1,60 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Configuration
|
||||
UNRAID_HOST="root@192.168.2.61"
|
||||
REMOTE_PATH="/boot/config/plugins/compose.manager/projects/subspace-tv"
|
||||
GIT_HOST="git.michaelsimard.ca"
|
||||
GIT_PORT="28"
|
||||
GIT_REPO="git@git.michaelsimard.ca:msimard/subspace-tv.git"
|
||||
|
||||
echo "=== Subspace TV - Deploy ==="
|
||||
echo ""
|
||||
|
||||
echo "Connecting to Unraid and deploying..."
|
||||
ssh "$UNRAID_HOST" bash <<EOF
|
||||
set -e
|
||||
cd "$REMOTE_PATH"
|
||||
|
||||
# Ensure SSH config exists for git server
|
||||
if [ ! -f ~/.ssh/config ] || ! grep -q "Host $GIT_HOST" ~/.ssh/config 2>/dev/null; then
|
||||
echo "ERROR: SSH not configured for git server"
|
||||
echo "Run ./setup-unraid.sh first"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Clone or pull repository
|
||||
if [ ! -d ".git" ]; then
|
||||
echo "Initial clone..."
|
||||
cd ..
|
||||
rm -rf subspace-tv
|
||||
git clone "$GIT_REPO" subspace-tv
|
||||
cd subspace-tv
|
||||
else
|
||||
echo "Pulling latest changes..."
|
||||
git fetch origin
|
||||
git reset --hard origin/main
|
||||
fi
|
||||
|
||||
# Fix permissions for /boot partition (FAT32)
|
||||
echo "Fixing file permissions..."
|
||||
chmod +x *.sh 2>/dev/null || true
|
||||
|
||||
# Validate .env
|
||||
if [ ! -f ".env" ]; then
|
||||
echo "ERROR: .env file missing"
|
||||
echo "Run ./setup-unraid.sh to copy .env"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Build and deploy
|
||||
echo "Building and starting container..."
|
||||
docker compose up -d --build
|
||||
|
||||
echo ""
|
||||
echo "Deployment complete"
|
||||
EOF
|
||||
|
||||
echo ""
|
||||
echo "=== Deploy Complete ==="
|
||||
./manage.sh status
|
||||
Reference in New Issue
Block a user