feat: add smoke tests to deploy.sh (curl container IP after up)
This commit is contained in:
parent
50cc253651
commit
6e634614fc
|
|
@ -35,6 +35,7 @@ docker compose up --build
|
|||
The script:
|
||||
1. Commits any pending changes and pushes to Forgejo (`oskar/gethumanai-landing`).
|
||||
2. SSH-es to `ubuntu-4gb-hel1-1`, clones/pulls to `~/gethumanai-landing` and runs `docker compose up -d --build`.
|
||||
3. Runs a smoke test — curls the container IP directly and checks for key strings on PL `/`, EN `/en/`, hreflang, and the mailto link. Exits non-zero and prints `FAIL` if any check fails.
|
||||
|
||||
The container joins the `npm_proxy` Docker network. In **Nginx Proxy Manager** on the VPS,
|
||||
create a proxy host: `gethumanai.com` → `http://humanai-landing:80`.
|
||||
|
|
|
|||
39
deploy.sh
39
deploy.sh
|
|
@ -2,11 +2,10 @@
|
|||
set -euo pipefail
|
||||
|
||||
# Host: SATURN
|
||||
# Run this script from SATURN to commit, push and deploy to VPS.
|
||||
# Run this script from SATURN to commit, push, deploy, and smoke-test.
|
||||
|
||||
VPS="ubuntu-4gb-hel1-1"
|
||||
REPO_DIR="/home/oskar/projects/gethumanai-landing"
|
||||
VPS_DEPLOY_DIR="/home/oskar/gethumanai-landing"
|
||||
FORGEJO_REMOTE="ssh://git@100.108.208.3:222/oskar/gethumanai-landing.git"
|
||||
|
||||
# ── 1. Commit & push (SATURN) ──────────────────────────────────────────────
|
||||
|
|
@ -20,7 +19,7 @@ fi
|
|||
|
||||
git push origin main
|
||||
|
||||
# ── 2. Pull & rebuild on VPS ───────────────────────────────────────────────
|
||||
# ── 2. Pull, rebuild, smoke-test on VPS ───────────────────────────────────
|
||||
# Host: ubuntu-4gb-hel1-1
|
||||
ssh "$VPS" bash -s <<'REMOTE'
|
||||
set -euo pipefail
|
||||
|
|
@ -33,7 +32,39 @@ fi
|
|||
cd "$DEPLOY_DIR"
|
||||
git pull origin main
|
||||
docker compose up -d --build --remove-orphans
|
||||
echo "Deploy complete."
|
||||
|
||||
# ── 3. Smoke test ─────────────────────────────────────────────────────────
|
||||
# Host: ubuntu-4gb-hel1-1
|
||||
echo "Waiting for container to be ready..."
|
||||
sleep 2
|
||||
|
||||
CONTAINER_IP=$(docker inspect humanai-landing \
|
||||
--format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}')
|
||||
|
||||
smoke_check() {
|
||||
local path="$1"
|
||||
local expect="$2"
|
||||
local url="http://${CONTAINER_IP}${path}"
|
||||
local body
|
||||
body=$(curl -sf --max-time 5 "$url") || {
|
||||
echo "FAIL GET ${path} — no response (curl exit $?)"
|
||||
return 1
|
||||
}
|
||||
if echo "$body" | grep -qF "$expect"; then
|
||||
echo "OK GET ${path} — found: ${expect}"
|
||||
else
|
||||
echo "FAIL GET ${path} — '${expect}' not in response"
|
||||
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 "Smoke tests passed. Deploy complete."
|
||||
REMOTE
|
||||
|
||||
echo "Done — humanAI landing is live."
|
||||
|
|
|
|||
Loading…
Reference in a new issue