← back to Govarbitrage
deploy: provision GOOGLE_PLACES_API_KEY (non-destructive) + bounded /login smoke-retry — fixes silent 503 on /agents live search
f82010ffd6d698414f5ea25591cfb724913c07ba · 2026-07-26 16:01:30 -0700 · Steve Abrams
Files touched
M scripts/deploy-auctions.sh
Diff
commit f82010ffd6d698414f5ea25591cfb724913c07ba
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Sun Jul 26 16:01:30 2026 -0700
deploy: provision GOOGLE_PLACES_API_KEY (non-destructive) + bounded /login smoke-retry — fixes silent 503 on /agents live search
---
scripts/deploy-auctions.sh | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/scripts/deploy-auctions.sh b/scripts/deploy-auctions.sh
index fba39dd..6bed539 100755
--- a/scripts/deploy-auctions.sh
+++ b/scripts/deploy-auctions.sh
@@ -37,6 +37,27 @@ if ! grep -q '^FLEET_SSO_SECRET=' .env && [ -r /var/www/fleet-sso/.secret ]; the
echo "FLEET_SSO_SECRET=\"$(tr -d '\n' < /var/www/fleet-sso/.secret)\"" >> .env
fi
+# Google Places API key — REQUIRED by src/lib/places.ts (searchCommercialAgents
+# throws "GOOGLE_PLACES_API_KEY is not configured" when absent, which makes the
+# /api/agents/search route return HTTP 503). Provision it NON-destructively:
+# preserve an existing key, else copy it from the first readable shared on-host
+# secret file (same pattern as FLEET_SSO_SECRET above). If it's absent AND no
+# secret source can be found, DON'T invent a value (a placeholder would make
+# places.ts think it's configured and 503 at request time instead) — emit a
+# LOUD warning so the operator sees it in the deploy output.
+if ! grep -q '^GOOGLE_PLACES_API_KEY=' .env; then
+ PLACES_SECRET=""
+ for cand in /var/www/fleet-sso/google-places.secret /root/.secrets/google-places.secret /root/.secrets/GOOGLE_PLACES_API_KEY; do
+ if [ -r "$cand" ]; then PLACES_SECRET="$cand"; break; fi
+ done
+ if [ -n "$PLACES_SECRET" ]; then
+ echo "GOOGLE_PLACES_API_KEY=\"$(tr -d '\n' < "$PLACES_SECRET")\"" >> .env
+ echo " provisioned GOOGLE_PLACES_API_KEY from $PLACES_SECRET"
+ else
+ echo "⚠ GOOGLE_PLACES_API_KEY not set and no secret source found — /agents live search will 503 until it is added"
+ fi
+fi
+
echo " npm install"
npm install --no-audit --no-fund
echo " prisma generate + db push"
@@ -79,4 +100,22 @@ REMOTE
echo "▶ smoke test"
curl -s -o /dev/null -w " auctions.agentabrams.com/login -> %{http_code}\n" https://auctions.agentabrams.com/login
+# Retry /login until it genuinely serves (200) or we exhaust the attempts, so a
+# transient 502 boot-race (pm2 mid-restart) isn't misreported as a failed deploy.
+LOGIN_URL="https://auctions.agentabrams.com/login"
+SMOKE_OK=""
+for attempt in $(seq 1 15); do
+ # Guarded so a non-2xx curl (and pipefail) can't abort the script mid-check.
+ code="$(curl -s -o /dev/null -w '%{http_code}' "$LOGIN_URL" || echo 000)"
+ if [ "$code" = "200" ]; then
+ echo " ✔ /login serving 200 (attempt $attempt/15)"
+ SMOKE_OK=1
+ break
+ fi
+ echo " … /login -> $code, retrying ($attempt/15)"
+ sleep 2
+done
+if [ -z "$SMOKE_OK" ]; then
+ echo " ⚠ /login never returned 200 after 15 attempts — check pm2 logs (may be a real boot failure, not just a race)"
+fi
echo "✔ deploy complete — https://auctions.agentabrams.com (login: admin@govarbitrage.local / changeme)"
← 75b5e88 agents: better search — 3 curated CRE query lenses/kind (buy
·
back to Govarbitrage
·
agents: precision-first commercial filter — require positive 69f9dc1 →