Implements git-based deployment workflow with three scripts: - setup-unraid.sh: One-time SSH and git configuration - deploy.sh: Automated deployment via git pull and docker compose - manage.sh: Remote management utilities (logs, restart, status) Configuration targets 192.168.2.61 at /mnt/user/docker/custom-dockers/discord-stock-bot 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
45 lines
1.0 KiB
Bash
Executable File
45 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# deploy.sh - Git-based deployment to Unraid server
|
|
|
|
set -e
|
|
|
|
# Configuration
|
|
UNRAID_HOST="${UNRAID_HOST:-192.168.2.61}"
|
|
REMOTE_PATH="/mnt/user/docker/custom-dockers/discord-stock-bot"
|
|
GIT_REPO="git@git.michaelsimard.ca:msimard/discord-stock-bot.git"
|
|
|
|
echo "Deploying discord-stock-bot to ${UNRAID_HOST}..."
|
|
|
|
ssh ${UNRAID_HOST} bash << EOF
|
|
set -e
|
|
|
|
# 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
|
|
|
|
# Check if .env exists
|
|
if [ ! -f .env ]; then
|
|
echo "WARNING: .env file not found!"
|
|
echo "Please create ${REMOTE_PATH}/.env with required configuration"
|
|
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
|