Skip to content

Cleanup: retire legacy / test Cloudflare workers (AISD-216)

AISD-214 removed the stg / stg2 env blocks from wrangler.toml, but that only stops us deploying them again — the already-deployed workers, their routes, and their custom-domain / DNS records still exist in the Cloudflare account until deleted by hand. This runbook removes those orphans so only the workers we actually run remain.

Scope: Cloudflare account teardown only. No database rows, tables, or CMS content are touched. (Dropping the now-unused DB tables is a separate, gated task — AISD-218.)

Who runs it: an operator with Cloudflare credentials for the wantskicks.com and fashionradar.net zones. Nothing here runs from CI.

Keep vs delete manifest

KEEP (current — defined in wrangler.toml)

Worker Env Serves
cms-cf-worker-dev site-dev dev.wantskicks.com, dev.fashionradar.net
cms-cf-worker-prod site-prod wantskicks.com/*
cms-cf-media-stage media-stage dev.*/cmp-media/*
cms-cf-media-prod media-prod wantskicks.com/cmp-media/*

DELETE (orphaned — no longer in wrangler.toml)

Worker Old env Routes / domains to remove
cms-cf-worker-stage site-stage route stg.wantskicks.com/*, stg.wantskicks.com/cmp-media/*
cms-cf-worker-stage-mk2 site-stage-mk2 custom domain stg2.wantskicks.com (+ DNS record + edge TLS), stg2.wantskicks.com/cmp-media/*
any base cms-cf-worker (deployed without --env) — pre-generic-engine leftover, if present
example placeholders — stage.example.com/*, www.example.com/* (+ /cmp-media/*) — never real, remove if they exist

Derived from the git history of wrangler.toml (the site-stage / site-stage-mk2 blocks removed by AISD-214). Reconcile against the live account before deleting (see "Enumerate first").

Enumerate first (dry, read-only)

List the account's site/media workers and confirm the orphan set before touching anything:

# Workers in the account (needs CLOUDFLARE_API_TOKEN + CLOUDFLARE_ACCOUNT_ID):
wrangler deployments list            # per-worker; or:
# Dashboard: Workers & Pages -> filter name "cms-cf-worker" -> compare to KEEP table.

Anything named cms-cf-worker-* that is not in the KEEP table is a delete candidate. Confirm the list before proceeding — this is the destructive gate.

Teardown order (per worker to delete)

Remove routes/domains before deleting the worker, so no route is left pointing at a deleted worker.

  1. Custom domains (mk2 only): Dashboard → the worker → Settings → Domains & Routes → remove stg2.wantskicks.com. This releases the managed DNS + cert.
  2. Routes: remove stg.wantskicks.com/* and the stg*/cmp-media/* routes (Dashboard → Websites → wantskicks.com → Workers Routes), plus any *.example.com placeholders.
  3. Delete the worker:
    wrangler delete --name cms-cf-worker-stage
    wrangler delete --name cms-cf-worker-stage-mk2
    # and the bare cms-cf-worker if it exists and is unused
    
  4. DNS: remove leftover stg.wantskicks.com / stg2.wantskicks.com records (Dashboard → wantskicks.com → DNS) if the custom-domain removal didn't already clear them.

Smoke checks (after teardown)

# Keep-hosts still serve:
for u in https://dev.wantskicks.com/ https://dev.fashionradar.net/ https://wantskicks.com/ ; do
  echo -n "$u -> "; curl -sS -o /dev/null -w '%{http_code}\n' "$u"
done
# A media asset on dev still resolves:
curl -sS -o /dev/null -w '%{http_code}\n' https://dev.wantskicks.com/cmp-media/  # any known asset path

# Retired hosts no longer resolve to a worker:
curl -sS -o /dev/null -w '%{http_code}\n' https://stg.wantskicks.com/   # expect DNS failure / no worker
curl -sS -o /dev/null -w '%{http_code}\n' https://stg2.wantskicks.com/  # expect DNS failure / no worker

Sanity: no DB was touched

This task changes nothing in cms_db. As a guard, row counts before/after must be identical (run against stg cms_db):

SELECT (SELECT COUNT(*) FROM content)  AS content,
       (SELECT COUNT(*) FROM authors)  AS authors,
       (SELECT COUNT(*) FROM sites)    AS sites;

Not in this task

  • DB table drop (template_blocks, template_elements, site_block_overrides, *_history, templates.css / styles.css columns) → AISD-218, shell hydration always on + cms-api no longer reading those tables.
  • Media S3 bucket objects — left as-is.