[object Object]

← back to Homesonspec

chore: HomesOnSpec safe full-web deploy runbook (build-gated + git-rollback) + v0.3.2 (TK-10488); drop superseded piecemeal script

db6c10ce17ff198833affccd42009b39f69d6253 · 2026-08-12 14:51:47 -0700 · Steve

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit db6c10ce17ff198833affccd42009b39f69d6253
Author: Steve <steve@designerwallcoverings.com>
Date:   Wed Aug 12 14:51:47 2026 -0700

    chore: HomesOnSpec safe full-web deploy runbook (build-gated + git-rollback) + v0.3.2 (TK-10488); drop superseded piecemeal script
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
 package.json               |  2 +-
 scripts/deploy-full-web.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/package.json b/package.json
index c3c4c374..7eb3b65d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "homesonspec",
-  "version": "0.3.1",
+  "version": "0.3.2",
   "private": true,
   "description": "HomesOnSpec.com — nationwide search and comparison platform for newly constructed homes. Evidence-backed, verification-labeled inventory.",
   "scripts": {
diff --git a/scripts/deploy-full-web.sh b/scripts/deploy-full-web.sh
new file mode 100644
index 00000000..fcd79e7e
--- /dev/null
+++ b/scripts/deploy-full-web.sh
@@ -0,0 +1,44 @@
+#!/usr/bin/env bash
+# TK-10488 — SAFE full deploy of HomesOnSpec apps/web source to Kamatera. RUN ON MAC2.
+# Incident-proofed (after the 2026-08-12 502): (1) Kamatera is now a git repo, so every run
+# snapshots + can roll back via git; (2) the restart is BUILD-GATED — it only restarts if
+# `next build` SUCCEEDS, so a bad build can never take the site down again; (3) on build
+# failure it reverts the source via git and leaves the running (good) build untouched.
+#
+# SCOPE: brings Kamatera's apps/web/src in line with Mac2 — the ~4 undeployed files
+# (contractors.ts, trades.ts, NearbySubs.tsx = TK-10488 contractors; parcel.ts = TK-10482
+# parcel/public-records block) + the page.tsx that uses them. The scoped contractor cred is
+# already in apps/web/.env. NOTE: this necessarily also ships the TK-10482 parcel block live.
+set -euo pipefail
+KAM=root@45.61.58.125
+H=/root/Projects/homesonspec
+cd ~/Projects/homesonspec
+
+echo "### 1. snapshot current Kamatera state (rollback point) ###"
+ssh "$KAM" "cd $H && git add -A && (git commit -q -m 'pre-deploy snapshot (auto)' && echo snapshotted || echo 'clean, nothing to snapshot') && git rev-parse --short HEAD"
+
+echo "### 2. rsync web SOURCE only (Mac2 -> Kamatera), no --delete ###"
+rsync -a apps/web/src/ "$KAM:$H/apps/web/src/"
+
+echo "### 3. what changed ###"
+ssh "$KAM" "cd $H && git status -s apps/web/src | head -25"
+
+echo "### 4. BUILD-GATED restart (restart ONLY if build succeeds; else git-revert source) ###"
+ssh "$KAM" 'bash -s' <<REMOTE
+set -uo pipefail
+cd $H
+set -o pipefail
+pnpm --filter @homesonspec/web build 2>&1 | tail -8
+BUILD_RC=\$?
+if [ "\$BUILD_RC" -eq 0 ]; then
+  echo "BUILD OK — restarting homesonspec-web"
+  pm2 restart homesonspec-web --update-env >/dev/null 2>&1; sleep 6
+  echo -n "local :9975 : "; curl -s -o /dev/null -w "%{http_code}\n" --max-time 10 http://localhost:9975/
+  echo -n "homesonspec.com : "; curl -s -o /dev/null -w "%{http_code}\n" --max-time 12 https://homesonspec.com/
+else
+  echo "BUILD FAILED (rc=\$BUILD_RC) — NOT restarting; site stays on current good build. Reverting source via git."
+  git checkout -- apps/web/src && echo "source reverted to last commit"
+  exit 1
+fi
+REMOTE
+echo "### DONE. Rollback anytime: ssh $KAM 'cd $H && git reset --hard eaa2799 && pnpm --filter @homesonspec/web build && pm2 restart homesonspec-web' ###"

← a2a0172b homesonspec: send scoped Basic auth to usre contractor API (  ·  back to Homesonspec  ·  HomesOnSpec search: add Grid/List/Table view modes + broaden 1ee4dcd7 →