- docker-compose.yaml: remove port binding; add VIRTUAL_HOST/LETSENCRYPT_HOST env vars for nginx-proxy auto-routing; add internal + external proxy networks - .woodpecker.yml: consolidate build steps into single ci step; add deploy-main step that builds + deploys on every push to main; keep deploy-tag for registry-pull deploys on version tags - deploy/deploy.sh: simplify for manual/emergency use on existing server; add --from-registry flag for registry pull vs local build - Remove deploy/setup-server.sh and deploy/nginx/ (not needed on existing server) Co-Authored-By: Paperclip <noreply@paperclip.ing>
38 lines
1019 B
Bash
38 lines
1019 B
Bash
#!/usr/bin/env bash
|
|
# deploy.sh — Manual redeploy on an existing Docker server.
|
|
# Normally Woodpecker CI handles deploys automatically on push to main or tag.
|
|
# Use this script only for manual/emergency redeploys.
|
|
# Usage: bash deploy/deploy.sh [--from-registry]
|
|
# --from-registry Pull the pre-built image from registry instead of building locally
|
|
|
|
set -euo pipefail
|
|
|
|
APP_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
cd "$APP_DIR"
|
|
|
|
FROM_REGISTRY=false
|
|
[[ "${1:-}" == "--from-registry" ]] && FROM_REGISTRY=true
|
|
|
|
echo "==> Pulling latest code"
|
|
git pull --ff-only
|
|
|
|
if $FROM_REGISTRY; then
|
|
echo "==> Pulling pre-built image from registry"
|
|
docker compose pull bridge
|
|
else
|
|
echo "==> Building image locally"
|
|
docker compose build --no-cache bridge
|
|
fi
|
|
|
|
echo "==> Restarting services"
|
|
docker compose up -d --remove-orphans
|
|
|
|
echo "==> Waiting for health check"
|
|
sleep 5
|
|
docker compose ps bridge
|
|
docker compose logs --tail=20 bridge
|
|
|
|
echo ""
|
|
echo "=== Deploy complete ==="
|
|
echo "Health endpoint: https://ghl.cast.ph/health"
|