#!/usr/bin/env bash set -euo pipefail # Host: SATURN # Run this script from SATURN to commit, push, deploy, and smoke-test. VPS="ubuntu-4gb-hel1-1" REPO_DIR="/home/oskar/projects/gethumanai-landing" FORGEJO_REMOTE="ssh://git@100.108.208.3:222/oskar/gethumanai-landing.git" # ── 1. Commit & push (SATURN) ────────────────────────────────────────────── # Host: SATURN cd "$REPO_DIR" if [ -n "$(git status --porcelain)" ]; then git add -A git commit -m "chore: deploy $(date '+%Y-%m-%d %H:%M')" fi git push origin main # ── 2. Pull, rebuild, smoke-test on VPS ─────────────────────────────────── # Host: ubuntu-4gb-hel1-1 ssh "$VPS" bash -s <<'REMOTE' set -euo pipefail DEPLOY_DIR="/home/oskar/gethumanai-landing" if [ ! -d "$DEPLOY_DIR/.git" ]; then git clone ssh://git@100.108.208.3:222/oskar/gethumanai-landing.git "$DEPLOY_DIR" fi cd "$DEPLOY_DIR" git pull origin main docker compose up -d --build --remove-orphans # ── 3. Smoke test via host port 8080 ────────────────────────────────────── # Host: ubuntu-4gb-hel1-1 # Port mapping adds a second network to the container, making the IP list # ambiguous — use localhost:8080 (published port) for all checks instead. echo "Waiting for container to be ready..." sleep 2 BASE="http://localhost:8080" smoke_check() { local path="$1" local expect="$2" local body body=$(curl -sf --max-time 5 "${BASE}${path}") || { echo "FAIL GET ${path} — no response (curl exit $?)" docker compose logs --tail=40 return 1 } if echo "$body" | grep -qF "$expect"; then echo "OK GET ${path} — found: ${expect}" else echo "FAIL GET ${path} — '${expect}' not in response" docker compose logs --tail=40 return 1 fi } smoke_check "/" "Ludzka strona AI" smoke_check "/en/" "The human side of AI" smoke_check "/" "hreflang" smoke_check "/" "mailto:oskar@gethumanai.com" smoke_check "/en/" "human review" echo "Checking headers on localhost:8080..." if curl -fsS -I --max-time 5 http://localhost:8080; then echo "OK localhost:8080 — 200" else echo "FAIL localhost:8080 did not return 200" docker compose logs --tail=40 exit 1 fi echo "Smoke tests passed. Deploy complete." REMOTE echo "Done — humanAI landing is live."