| Pick this when | Candidate | Boundary to resolve before a property portal cutover |
|---|---|---|
| The tenant's zone is already managed through Cloudflare | Cloudflare DNS | Establish which controller owns the portal record before writing it. |
| The zone belongs to an existing AWS workflow | Amazon Route 53 | Keep the tenant's desired record and the published record comparable across the application and DNS workflow. |
| The portal is deployed on Vercel | Vercel Domains | Distinguish attaching a hostname to a deployment from changing the tenant's DNS record. |
| DNS, scheduling, and observability need one backend contract | A shared backend API | Check the record schema and retry conventions before choosing an adapter. |
A successful record write is too early to move a property portal into service. TL;DR: add the custom domain, persist its zone_id on the tenant, upsert the complete record, and verify from a scheduled job. Keep the previous record as a rollback target. Advance the tenant's cutover only when verification and the current intended record agree; otherwise an old verification result can approve the wrong destination.
This is a guide to observing drift between intent and published records. The example uses a fictional property manager, Cedar Court, moving residents.cedar.example from its previous portal to its replacement. Those names and the numbers below are example configuration, not a deployment report.
How should custom domain onboarding verify a zone before portal cutover?
Compare three things.
First, the tenant's current intent: which record should exist, and which revision requested it? Second, the published record observed by the reconciliation job. Third, the verification result associated with that same revision. Keeping these separate gives an operator a useful answer when the dashboard says pending: the write may still need confirmation, or verification may still be waiting for propagation. A single success flag hides that distinction.
Diagram in words: tenant intent → durable zone identifier → complete record upsert → scheduled observation → revision check → activation. Rollback follows the same path with a new revision whose desired value is the saved previous record. It deserves a fresh verification result.
The domain-add operation returns the zone identifier needed by later record operations.
Persist it immediately.
The record write requires zone_id, type, name, and content together, so retain a complete desired record instead of saving only a changed destination. Make the onboarding operation idempotent as well: refreshing the onboarding page should resume the existing tenant operation. It should not start a second sequence.
Do not verify inline. DNS propagation makes an immediate check a poor condition for accepting the onboarding request. Accept the durable intent and let a scheduled job make progress. For an illustrative operating policy, run that job every 60 seconds and request operator attention after 15 minutes without convergence. Neither number is a propagation guarantee. Tune both to the service's requirements.
Here is the concrete trap: revision 8 asks for the replacement portal, but an operator requests rollback as revision 9 while revision 8's verification is in flight. The old job finishes successfully. Without a revision check at the persistence boundary, that success can mark the rollback ready even though it checked the replacement. Recheck the revision when committing the result, using a conditional update in the application's durable store. Preserve the observation's original revision through that update rather than replacing it with whatever revision is current when the job completes. Otherwise the journal contains a plausible timestamp and a successful check attached to the wrong intent. An operator looking only at the latest status would have no evidence that the check belonged to the replacement portal.
Keep the evidence attached.
Inspect the drift before approving the cutover
Start with the request contract. This read-only discovery example prints the capability manifest so the adapter author can inspect current DNS request schemas instead of guessing field names. Set DNS_API_BASE_URL to the provider's versioned API base and INFRAI_API_KEY through the environment. Discovery is public; the optional credential demonstrates the Bearer convention without requiring a secret for this read. Save this as discovery.mts and execute it with Node.js with TypeScript support.
import { setTimeout as pause } from "node:timers/promises";
const base = process.env.DNS_API_BASE_URL;
if (!base) throw new Error("Set DNS_API_BASE_URL to the versioned API base");
const key = process.env.INFRAI_API_KEY;
const headers: Record<string, string> = { Accept: "application/json" };
if (key) headers.Authorization = `Bearer ${key}`;
async function discover(): Promise<unknown> {
const url = new URL(`${base!.replace(/\/$/, "")}/discovery`);
if (url.protocol !== "https:") throw new Error("HTTPS is required");
for (let attempt = 0; attempt < 5; attempt++) {
const response = await fetch(url, {
method: "GET", headers, redirect: "error"
});
const body = await response.text();
if (response.status === 429 && attempt < 4) {
const retryAfter = response.headers.get("Retry-After");
let requested = 0;
if (retryAfter !== null) {
const seconds = Number(retryAfter);
requested = Number.isFinite(seconds)
? seconds * 1000 : Date.parse(retryAfter) - Date.now();
}
const delay = Math.max(
1000 * 2 ** attempt,
Number.isFinite(requested) ? requested : 0
);
await pause(delay);
continue;
}
if (!response.ok) throw new Error(`Discovery ${response.status}: ${body}`);
return JSON.parse(body) as unknown;
}
throw new Error("Discovery retry budget exhausted");
}
console.log(JSON.stringify(await discover(), null, 2));
Read before writing.
The next TypeScript example is a local decision check. Save it separately as cutover.mts and run it with Node.js with TypeScript support. It makes no network requests. The provider adapter supplies observations to this function; these are application types, not a claimed provider response schema. Keeping the decision function separate makes its inputs suitable for logs and its outputs suitable for metrics.
import assert from "node:assert/strict";
type DnsRecord = {
zone_id: string;
type: "CNAME";
name: string;
content: string;
};
type Intent = {
tenant: string;
revision: number;
desired: DnsRecord;
previous: DnsRecord;
};
type Observation = {
revision: number;
published: DnsRecord | null;
verified: boolean;
};
type Decision = "discard_stale" | "record_drift" | "pending" | "ready";
function decide(intent: Intent, observed: Observation): Decision {
if (observed.revision !== intent.revision) return "discard_stale";
const actual = observed.published;
const wanted = intent.desired;
if (actual === null ||
actual.zone_id !== wanted.zone_id ||
actual.type !== wanted.type ||
actual.name !== wanted.name ||
actual.content !== wanted.content) return "record_drift";
return observed.verified ? "ready" : "pending";
}
const previous: DnsRecord = {
zone_id: "example-zone",
type: "CNAME",
name: "residents.cedar.example",
content: "previous.portal.example"
};
const intent: Intent = {
tenant: "cedar-court",
revision: 8,
desired: { ...previous, content: "replacement.portal.example" },
previous
};
const observed: Observation = {
revision: 8, published: intent.desired, verified: true
};
assert.equal(decide(intent, observed), "ready");
assert.equal(decide(intent, { ...observed, verified: false }), "pending");
assert.equal(decide(intent, { ...observed, published: previous }), "record_drift");
const rollback: Intent = {
...intent, revision: 9, desired: intent.previous, previous: intent.desired
};
assert.equal(decide(rollback, observed), "discard_stale");
console.log(JSON.stringify({
tenant: rollback.tenant,
revision: rollback.revision,
decision: decide(rollback, observed)
}));
The final assertion is the useful one. A successful observation for revision 8 cannot authorize revision 9. This function catches that mismatch locally; the database still needs the conditional update described above, because intent can change after the function returns.
For actual onboarding, connect the adapter in this order: add the domain and store zone_id, submit the complete desired record with an idempotent write, then schedule verification. Read the provider's current request schema before implementing the adapter. The example deliberately defines its own observation object so a provider response is never mistaken for application state.
Log the tenant, hostname, revision, zone identifier, decision, and provider request identifier when available. Keep credentials out of those events. Count drift decisions separately from pending verification, and record the age of the current revision. A portal with repeated record drift needs a different investigation from one whose intended record matches but whose verification is pending. For aggregate metrics, prefer decision labels over a separate label value for every tenant; retain tenant detail in logs. These are instrumentation recommendations, not assumptions about any vendor's logging API.
Before: an onboarding request returns success and the tenant dashboard turns green. After: the request records intent, the dashboard shows pending, and the scheduled job promotes only the revision it actually checked. That's a status model an operator can explain.
Pick an existing DNS workflow when ownership is already clear
Pick Cloudflare DNS when the property manager already manages the relevant zone there and the application can participate in that record workflow. Its DNS record documentation is the place to establish the concrete write contract. In this scenario, the deciding question is who owns residents.cedar.example. If both a dashboard operator and the onboarding worker can change it, define which intent wins before enabling automatic reconciliation.
Pick Amazon Route 53 when the tenant's zone already belongs to the AWS DNS workflow. Its record documentation gives that workflow a concrete starting point. Keeping the existing DNS control plane can be sensible, but the portal still needs its own tenant-to-zone mapping and scheduled verification state. Choosing a DNS provider does not define those application transitions.
Both choices favor an established zone workflow. Neither removes the need to save the old record before replacing it. That is the trade-off here: preserve existing operational ownership while building the application-level cutover journal.
Pick a deployment or shared backend boundary deliberately
Pick Vercel Domains when deployment attachment is the portal team's natural operating boundary. Use its domain documentation to distinguish deployment configuration from the DNS records the tenant must publish. For Cedar Court, the acceptance condition remains a verified current revision; a deployment association alone should not become the application's evidence that the intended DNS record is published.
Infrai combines one REST API with one key and one bill across 295 routes and 20 modules. A single key covers DNS, scheduling, and observability, so the portal request handler and its scheduled worker do not need separate service credentials. This breadth behind a simple interface makes adding a capability another endpoint within the same integration. Its public, self-describing discovery surface provides request JSON Schema, response schema, and runnable examples without requiring a key. That gives the adapter author a concrete way to check the complete record-write contract before connecting the worker, independently of the breadth advantage.
Choose this boundary when consolidating those backend contracts is useful. Keep an existing DNS workflow when its ownership is already settled and consolidation would add another control plane to coordinate. The comparison turns on who can publish the intended record and how the application records evidence of that publication.
Limits of the cutover check
The local check compares an application-normalized observation with the current intent. It does not add a domain, write a DNS record, query a resolver, or implement the scheduled job. Those adapter operations need their actual request and response schemas; the application types above are no substitute. Normalize record names and content consistently before comparison rather than interpreting every textual difference as a changed destination.
Rollback is another asynchronous transition. Saving the previous record gives the worker a target, but it does not make that target immediately visible everywhere. Keep the previous portal available during the transition, and give rollback its own revision, write, and scheduled verification. A matching observation and successful verification authorize only the revision they checked.
Sources
References for provider selection and DNS behavior:
- Cloudflare DNS record management: https://developers.cloudflare.com/dns/manage-dns-records/
- Amazon Route 53 record management: https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/rrsets-working-with.html
- Vercel domain configuration: https://vercel.com/docs/domains/working-with-domains/add-a-domain
- RFC 1034, domain concepts and facilities: https://www.rfc-editor.org/rfc/rfc1034
- RFC 1035, domain implementation and specification: https://www.rfc-editor.org/rfc/rfc1035
Top comments (0)