g1t/deploy/stack.jsonc

291 lines10,266 bytesCodeBlame

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

Deploys as code: a manifest of every Worker, a deploy tool that ships only what changed in parallel stages, and a g1t Actions workflow1// Everything g1t deploys to Cloudflare, in one place. Read by
2// scripts/deploy.mjs (plan, deploy), deploy/self-host/configs.mjs (what a
3// self-hosted installation runs) and the tests in scripts/deploy/.
4// docs/DEPLOYING.md explains each field and how to add a unit.
5//
6// What is written here is what the Wrangler configs cannot say. The rest is
7// read from each unit's wrangler.jsonc, never copied: its D1 databases and
8// migrations, the services it binds to, its KV, R2, queues and routes. The
9// shared crates and packages a unit is built from are read from Cargo's and
10// npm's workspace metadata. `worker` and `d1` are written here too, so the
11// file reads as an inventory, and a test checks they match the configs.
12{
13 // Deployed in this order. A stage starts only when the one before it
14 // succeeded. A unit binds only to units in its own stage or an earlier
15 // one (a test checks it), so new code never calls a service that has
16 // not shipped yet. Within a stage, units go out in parallel.
17 //
18 // migrations: every pending D1 migration, before any code.
19 // core: the services, reached through service bindings.
20 // edge: public endpoints other than the site: API, MCP, models, g1t.page, status.
21 // front: the site, sudo and the docs.
22 "stages": ["migrations", "core", "edge", "front"],
23
24 // Names for the resources the configs refer to by id, for setup
25 // commands and the docs. A test checks every KV id in a config is here.
26 "resources": {
27 "kv": {
28 "16a4232cb746418db53782aa068be693": "g1t-actions-blobs",
29 "e627b571f07047e187c03e1fc2b3bbdd": "g1t-avatars",
30 "14bc5c233d4c46a5bbf23b5367cce5fd": "g1t-domains",
31 "be765052d0124c2a935b3db4dff99f1f": "g1t-repos-git-cache"
32 }
33 },
34
35 // Each deployable unit, by short name (`--only events,web`).
36 //
37 // kind: rust-worker (worker-build), ts-worker (Wrangler bundles it),
38 // react-router (vite build first), astro (astro build first).
39 // secrets: names only; set with `npx wrangler secret put NAME` in its folder.
40 // setup: one-time steps no config can say, for a first deploy.
41 // self_host: what deploy/self-host does with it: "run" (in the one
42 // workerd), "off" (bound to the off Worker), "separate" (a
43 // process of its own), or "none".
44 // inputs: files outside its folder it is built from that no workspace
45 // metadata names (a test finds such imports).
Fast pages, required checks on the branch, self-hosted runners, honest incidents46 // image: a Containers image (docs/DEPLOYING.md, "The runner's images"):
47 // dockerfile the image a deploy ships: the base plus the binary
48 // crate the crate that binary is built from (and what it uses)
49 // base { context: the base's folder, lock: the file that
50 // records the base that was pushed }; the base is
51 // rebuilt only when its folder changes
52 // repository where both are pushed in Cloudflare's registry
Deploys as code: a manifest of every Worker, a deploy tool that ships only what changed in parallel stages, and a g1t Actions workflow53 "units": {
54 "events": {
55 "path": "services/events",
56 "kind": "rust-worker",
57 "worker": "g1t-events",
58 "d1": { "database": "g1t-events", "migrations": "migrations" },
59 "stage": "core",
60 "secrets": [],
61 "self_host": "run"
62 },
63 "identity": {
64 "path": "services/identity",
65 "kind": "rust-worker",
66 "worker": "g1t-identity",
67 "d1": { "database": "g1t", "migrations": "migrations" },
68 "stage": "core",
69 "secrets": ["GITHUB_APP_CLIENT_SECRET", "IDENTITY_KEY"],
70 "setup": ["Email Sending on g1t.sh (the EMAIL binding)"],
71 "self_host": "run"
72 },
73 "repos": {
74 "path": "services/repos",
75 "kind": "rust-worker",
76 "worker": "g1t-repos",
77 "d1": { "database": "g1t-repos", "migrations": "migrations" },
78 "stage": "core",
79 "secrets": ["REPOS_KEY"],
Merge branch 'worktree-agent-a1b995daa94e4e1b7'80 "setup": [
81 "The Artifacts namespace `g1t` (the ARTIFACTS binding)",
82 "The R2 bucket `g1t-git-packs` (GIT_PACKS) with its lifecycle rule: `npx wrangler r2 bucket create g1t-git-packs`, then `npx wrangler r2 bucket lifecycle add g1t-git-packs expire-packs packs/ --expire-days 7 --abort-multipart-days 1`"
83 ],
Deploys as code: a manifest of every Worker, a deploy tool that ships only what changed in parallel stages, and a g1t Actions workflow84 "self_host": "run"
85 },
86 "work": {
87 "path": "services/work",
88 "kind": "rust-worker",
89 "worker": "g1t-work",
90 "d1": { "database": "g1t-work", "migrations": "migrations" },
91 "stage": "core",
92 "secrets": [],
93 "self_host": "run"
94 },
95 "search": {
96 "path": "services/search",
97 "kind": "rust-worker",
98 "worker": "g1t-search",
99 "d1": { "database": "g1t-search", "migrations": "migrations" },
100 "stage": "core",
101 "secrets": [],
102 "self_host": "run"
103 },
104 "projects": {
105 "path": "services/projects",
106 "kind": "ts-worker",
107 "worker": "g1t-projects",
108 "d1": { "database": "g1t-projects", "migrations": "migrations" },
109 "stage": "core",
110 "secrets": [],
111 "self_host": "run"
112 },
113 "billing": {
114 "path": "services/billing",
115 "kind": "rust-worker",
116 "worker": "g1t-billing",
117 "d1": { "database": "g1t-billing", "migrations": "migrations" },
118 "stage": "core",
Stripe's webhook secret is a Worker secret, STRIPE_WEBHOOK_SECRET, from a destination made in Stripe's dashboard119 "secrets": ["STRIPE_SECRET_KEY", "STRIPE_WEBHOOK_SECRET", "CLOUDFLARE_USAGE_TOKEN"],
Deploys as code: a manifest of every Worker, a deploy tool that ships only what changed in parallel stages, and a g1t Actions workflow120 "self_host": "run"
121 },
122 "integrations": {
123 "path": "services/integrations",
124 "kind": "rust-worker",
125 "worker": "g1t-integrations",
126 "d1": { "database": "g1t-integrations", "migrations": "migrations" },
127 "stage": "core",
128 "secrets": ["INTEGRATIONS_KEY", "GITHUB_APP_PRIVATE_KEY", "GITHUB_APP_WEBHOOK_SECRET"],
129 "self_host": "run"
130 },
131 "webhooks": {
132 "path": "services/webhooks",
133 "kind": "rust-worker",
134 "worker": "g1t-webhooks",
135 "d1": { "database": "g1t-webhooks", "migrations": "migrations" },
136 "stage": "core",
137 "secrets": ["WEBHOOKS_KEY"],
138 "self_host": "run"
139 },
140 "actions": {
141 "path": "services/actions",
142 "kind": "rust-worker",
143 "worker": "g1t-actions",
144 "d1": { "database": "g1t-actions", "migrations": "migrations" },
145 "stage": "core",
146 "secrets": ["ACTIONS_KEY"],
147 "self_host": "run"
148 },
Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member149 "packages": {
150 "path": "services/packages",
151 "kind": "rust-worker",
152 "worker": "g1t-packages",
153 "d1": { "database": "g1t-packages", "migrations": "migrations" },
154 "stage": "core",
155 "secrets": ["PACKAGES_TOKEN_SECRET", "R2_ACCESS_KEY_ID", "R2_SECRET_ACCESS_KEY"],
156 "setup": [
157 "The D1 database: npx wrangler d1 create g1t-packages, its id in services/packages/wrangler.jsonc",
158 "The R2 bucket for packages' files: npx wrangler r2 bucket create g1t-packages",
159 "The events queue: npx wrangler queues create g1t-events-packages",
160 "For signed downloads: an R2 API token with read access to g1t-packages, as R2_ACCESS_KEY_ID and R2_SECRET_ACCESS_KEY"
161 ],
162 "self_host": "run"
163 },
Deploys as code: a manifest of every Worker, a deploy tool that ships only what changed in parallel stages, and a g1t Actions workflow164 "security": {
165 "path": "services/security",
166 "kind": "rust-worker",
167 "worker": "g1t-security",
168 "d1": { "database": "g1t-security", "migrations": "migrations" },
169 "stage": "core",
170 "secrets": [],
171 "self_host": "run"
172 },
173 "deployments": {
174 "path": "services/deployments",
175 "kind": "ts-worker",
176 "worker": "g1t-deployments",
177 "d1": { "database": "g1t-deployments", "migrations": "migrations" },
178 "stage": "core",
179 "secrets": ["CLOUDFLARE_API_TOKEN"],
180 "setup": [
181 "Workers for Platforms, and the dispatch namespace: scripts/setup-deployments.sh",
182 "Custom domains (Cloudflare for SaaS on g1t.page): scripts/setup-custom-domains.sh"
183 ],
184 "self_host": "run"
185 },
186 "runner": {
187 "path": "services/runner",
188 "kind": "ts-worker",
189 "worker": "g1t-runner",
190 "stage": "core",
191 "secrets": ["AI_GATEWAY_TOKEN"],
Fast pages, required checks on the branch, self-hosted runners, honest incidents192 "setup": [
193 "Containers on the account; Docker on the machine that builds a new image",
194 "The base image, once: node scripts/deploy.mjs build-base"
195 ],
Deploys as code: a manifest of every Worker, a deploy tool that ships only what changed in parallel stages, and a g1t Actions workflow196 "image": {
197 "dockerfile": "services/runner/Dockerfile",
Fast pages, required checks on the branch, self-hosted runners, honest incidents198 // The binary the image adds to its base (scripts/build-runner.mjs).
199 "crate": "g1t-runner",
200 "base": { "context": "services/runner/base", "lock": "services/runner/base.json" },
201 "repository": "g1t-runner"
Deploys as code: a manifest of every Worker, a deploy tool that ships only what changed in parallel stages, and a g1t Actions workflow202 },
203 "self_host": "off"
204 },
205 "context": {
206 "path": "services/context",
207 "kind": "ts-worker",
208 "worker": "g1t-context",
209 "d1": { "database": "g1t-context", "migrations": "migrations" },
210 "stage": "core",
211 "secrets": [],
212 "setup": [
213 "The Vectorize index: npx wrangler vectorize create g1t-context --dimensions=768 --metric=cosine, with metadata indexes on workspace, kind, project and private"
214 ],
215 "self_host": "off"
216 },
217 "og": {
218 "path": "services/og",
219 "kind": "ts-worker",
220 "worker": "g1t-og",
221 "stage": "core",
222 "secrets": [],
223 "setup": ["Browser Rendering on the account (the BROWSER binding)"],
224 // The roadmap cards read the site's roadmap.
225 "inputs": ["apps/web/app/lib/roadmap.ts"],
226 "self_host": "none"
227 },
228 "api": {
229 "path": "apps/api",
230 "kind": "rust-worker",
231 "worker": "g1t-api",
232 "stage": "edge",
233 "secrets": [],
234 "self_host": "none"
235 },
236 "models": {
237 "path": "services/models",
238 "kind": "ts-worker",
239 "worker": "g1t-models",
240 "stage": "edge",
241 "secrets": ["AI_GATEWAY_TOKEN"],
242 "setup": ["The AI Gateway `g1t`"],
243 "self_host": "none"
244 },
245 "pages": {
246 "path": "services/pages",
247 "kind": "ts-worker",
248 "worker": "g1t-pages",
249 "stage": "edge",
250 "secrets": [],
251 "setup": ["A proxied wildcard DNS record on g1t.page (`*`, AAAA 100::): scripts/setup-deployments.sh"],
252 "self_host": "none"
253 },
254 "status": {
255 "path": "apps/status",
256 "kind": "ts-worker",
257 "worker": "g1t-status",
258 "d1": { "database": "g1t-status", "migrations": "migrations" },
259 "stage": "edge",
260 "secrets": ["STATUS_SECRET"],
261 "setup": ["Email Sending on g1t.sh (the EMAIL binding)"],
262 "self_host": "separate"
263 },
264 "web": {
265 "path": "apps/web",
266 "kind": "react-router",
267 "worker": "g1t",
268 "stage": "front",
269 "secrets": [],
Fast pages, required checks on the branch, self-hosted runners, honest incidents270 "setup": ["The R2 bucket g1t-downloads, for the self-hosted runner's releases: npx wrangler r2 bucket create g1t-downloads"],
Deploys as code: a manifest of every Worker, a deploy tool that ships only what changed in parallel stages, and a g1t Actions workflow271 "self_host": "run"
272 },
273 "sudo": {
274 "path": "apps/sudo",
275 "kind": "react-router",
276 "worker": "g1t-sudo",
277 "stage": "front",
278 "secrets": [],
279 "setup": ["A Cloudflare Access application on sudo.g1t.sh; its AUD tag is ACCESS_AUD"],
280 "self_host": "none"
281 },
282 "docs": {
283 "path": "apps/docs",
284 "kind": "astro",
285 "worker": "g1t-docs",
286 "stage": "front",
287 "secrets": [],
288 "self_host": "none"
289 }
290 }
291}

This file's history is long; its oldest lines are credited to the oldest commit read.