#!/bin/bash # Deploy hatch.surf API — triggered by Gitea webhook or manually set -e echo "=== Deploying hatch API ===" cd /home/nara/apps/web # Pull latest changes from GitHub (primary source) git pull github main # Push to Gitea (push-mirror) git push origin main # Stop old containers docker compose down 2>/dev/null || true # Rebuild and start docker compose build hatch docker compose --profile with-caddy up -d # Verify sleep 3 if curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/healthz | grep -q "200"; then echo "✅ hatch API deployed successfully!" echo " Health: http://localhost:8080/healthz" echo " Ready: http://localhost:8080/readyz" else echo "❌ Deployment failed!" docker compose logs --tail=20 hatch exit 1 fi