Add deployment script and health checks for zero-downtime updates
This commit is contained in:
25
scripts/deploy.sh
Executable file
25
scripts/deploy.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "🚀 Starting optimized deployment..."
|
||||
|
||||
# Pull latest changes
|
||||
echo "📥 Pulling latest changes from git..."
|
||||
git pull
|
||||
|
||||
# Build new image in background (doesn't stop running container)
|
||||
echo "🔨 Building new Docker image (this runs while app is still online)..."
|
||||
docker compose build
|
||||
|
||||
# Quick restart with pre-built image
|
||||
echo "🔄 Restarting with new image (minimal downtime)..."
|
||||
docker compose up -d
|
||||
|
||||
# Clean up old images
|
||||
echo "🧹 Cleaning up old images..."
|
||||
docker image prune -f
|
||||
|
||||
echo "✅ Deployment complete!"
|
||||
echo ""
|
||||
echo "📊 Showing logs (Ctrl+C to exit)..."
|
||||
docker compose logs -f
|
||||
Reference in New Issue
Block a user