Compare commits

...

2 Commits

Author SHA1 Message Date
Hördle Bot
21b53a692b Fix healthcheck to use curl instead of wget for Alpine compatibility 2025-11-22 16:57:43 +01:00
Hördle Bot
9a072061a1 Add deployment script and health checks for zero-downtime updates 2025-11-22 16:56:30 +01:00
2 changed files with 31 additions and 0 deletions

View File

@@ -18,6 +18,12 @@ services:
volumes:
- ./data:/app/data
- ./public/uploads:/app/public/uploads
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:3000/api/daily" ]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# Initialize DB if needed and run migration
command: >
sh -c "npx -y prisma@6.19.0 db push && node scripts/migrate-covers.mjs && node server.js"

25
scripts/deploy.sh Executable file
View 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