[object Object]

← back to Dw Pitch Followup

auto-save: 2026-06-30T14:41:08 (1 files) — deploy/

91a8b82073deab865d6d2eac48ffa045b6ce947a · 2026-06-30 14:41:12 -0700 · Steve Abrams

Files touched

Diff

commit 91a8b82073deab865d6d2eac48ffa045b6ce947a
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Tue Jun 30 14:41:12 2026 -0700

    auto-save: 2026-06-30T14:41:08 (1 files) — deploy/
---
 deploy/finish-tunnel.sh | 59 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/deploy/finish-tunnel.sh b/deploy/finish-tunnel.sh
new file mode 100755
index 0000000..eae21e5
--- /dev/null
+++ b/deploy/finish-tunnel.sh
@@ -0,0 +1,59 @@
+#!/bin/bash
+# Finish followup.designerwallcoverings.com once `cloudflared tunnel login`
+# has written ~/.cloudflared/cert.pem. Idempotent. Run from anywhere.
+set -euo pipefail
+CFDIR="$HOME/.cloudflared"
+NAME="dw-followup"
+HOST="followup.designerwallcoverings.com"
+APP_URL="http://127.0.0.1:9768"
+
+[ -f "$CFDIR/cert.pem" ] || { echo "MISSING $CFDIR/cert.pem — run: cloudflared tunnel login"; exit 1; }
+
+# 1. Create tunnel (idempotent)
+if cloudflared tunnel list 2>/dev/null | grep -qw "$NAME"; then
+  echo "tunnel $NAME exists"
+else
+  cloudflared tunnel create "$NAME"
+fi
+UUID=$(cloudflared tunnel list 2>/dev/null | awk -v n="$NAME" '$2==n{print $1}' | head -1)
+[ -n "$UUID" ] || { echo "could not resolve tunnel UUID"; exit 2; }
+echo "UUID=$UUID"
+
+# 2. config.yml (local-managed ingress → the app)
+cat > "$CFDIR/config.yml" <<YML
+tunnel: $UUID
+credentials-file: $CFDIR/$UUID.json
+ingress:
+  - hostname: $HOST
+    service: $APP_URL
+  - service: http_status:404
+YML
+echo "wrote $CFDIR/config.yml"
+
+# 3. DNS route (CNAME $HOST → tunnel)
+cloudflared tunnel route dns "$NAME" "$HOST" || echo "(route dns: may already exist)"
+
+# 4. launchd service so the tunnel survives reboot
+PLIST="$HOME/Library/LaunchAgents/com.steve.dw-followup-tunnel.plist"
+cat > "$PLIST" <<PL
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0"><dict>
+  <key>Label</key><string>com.steve.dw-followup-tunnel</string>
+  <key>ProgramArguments</key><array>
+    <string>/opt/homebrew/bin/cloudflared</string>
+    <string>tunnel</string><string>--no-autoupdate</string>
+    <string>--config</string><string>$CFDIR/config.yml</string>
+    <string>run</string><string>$NAME</string>
+  </array>
+  <key>RunAtLoad</key><true/><key>KeepAlive</key><true/>
+  <key>StandardOutPath</key><string>$HOME/Projects/dw-pitch-followup/data/tunnel.log</string>
+  <key>StandardErrorPath</key><string>$HOME/Projects/dw-pitch-followup/data/tunnel.log</string>
+</dict></plist>
+PL
+launchctl bootout "gui/$(id -u)/com.steve.dw-followup-tunnel" 2>/dev/null || true
+launchctl bootstrap "gui/$(id -u)" "$PLIST"
+echo "tunnel launchd service installed"
+sleep 5
+echo "=== verify ==="
+curl -sI -m 12 "https://$HOST" | head -3 || echo "(give DNS+edge ~30s, retry)"

← a518ea6 DW client/vendor follow-up pitch viewer: 3 read-only FileMak  ·  back to Dw Pitch Followup  ·  Pitch follow-up: hide mfr# from UI + client letters (toggle) 351e8f9 →