Files
discord-stock-bot/deploy.sh
Michael Simard 3728649900 Fix permission denied error on Unraid deployment
Resolved Docker container startup failures on Unraid /boot partition.

Changes:
- Remove development volume mount from docker-compose.yml
- Container now uses files baked into image during build
- Remove obsolete docker-compose version attribute
- Add permission fix in deploy.sh for /boot partition

The volume mount was causing permission issues by exposing /boot files
with restrictive permissions directly to the container.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 19:07:04 -06:00

63 lines
1.6 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/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
# 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}/*.py ${REMOTE_PATH}/*.txt ${REMOTE_PATH}/*.md 2>/dev/null || true
# 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