2026-06-02 17:24:37 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
|
|
# Host: SATURN
|
2026-06-02 18:47:09 +02:00
|
|
|
# Run this script from SATURN to commit, push, deploy, and smoke-test.
|
2026-06-02 17:24:37 +02:00
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
2026-06-02 18:47:09 +02:00
|
|
|
# ── 2. Pull, rebuild, smoke-test on VPS ───────────────────────────────────
|
2026-06-02 17:24:37 +02:00
|
|
|
# Host: ubuntu-4gb-hel1-1
|
|
|
|
|
ssh "$VPS" bash -s <<'REMOTE'
|
|
|
|
|
set -euo pipefail
|
2026-06-02 17:26:36 +02:00
|
|
|
DEPLOY_DIR="/home/oskar/gethumanai-landing"
|
2026-06-02 17:24:37 +02:00
|
|
|
|
|
|
|
|
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
|
2026-06-02 18:47:09 +02:00
|
|
|
|
2026-06-02 21:49:52 +02:00
|
|
|
# ── 3. Smoke test via host port 8080 ──────────────────────────────────────
|
2026-06-02 18:47:09 +02:00
|
|
|
# Host: ubuntu-4gb-hel1-1
|
2026-06-02 21:49:52 +02:00
|
|
|
# Port mapping adds a second network to the container, making the IP list
|
|
|
|
|
# ambiguous — use localhost:8080 (published port) for all checks instead.
|
2026-06-02 18:47:09 +02:00
|
|
|
echo "Waiting for container to be ready..."
|
|
|
|
|
sleep 2
|
|
|
|
|
|
2026-06-02 21:49:52 +02:00
|
|
|
BASE="http://localhost:8080"
|
2026-06-02 18:47:09 +02:00
|
|
|
|
|
|
|
|
smoke_check() {
|
|
|
|
|
local path="$1"
|
|
|
|
|
local expect="$2"
|
|
|
|
|
local body
|
2026-06-02 21:49:52 +02:00
|
|
|
body=$(curl -sf --max-time 5 "${BASE}${path}") || {
|
2026-06-02 18:47:09 +02:00
|
|
|
echo "FAIL GET ${path} — no response (curl exit $?)"
|
2026-06-02 21:49:52 +02:00
|
|
|
docker compose logs --tail=40
|
2026-06-02 18:47:09 +02:00
|
|
|
return 1
|
|
|
|
|
}
|
|
|
|
|
if echo "$body" | grep -qF "$expect"; then
|
|
|
|
|
echo "OK GET ${path} — found: ${expect}"
|
|
|
|
|
else
|
|
|
|
|
echo "FAIL GET ${path} — '${expect}' not in response"
|
2026-06-02 21:49:52 +02:00
|
|
|
docker compose logs --tail=40
|
2026-06-02 18:47:09 +02:00
|
|
|
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"
|
|
|
|
|
|
2026-06-02 21:49:52 +02:00
|
|
|
echo "Checking headers on localhost:8080..."
|
2026-06-02 21:48:34 +02:00
|
|
|
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
|
|
|
|
|
|
2026-06-02 18:47:09 +02:00
|
|
|
echo "Smoke tests passed. Deploy complete."
|
2026-06-02 17:24:37 +02:00
|
|
|
REMOTE
|
|
|
|
|
|
|
|
|
|
echo "Done — humanAI landing is live."
|