61 lines
1.3 KiB
Bash
Executable File
61 lines
1.3 KiB
Bash
Executable File
#!/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/master
|
|
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
|