t1k:web:devops:placement
| Field | Value |
|---|---|
| Module | devops |
| Version | 1.31.4 |
| Effort | medium |
| Tools | — |
Keywords: background job, cheapest hosting, cloudflare vs self-hosted, cost optimization, cpu limit, cron, free tier, long running job, placement audit, queue worker, self-hosted runner, service placement, too heavy for workers, where should this run, which platform, workers or server
How to invoke
Section titled “How to invoke”/t1k:web:devops:placement[design|audit] [service-or-path]Service Placement — Where Does This Run?
Section titled “Service Placement — Where Does This Run?”Answer before writing the service, not after it won’t deploy. Cloudflare’s edge is cheap-to-free and should be the default for anything that fits; our own hardware is for everything that genuinely doesn’t. This skill decides which — and says so with a reason, not a preference.
The one line that resolves most cases:
Tier 1 handles a request. Tiers 2–4 hold a process.
Cloudflare’s model is request-scoped: you get CPU while a request is in flight and lose it in between. Work that must exist between requests — a poller, a broker connection held open, a warm in-memory cache, a build — is not a Tier 1 workload no matter how cheap Tier 1 is. (Work that is delivered to you, like a Cloudflare Queues batch, is still trigger-scoped and still Tier 1.)
Executed by
Section titled “Executed by”The placement verdict (which tier a service belongs on, and why) is judgment and stays on a
reasoning tier (routing SSOT: rules/orchestration-rules.md § “Task-Type → Agent Routing”).
Only fact collection is mechanical:
| Step | Agent |
|---|---|
Run scripts/placement-audit.sh [--json] [root-dir] (read-only; emits facts, no verdicts) and report its output | t1k-fact-fetcher — runs one read-only script and returns what it printed |
Stays reasoning-tier: classifying services onto the ladder, the cost/limit reasoning, and every recommendation derived from the facts.
Handles: the design-time placement decision, the workload-class fit table, capability disqualifiers, free-vs-paid cost thresholds, hybrid edge+hardware patterns, migration triggers in both directions, and an audit of services already running.
Scope is INTERNAL services — things this studio runs for itself, where our own hardware is a
real option. For a client or product deployment, where handing over a box is not on the table,
platform selection belongs to /t1k:web:devops:deploy and its 15-provider cost ladder. If the answer
could be “put it on theone”, you are in this skill; if it could not, you are in that one.
Does NOT handle: executing a deploy (→ /t1k:web:devops:deploy), choosing between public PaaS
providers for a client project (→ same), provisioning or operating the
infra once placed (→ /t1k:web:devops:core), the tunnel + auth-gate pipeline for a self-hosted app
(→ /t1k:web:devops:selfhost-cloudflare), publishing that service on the NetBird mesh with
header-based identity and no login (→ /t1k:web:devops:selfhost-netbird), installing Cloudflare’s
own tooling (→ /t1k:web:devops:cloudflare-mcp-setup).
Decision Tree
Section titled “Decision Tree”| Intent | Read |
|---|---|
| “Where should this new service run?” | references/workload-fit-table.md |
| “Can this be free?” / “what are the actual limits?” | references/cloudflare-limits.md |
| “It doesn’t fit the edge — which of our boxes?” | references/runner-tiers.md |
| “Part of it fits the edge, part doesn’t” | references/hybrid-patterns.md |
| “Is what we already run placed correctly?” | references/audit-procedure.md |
| “We decided to move it — how?” | references/migration-playbooks.md |
| “Run a scheduled / batch / heavy job” | references/scheduled-jobs.md |
The Ladder
Section titled “The Ladder”Climb only as far as the workload forces you. Each rung costs more in money, ops burden, or both.
| Tier | Where | Costs | Take it when |
|---|---|---|---|
| 1 | Cloudflare edge — Pages, Workers, D1, KV, R2, Durable Objects, Queues, Cron Triggers | Free → ~$5/mo | Work completes inside a request; state fits a managed primitive |
| 2 | docker-compose on theone | Free (our hardware) | Long-lived daemon, real DB, private-network access, stateful process |
| 3 | k3s on theone | Free (our hardware) | Needs scheduling, autoscaling, or ephemeral isolated pods |
| 4 | Jenkins / GitHub ARC runners | Free (our hardware) | Heavy builds, large artifacts, native toolchains, device/GPU access |
Tiers 2–4 are “free” only in cash. They spend our RAM, our disk, our uptime, and our attention when they break at 02:00. Tier 1 spends none of those. That asymmetry is why Tier 1 is the default and why the burden of proof sits on climbing, not on staying.
Workflow — design (default)
Section titled “Workflow — design (default)”- Classify the workload. Name what it actually does in one sentence — “receives a webhook and writes a row”, “polls Postgres every 10s”, “builds a Unity APK”. The verb decides the tier far more reliably than the language or framework does.
- Run the five disqualifiers (below). Any hit → Tier 1 is out for that component. Do not negotiate with a capability cliff; a free tier you cannot run on is worth nothing.
- If nothing disqualifies → place on Tier 1. Pick the primitive from references/workload-fit-table.md. Stop here. This is the common case and it should feel anticlimactic.
- If something disqualifies → try splitting before climbing. Most “too heavy for the edge” services are one heavy component wearing a thin HTTP coat. Put the coat on Tier 1 and the weight on Tier 2–4 → references/hybrid-patterns.md.
- If it genuinely cannot split → climb to the lowest tier that fits (references/runner-tiers.md) and record which disqualifier forced it. That sentence is what a future audit re-checks against.
- Check cost last. Capability first, price second — in that order, always. Then confirm the projected volume against references/cloudflare-limits.md.
The five disqualifiers
Section titled “The five disqualifiers”Any one of these puts a component off Tier 1. They are capability walls, not preferences — no amount of budget or cleverness moves them.
- CPU-time per request exceeds the budget. Sustained compute inside one request. The wall is CPU time, not wall-clock — waiting on a slow API is free, hashing for seconds is not. Free is 10 ms; Workers Paid is 30 s by default and raisable to 5 min, so this disqualifier is usually a $5 problem, not a platform problem. Check the price before you climb a tier.
- The process must live between requests. Pollers, schedulers, warm in-memory caches — anything
with a
while (true)and no trigger. An isolate is evicted at any time and in-memory state does not survive; this one has no paid escape hatch. ⚠️ “Queue consumer” is not automatically disqualified. A Cloudflare Queues consumer is push-delivered — the platform invokes your Worker per batch, so it is triggered, not looping, and stays Tier 1. What disqualifies is holding a connection to an external broker (Redis, RabbitMQ, Kafka) and waiting on it. Ask whether the work is delivered to you or fetched by you. - It needs storage that is large or persistent on disk. Workers does have a filesystem now
(
node:fs, with a writable/tmp), so “no filesystem” is no longer true — but it is memory-backed: it spends the 128 MB isolate budget and vanishes after the request. Unpacking a 2 GB archive still disqualifies; writing a 4 KB temp file no longer does. - It needs to reach a private host or a blocked port. Outbound TCP is supported
(
connect()fromcloudflare:sockets) — but connections to private-network IPs,localhost, Cloudflare’s own ranges, and port 25 are blocked. So “talks to our Postgres ontheone” is the real disqualifier here, not “uses TCP”. - It needs a native binary, a heavy toolchain, or a device. Unity, Cocos, ffmpeg, headless
browsers at scale, anything GPU or emulator. Cloudflare Containers covers part of this shape on
Workers Paid — see
references/workload-fit-table.mdbefore assuming it must come to our hardware.
Full reasoning, per-primitive fit, and the borderline cases: references/workload-fit-table.md.
Workflow — audit
Section titled “Workflow — audit”Judge what is already running, not just what is being designed. Emits one verdict per service —
OK / MOVE / SPLIT / AT RISK — each with the disqualifier or limit that justifies it.
Run scripts/placement-audit.sh to collect the raw signals (legacy wrangler configs, compose services,
workflow runs-on: labels), then reason over them per
references/audit-procedure.md.
A verdict is a hypothesis, not an instruction. Never migrate a live service off an audit line
alone — confirm the workload class by reading the code, and confirm current volume against real
metrics. AT RISK in particular means “this is near a cliff”, not “this is broken”.
Scheduled and batch jobs
Section titled “Scheduled and batch jobs”Status: proposed, pilot pending. The shared runner system is a design, not built. No manifest, reusable workflow, ingest endpoint or heavy runner exists yet.
Verified facts (2026-10-08): ARC pods have 4 GiB and no ssh/gh; production and Postgres are on
sv-2; ARC-to-Postgres reachability is unverified; d1-parity.yml is the one existing scheduled-job
precedent; GitHub cron is best-effort (15-20 min late, 5 min minimum, disabled after 60 idle days).
Proposed design: a per-job manifest (to be built) drives one reusable workflow (to be built) onto a
light runner (ARC, fits 4 GiB) or a heavy runner (sv-2, one at a time, to be built), reporting
through one authenticated ingest endpoint (to be built).
| Job type | Runner class |
|---|---|
| External-API crawl or small report | light |
| Database-heavy aggregation or recompute | heavy (host headroom large in one quiet 2026-10-08 sample; limit is per-DB container memory, no replica; peak unmeasured) |
Fleet facts (2026-11-12): the ARC scale set is 6 pods max on the1-sv (31 GiB, RAM guard), with
sv-1 (62 GiB) joined but serving no runner pods yet (init-dind-externals stall). A scheduled job
selects its pod by variable — RUNNER_CI_SMALL/MEDIUM/LARGE, RUNNER_CD for prod access — never
by label; the old heavy runner on sv-2 was never built and sv-2 is gone. Keep light jobs off-peak.
Detail: references/runner-tiers.md § “Runner contract”.
Not for: precise timing, event-driven work, cadence under 5 minutes. Full design, open questions and rollout: references/scheduled-jobs.md.
Best Practices
Section titled “Best Practices”- Default to Tier 1; make climbing justify itself. The reverse default is how a studio ends up with fifteen compose stacks where four would do.
- Don’t contort a design to stay free. The Workers Paid step is small and removes the CPU cliff
outright. Burning a day of engineering to dodge it is a bad trade — compare against
references/cloudflare-limits.mdbefore optimizing. - Split by workload class, not by convenience. One repo can deploy to two tiers. That is normal and usually correct.
- Record the forcing disqualifier in the service’s README or Worker config comments.
t1k-telemetrydoes this well — its Worker config (legacywrangler.toml) explains why R2 and not D1 with the measured numbers. An undocumented placement gets re-litigated every six months. - Placement is not permanent. Volume grows, limits change, workloads get rewritten. Re-audit when
a service changes shape — see
references/migration-playbooks.mdfor triggers in both directions. - Zero egress is a real architectural lever. R2 charges nothing to read data out, which makes it the right handoff bus between tiers even when the producer and consumer both live on our hardware.
Hard rules
Section titled “Hard rules”- “It works in dev” proves nothing about the CPU ceiling — local
cf devdoes not enforce the production CPU budget. The cliff appears under real traffic, on the request that matters. - Silent queue, three causes. A job that never starts is usually a
RUNNER_*variable whose value matches no runner (no error, no failed check), a public repo (self-hosted groups reject them; cancelled at 24 h), or a saturated pool. Checkgh variable list --org The1Studioand.visibilitybefore blaming capacity. Never “fix” a queue by inlining a label (references/runner-tiers.md§ “Hard rules”).