cloudflare-workers-do-deploy
Skill0 starsChanged 5 months agoMITView on GitHub
Cloudflare Workers + Durable Objects + D1 + 静的アセット(SPA)を無料で本番デプロイする時。wrangler login後の手順とハマりどころ(サブドメイン変更・証明書待ち・secret衝突・無料DO)に使う
In this repository99 other files it gives its agents.
- agents-tools-quoted-jsonSkill
- asc-api-app-store-submitSkill
- asd-ste100Skill
- automation-bool-selector-pitfallsSkill
- automation-stale-cooldown-flagSkill
- autonomous-build-verifySkill
- book-to-skillSkill
- ccusage-cli-cost-trackingSkill
- chrome-ext-mv3-programmatic-injectSkill
- chrome-ext-store-assetsSkill
- claude-headless-p-invocationSkill
- claude-plugin-context-auditSkill
- claude-session-log-to-kbSkill
- codebase-to-courseSkill
- codesign-keychain-prompt-fixSkill
- codex-cli-setupSkill
- codex-delegation-handoffSkill
- content-factory-grounding-dedupSkill
- conversation-log-append-patternSkill
- cron-to-launchd-macosSkill
- cross-automation-shared-resource-killSkill
- design-token-migration-rnSkill
- discord-bot-image-to-claudeSkill
- discord-gateway-resume-dedupSkill
- excel-filtered-url-http-auditSkill
- execution-budget-vs-capsSkill
- expo-free-local-ios-testflightSkill
- ga4-connect-projectsSkill
- gcal-oauth-desktop-setupSkill
- git-commit-helperSkill
- git-prepush-secret-remote-checkSkill
- gsc-cli-automationSkill
- hatena-blogsync-autopostSkill
- hook-latency-wrapSkill
- hook-log-append-patternSkill
- html-to-pdf-slide-deckSkill
- humanizerSkill
- human-review-gate-shellSkill
- implementation-model-routingSkill
- insights-to-claude-mdSkill
- ios-permission-key-security-matrixSkill
- ios-sim-store-screenshotsSkill
- launchd-exit78-exconfig-debugSkill
- llm-content-pipeline-quality-gateSkill
- local-ai-video-pipelineSkill
- local-flux-mflux-image-genSkill
- local-llm-slow-diagnosisSkill
- local-music-generationSkill
- lottie-skottie-authoring-pitfallsSkill
- machine-wide-api-ratelimit-latchSkill
- macos-hook-path-timeoutSkill
- md-to-docx-reportSkill
- memory-md-inject-bloat-auditSkill
- message-display-secrets-maskSkill
- metric-source-attributionSkill
- migrate-icloud-desktop-assetsSkill
- nextauth-local-e2e-sessionSkill
- nextjs-rsc-payload-slimSkill
- nothing-designSkill
- openclaw-ollama-setupSkill
- The first 60 shown.
The file
Files
Procedure
Cloudflare全部入り(Workers + Durable Objects + D1 + SPAアセット)の本番化手順。実例=中の人AI(~/dev/nakanohito-ai)。
- 無料DO設定:
wrangler.tomlの `` にnew_sqlite_classes = ["ClassA",...]を指定(SQLite backendのDOは無料プランで$0。new_classesだとWorkers Paid要求になり得る)。[assets] directory/binding/not_found_handling="single-page-application"でSPA同居。 - ログイン(対話/本人):
! npx wrangler login(ブラウザOAuth。Claudeから不可)。 - D1作成→id差替:
npx wrangler d1 create <db>→ 出力database_idをwrangler.tomlの `` に貼る。 - 本番マイグレ:
npx wrangler d1 migrations apply <db> --remote(非対話でも fallback yes で進む)。 - 初回デプロイの前提: アカウントにworkers.devサブドメイン未作成だと
ERROR 10063で落ちる→ダッシュボードの Workers & Pages を一度開くと自動作成。 - デプロイ:
npm run deploy(= フロントbuild &&wrangler deploy)。URL=<worker名>.<アカウントサブドメイン>.workers.dev。 - secret投入:
printf '%s' "$VALUE" | npx wrangler secret put NAME(値は画面に出さない)。 - 検証:
curl https://.../api/health→ 本番E2E(test/e2e.mjsをHTTPS/WSSに差し替えて実行)→ テストデータをwrangler d1 execute <db> --remote --command "DELETE FROM ..."で一掃。
Pitfalls
- サブドメインに個人情報が乗る: アカウントサブドメインは初期値がメール由来(例
you-phone)。公開URLに旧ハンドルが出る→ダッシュボード「Change account subdomain」でブランド名に変更。⚠️APIの PUT/accounts/{id}/workers/subdomainは既存だと10036で変更不可=GUI必須。⚠️アカウント単位=全Workerが*.<新サブドメイン>.workers.devになるのでアプリ名でなくブランド名(例bokuwalily)にする。 - 新サブドメインのTLS証明書発行に10〜15分。
digは引けるのにcurlがsslv3 alert handshake failure / http_code=000になる=証明書待ち。deploy自体は証明書と無関係に成功するので、待つ間に sitemap/GA4/secret 等を進める。証明書発行直後の初回WS接続もコールドスタートで数分遅い(E2Eが2分超過しても少し後に再実行で通る)。 - var と secret の名前衝突:
wrangler.toml [vars] NAME=""を残したままsecret put NAMEすると10053 Binding name already in use。→ tomlから該当varを消して再デプロイしてから secret put。 wrangler subdomainコマンドは非推奨(deprecated)。サブドメイン操作はGUIへ。- 委譲の空振り: フロント等を
codex execに投げると banner出力のみ・exit0でもファイル0のことがある→git status/findで実体確認、空ならSonnetサブエージェントへフォールバック。
Verification
curl -s https://<url>/api/health→{"ok":true}- 本番E2Eスクリプト全PASS(WS往復+永続状態)
wrangler d1 execute <db> --remote --json --command "SELECT count(*) ..."で本番テストデータが0- secret:
wrangler secret listに登録名が出る/webhook等はリポにcommitされていない(grep -r 'webhooks' src webが空)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

