From e311199f4ae2369bfded881facbfa40f3f49f061 Mon Sep 17 00:00:00 2001 From: Adam <2363879+adamdotdevin@users.noreply.github.com> Date: Mon, 9 Nov 2026 19:29:29 -0600 Subject: [PATCH] chore(infra): point docs.opencode.ai at the site worker (#62999) --- infra/app.ts | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/infra/app.ts b/infra/app.ts index 31b359ce0b3..c10991d73d8 100644 --- a/infra/app.ts +++ b/infra/app.ts @@ -1,4 +1,4 @@ -import { domain } from "./stage" +import { domain, zoneID } from "./stage" const GITHUB_APP_ID = new sst.Secret("GITHUB_APP_ID") const GITHUB_APP_PRIVATE_KEY = new sst.Secret("GITHUB_APP_PRIVATE_KEY") @@ -16,14 +16,27 @@ export const api = new sst.cloudflare.Worker("Api", { }, }) -// The V1 docs, at docs.opencode.ai/docs. opencode.ai/docs is the V2 docs (services/site), which sends paths -// without a V2 page here. -new sst.cloudflare.x.Astro("Web", { - domain: "docs." + domain, - path: "packages/web", - environment: { - // For astro config - SST_STAGE: $app.stage, - VITE_API_URL: api.url.apply((url) => url!), - }, -}) +// docs.opencode.ai and docs.dev.opencode.ai belong to the site Worker (services/site), which sends the old docs +// URLs there to the same path on the V1 docs at /v1/docs. Their custom domain was the V1 docs app's and is moved to +// the site Worker by hand in place, keeping its ID: every input of a custom domain forces a replacement, which would +// create the same ID and then delete it. DocsDomain adopts that resource so SST never deletes the live hostname: it +// is retained on delete, and its inputs are ignored so it is never updated or replaced. +if ($app.stage === "production" || $app.stage === "dev") { + new cloudflare.WorkersCustomDomain( + "DocsDomain", + { + accountId: "15d29c8639fd3733b1b5486a2acfd968", + hostname: `docs.${domain}`, + service: `opencode-site-${$app.stage}`, + zoneId: zoneID, + environment: "production", + }, + { + aliases: [ + `urn:pulumi:${$app.stage}::${$app.name}::sst:cloudflare:Astro$sst:cloudflare:Worker$cloudflare:index/workersCustomDomain:WorkersCustomDomain::WebWorkerDomain`, + ], + retainOnDelete: true, + ignoreChanges: ["accountId", "hostname", "service", "zoneId", "environment"], + }, + ) +}