← back to Coming Soon Template
deploy.sh: throttle 8s between deploys (21 back-to-back trip CF rate limit)
e4e25aecf6ebf70fd55cdbc289eabef5908c521d · 2026-05-18 12:23:28 -0700 · SteveStudio2
Files touched
Diff
commit e4e25aecf6ebf70fd55cdbc289eabef5908c521d
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date: Mon May 18 12:23:28 2026 -0700
deploy.sh: throttle 8s between deploys (21 back-to-back trip CF rate limit)
---
deploy.sh | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/deploy.sh b/deploy.sh
index 71c0a03..0f5e21a 100755
--- a/deploy.sh
+++ b/deploy.sh
@@ -18,21 +18,40 @@ set -a; source .env; set +a
# Pages-scoped token separately so it never clobbers the DNS token.
export CLOUDFLARE_API_TOKEN="${CLOUDFLARE_PAGES_TOKEN:?CLOUDFLARE_PAGES_TOKEN not set}"
+ensure_project() {
+ local project="$1"
+ # grep -wx so "abrams" doesn't match "abramsindex"
+ if ! npx --yes wrangler pages project list 2>/dev/null | awk -F'│' '{print $2}' | tr -d ' ' | grep -qx "$project"; then
+ echo " + creating Pages project: $project"
+ npx --yes wrangler pages project create "$project" --production-branch=main >/dev/null
+ fi
+}
+
deploy_one() {
local dir="$1"
[ -d "out/$dir" ] || { echo "✗ no artifact: out/$dir"; return 1; }
local project="${dir%.com}" # abramsindex.com -> abramsindex
echo "→ deploying $dir (project: $project)"
+ ensure_project "$project"
npx --yes wrangler pages deploy "out/$dir" \
--project-name="$project" --branch=main --commit-dirty=true
}
target="${1:?usage: deploy.sh <domain-dir under out/> | all}"
if [ "$target" = "all" ]; then
+ fail=0
for d in out/*/; do
d="${d#out/}"; d="${d%/}"
- [ -f "out/$d/index.html" ] && deploy_one "$d"
+ [ -f "out/$d/index.html" ] || continue
+ if ! deploy_one "$d"; then
+ echo " ✗ FAILED: $d"
+ fail=$((fail+1))
+ fi
+ # Throttle: 21 back-to-back project-creates trip CF rate limit (code 10429).
+ sleep 8
done
+ echo
+ if [ "$fail" -eq 0 ]; then echo "✓ all deploys succeeded"; else echo "⚠ $fail deploy(s) failed"; fi
else
deploy_one "$target"
fi
← 41007d9 all 21 CF zones created
·
back to Coming Soon Template
·
deploy 19/21 to CF Pages + apex CNAME records (bhbutler/boul 39851b2 →