fix: smoke tests use localhost:8080 (port mapping creates ambiguous container IPs)
This commit is contained in:
parent
9e591d92cd
commit
3f5dd536d1
16
deploy.sh
16
deploy.sh
|
|
@ -33,27 +33,29 @@ cd "$DEPLOY_DIR"
|
||||||
git pull origin main
|
git pull origin main
|
||||||
docker compose up -d --build --remove-orphans
|
docker compose up -d --build --remove-orphans
|
||||||
|
|
||||||
# ── 3. Smoke test ─────────────────────────────────────────────────────────
|
# ── 3. Smoke test via host port 8080 ──────────────────────────────────────
|
||||||
# Host: ubuntu-4gb-hel1-1
|
# 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..."
|
echo "Waiting for container to be ready..."
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
CONTAINER_IP=$(docker inspect humanai-landing \
|
BASE="http://localhost:8080"
|
||||||
--format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}')
|
|
||||||
|
|
||||||
smoke_check() {
|
smoke_check() {
|
||||||
local path="$1"
|
local path="$1"
|
||||||
local expect="$2"
|
local expect="$2"
|
||||||
local url="http://${CONTAINER_IP}${path}"
|
|
||||||
local body
|
local body
|
||||||
body=$(curl -sf --max-time 5 "$url") || {
|
body=$(curl -sf --max-time 5 "${BASE}${path}") || {
|
||||||
echo "FAIL GET ${path} — no response (curl exit $?)"
|
echo "FAIL GET ${path} — no response (curl exit $?)"
|
||||||
|
docker compose logs --tail=40
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
if echo "$body" | grep -qF "$expect"; then
|
if echo "$body" | grep -qF "$expect"; then
|
||||||
echo "OK GET ${path} — found: ${expect}"
|
echo "OK GET ${path} — found: ${expect}"
|
||||||
else
|
else
|
||||||
echo "FAIL GET ${path} — '${expect}' not in response"
|
echo "FAIL GET ${path} — '${expect}' not in response"
|
||||||
|
docker compose logs --tail=40
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
@ -64,9 +66,7 @@ smoke_check "/" "hreflang"
|
||||||
smoke_check "/" "mailto:oskar@gethumanai.com"
|
smoke_check "/" "mailto:oskar@gethumanai.com"
|
||||||
smoke_check "/en/" "human review"
|
smoke_check "/en/" "human review"
|
||||||
|
|
||||||
# ── 4. Host-port smoke test ───────────────────────────────────────────────
|
echo "Checking headers on localhost:8080..."
|
||||||
# Host: ubuntu-4gb-hel1-1
|
|
||||||
echo "Checking host port 8080..."
|
|
||||||
if curl -fsS -I --max-time 5 http://localhost:8080; then
|
if curl -fsS -I --max-time 5 http://localhost:8080; then
|
||||||
echo "OK localhost:8080 — 200"
|
echo "OK localhost:8080 — 200"
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue