← back to Dw Photo Capture
add nightly color-index refresh script + launchd plist (DRAFT — install gated): build from live shopify_products, rsync json to Kamatera (endpoint hot-reloads)
42148685b1cc7b776b55fdb9ce899eaeaf11bfc2 · 2026-07-15 16:33:21 -0700 · Steve Abrams
Files touched
A deploy/launchd/com.steve.color-index-rebuild.plistA scripts/refresh-color-index.sh
Diff
commit 42148685b1cc7b776b55fdb9ce899eaeaf11bfc2
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Wed Jul 15 16:33:21 2026 -0700
add nightly color-index refresh script + launchd plist (DRAFT — install gated): build from live shopify_products, rsync json to Kamatera (endpoint hot-reloads)
---
deploy/launchd/com.steve.color-index-rebuild.plist | 34 ++++++++++++++++++++++
scripts/refresh-color-index.sh | 21 +++++++++++++
2 files changed, 55 insertions(+)
diff --git a/deploy/launchd/com.steve.color-index-rebuild.plist b/deploy/launchd/com.steve.color-index-rebuild.plist
new file mode 100644
index 0000000..2c33503
--- /dev/null
+++ b/deploy/launchd/com.steve.color-index-rebuild.plist
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Nightly rebuild + ship of the PDP color-index (03:30 local).
+ DRAFT — install with:
+ cp deploy/launchd/com.steve.color-index-rebuild.plist ~/Library/LaunchAgents/
+ launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.steve.color-index-rebuild.plist
+ Runs scripts/refresh-color-index.sh: builds from live shopify_products and
+ rsyncs the json to Kamatera (endpoint hot-reloads on mtime). -->
+<!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.color-index-rebuild</string>
+ <key>ProgramArguments</key>
+ <array>
+ <string>/bin/bash</string>
+ <string>/Users/macstudio3/Projects/dw-photo-capture/scripts/refresh-color-index.sh</string>
+ </array>
+ <key>WorkingDirectory</key>
+ <string>/Users/macstudio3/Projects/dw-photo-capture</string>
+ <key>StartCalendarInterval</key>
+ <dict>
+ <key>Hour</key>
+ <integer>3</integer>
+ <key>Minute</key>
+ <integer>30</integer>
+ </dict>
+ <key>RunAtLoad</key>
+ <false/>
+ <key>StandardOutPath</key>
+ <string>/Users/macstudio3/Projects/dw-photo-capture/logs/color-index-rebuild.log</string>
+ <key>StandardErrorPath</key>
+ <string>/Users/macstudio3/Projects/dw-photo-capture/logs/color-index-rebuild.log</string>
+</dict>
+</plist>
diff --git a/scripts/refresh-color-index.sh b/scripts/refresh-color-index.sh
new file mode 100755
index 0000000..cc8846c
--- /dev/null
+++ b/scripts/refresh-color-index.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+# refresh-color-index.sh — rebuild the PDP "Colors In This Pattern" index from
+# LIVE truth (dw_unified.shopify_products: active + online_store_published) and
+# ship it to the Kamatera endpoint. The /apps/color-index server hot-reloads the
+# file on mtime change, so no pm2 restart is needed.
+#
+# Safe to run nightly: idempotent, $0 (local PG read + one small rsync).
+# Build runs HERE (Mac3) because the canonical dw_unified mirror lives here.
+set -euo pipefail
+
+cd "$(dirname "$0")/.."
+export PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin"
+
+echo "[$(date '+%F %T')] building color-index from shopify_products…"
+node scripts/build-color-index.cjs
+
+echo "[$(date '+%F %T')] shipping color-index.json → Kamatera (hot-reload on mtime)…"
+rsync -az data/color-index.json \
+ root@45.61.58.125:/root/public-projects/dwphoto/data/color-index.json
+
+echo "[$(date '+%F %T')] color-index refreshed + shipped."
← 91ce171 deps: add pg so build-color-index runs standalone (needed fo
·
back to Dw Photo Capture
·
color-index: exclude sample-only ($4.25) products — require 5d305fe →