Files
unraid-dashboard/deploy.sh
Michael Simard 8396fbcf6f Add Docker deployment for Unraid
- Dockerfile with nginx:alpine for static file serving
- docker-compose.yml with port 9113:80 mapping
- deploy.sh for git-based deployment to Unraid
- setup-unraid.sh for initial server configuration
- manage.sh for container operations (logs, status, restart, etc.)
- .gitignore to exclude config.js

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 09:43:02 -06:00

64 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
# deploy.sh - Git-based deployment to Unraid server
set -e
# Configuration
UNRAID_HOST="${UNRAID_HOST:-root@192.168.2.61}"
REMOTE_PATH="/boot/config/plugins/compose.manager/projects/unraid-dash"
GIT_REPO="git@git.michaelsimard.ca:msimard/unraid-dashboard.git"
echo "Deploying unraid-dash to ${UNRAID_HOST}..."
ssh ${UNRAID_HOST} bash << EOF
set -e
# Ensure SSH config for git server (port 28)
mkdir -p ~/.ssh
chmod 700 ~/.ssh
if ! grep -q "^Host git.michaelsimard.ca" ~/.ssh/config 2>/dev/null; then
echo "Configuring SSH for git.michaelsimard.ca (port 28)..."
cat >> ~/.ssh/config << 'SSHCONFIG'
Host git.michaelsimard.ca
Port 28
SSHCONFIG
chmod 600 ~/.ssh/config
fi
# Clone or pull repository
if [ -d "${REMOTE_PATH}/.git" ]; then
echo "Repository exists, pulling latest changes..."
cd ${REMOTE_PATH}
git pull
else
echo "Cloning repository..."
git clone ${GIT_REPO} ${REMOTE_PATH}
cd ${REMOTE_PATH}
fi
# Fix file permissions for Docker build (required for /boot partition)
echo "Fixing file permissions..."
chmod -R 755 ${REMOTE_PATH}
chmod 644 ${REMOTE_PATH}/*.html ${REMOTE_PATH}/*.css ${REMOTE_PATH}/*.js ${REMOTE_PATH}/*.yml ${REMOTE_PATH}/*.md 2>/dev/null || true
# Check if config.js exists
if [ ! -f config.js ]; then
echo "WARNING: config.js file not found!"
echo "Please create ${REMOTE_PATH}/config.js with required configuration"
echo "You can copy from config.example.js and modify as needed"
exit 1
fi
# Build and deploy
echo "Building and starting container..."
docker compose up -d --build
# Show status
echo ""
echo "Deployment complete!"
docker compose ps
echo ""
echo "View logs with: ssh ${UNRAID_HOST} 'cd ${REMOTE_PATH} && docker compose logs -f'"
EOF