Initial commit: Add HomeBase application with Docker support, deployment scripts, and health check endpoint
Some checks failed
Deploy to BeePC / deploy (push) Has been cancelled
Some checks failed
Deploy to BeePC / deploy (push) Has been cancelled
This commit is contained in:
68
scripts/deploy.sh
Normal file
68
scripts/deploy.sh
Normal file
@@ -0,0 +1,68 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Bash deployment script for HomeBase
|
||||
# Run this from the project root: bash scripts/deploy.sh
|
||||
|
||||
# Configuration
|
||||
REMOTE_USER="spencer"
|
||||
REMOTE_HOST="beepc"
|
||||
REMOTE_DIR="/home/spencer/homebase"
|
||||
APP_NAME="homebase"
|
||||
|
||||
echo "🚀 Starting deployment to ${REMOTE_USER}@${REMOTE_HOST}..."
|
||||
|
||||
# Create remote directory if it doesn't exist
|
||||
echo "📁 Ensuring remote directory exists..."
|
||||
ssh ${REMOTE_USER}@${REMOTE_HOST} "mkdir -p ${REMOTE_DIR}"
|
||||
|
||||
# Sync files to remote server (excluding unnecessary files)
|
||||
echo "📦 Syncing files to remote server..."
|
||||
rsync -avz --delete \
|
||||
--exclude 'node_modules' \
|
||||
--exclude '.git' \
|
||||
--exclude '.github' \
|
||||
--exclude '*.log' \
|
||||
./ ${REMOTE_USER}@${REMOTE_HOST}:${REMOTE_DIR}/
|
||||
|
||||
# Deploy on remote server
|
||||
echo "🐳 Deploying application on remote server..."
|
||||
ssh ${REMOTE_USER}@${REMOTE_HOST} << 'ENDSSH'
|
||||
cd /home/spencer/homebase
|
||||
|
||||
# Stop and remove existing container
|
||||
echo "⏹️ Stopping existing container..."
|
||||
docker compose down 2>/dev/null || true
|
||||
|
||||
# Build and start new container
|
||||
echo "🔨 Building and starting container..."
|
||||
docker compose up -d --build
|
||||
|
||||
# Set up systemd service for auto-start on boot
|
||||
echo "⚙️ Setting up systemd service..."
|
||||
sudo cp homebase.service /etc/systemd/system/homebase.service
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable homebase.service
|
||||
sudo systemctl start homebase.service 2>/dev/null || true
|
||||
|
||||
# Wait for container to be healthy
|
||||
echo "⏳ Waiting for container to start..."
|
||||
sleep 5
|
||||
|
||||
# Check if container is running
|
||||
if docker ps | grep -q homebase; then
|
||||
echo "✅ Container is running!"
|
||||
docker compose logs --tail=20
|
||||
else
|
||||
echo "❌ Container failed to start!"
|
||||
docker compose logs --tail=50
|
||||
exit 1
|
||||
fi
|
||||
ENDSSH
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "✅ Deployment successful!"
|
||||
echo "🌐 App should be available at http://homebase.sketchferret.com"
|
||||
else
|
||||
echo "❌ Deployment failed!"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user