Repository navigation
Deploy config for the Worker: staging + api.ghostwrit.in production, rewrite rate limit, deploy script with pinned smoke test and rollback - #13
Merged
Conversation
…rewrite rate limit, deploy script with pinned smoke test and rollback Refs #1 Co-Authored-By: Colonizer Settlers <331648616+colonizer-settlers@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves the configuration side of #1. Nothing has been deployed. This environment has no Cloudflare credentials and no provider key, so the actual deploy, setting the secrets, and a rewrite against a real model are still for a maintainer to do.
What changed
crates/ghostwritin-worker/wrangler.tomlghostwritin-api.[env.production]hasroutes = [{ pattern = "api.ghostwrit.in", custom_domain = true }]andworkers_dev = false. It repeatsvarsand the rate limiter, because wrangler doesn't pass those down from the top level.[[ratelimits]]bindingREWRITE_LIMITERwith 10 requests per 60 s; staging uses namespace 1001 and production 1002.GHOSTWRITIN_API_KEYS,HARNESS_SECRET, and one ofANTHROPIC_API_KEY/OPENAI_API_KEY.crates/ghostwritin-worker/src/lib.rs(+sha2dep, 1-lineCargo.lockchange): a rate-limit check onPOST /v1/rewriteonly, which runs before the harness handles the request.cf-connecting-ip.rate-limitedandRetry-After: 60. Refused requests never reach the model.tools/deploy.sh <staging|production>(new):wrangler@4.149.0; setWRANGLERto override it.wrangler secret list)./v1/healthforok,model_configuredandversion ==the workspace version, so a stale build fails the gate.wrangler rollback <previous> -y.STAGING_URL, because the workers.dev subdomain hasn't been chosen yet.ship.ks:requiresnow includes the provider key, and the smoke gate checks the version.fn.deployisn't in Keep Shipping's catalog yet, so the header saystools/deploy.shdoes the same steps by hand.README.md: updated the status line, therate-limitederror code, and the self-hosting/deploy section, plus the plan requirement below.How it was checked
cargo fmt --check,clippy --workspace --all-targets -D warnings,cargo test --workspace(50 passed),cargo doc -D warnings, and the wasm32 build ofghostwritin-worker.wrangler deploy --dry-runsucceeds with no warnings for both--env ""(staging) and--env production, and the rate-limit binding validates.--env ""falls back to the top-level environment and turns off the "multiple environments" warning.tools/deploy.shwas tested against fakewrangler/curlscripts:deployments listfailing: the deploy still runssecret listfails: wrangler's error is shown, with a hintworker-buildbash -nand shellcheck are clean.wrangler.toml. It also read aversionfield thatdeployments list --jsondoesn't have, and took the oldest entry instead of the newest, so rollback could never trigger.wrangler dev --local, with a scripted OpenAI-compatible server (300 ms latency) standing in for the provider. The server was a throwaway in/tmpand is not in the repo./proc)./v1/healthreturns 200, missing or wrong keys get 401, and a burst gets 10×200 then 429rate-limitedwith no model call.Reviewers, please look at
[limits] cpu_msis set.crates/ghostwritin-rewrite). Cloudflare has no hard wall-time limit for HTTP requests, but a slow model makes for a slow response.wrangler secret putfor each environment (the firstsecret putcreates the Worker)tools/deploy.sh staging, thenproductioncrates/ghostwritin-worker/src/lib.rs(ininstance()) andREADME.md(Quota row, Billing note). My changes avoid those spots. If Billing and word quotas through Polar #3 adds a D1DBbinding, it has to be repeated under[env.production].Size: 7 files, about 340 changed lines (including the new 140-line
tools/deploy.sh).Closes #1
🤖 Generated by Colonizer in a microVM
Co-Authored-By: Colonizer Settlers 331648616+colonizer-settlers@users.noreply.github.com