mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-16 21:15:57 +03:00
chore(infra): point docs.opencode.ai at the site worker (#62999)
This commit is contained in:
+25
-12
@@ -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"],
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user