Repository navigation
build(deploy): build every cloud service through one turbo graph #2425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6baedb4
build(deploy): build every cloud service through one turbo graph
fforootd fb1f527
build(deploy): keep the cloud doc edits to what the package needs
fforootd 2990487
build(deploy): add an empty changeset for the server's task inputs
fforootd 840685d
build(deploy): run the cloud's copy and migration as an uncached turb…
fforootd 6b9005d
build(deploy): order the cloud's build, migrate and deploy as turbo t…
fforootd bcef5e4
build(deploy): never take the cloud's launcher from turbo's cache
fforootd 226143e
build: route the docs' generation through the task graph, not their s…
fforootd 18a65da
docs: say why the cloud's server build installs and calls turbo by path
fforootd 3cbd88e
build(deploy): pass the whole environment to the cloud's local dev task
fforootd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
|
|
||
| --- | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #!/bin/sh | ||
| # The `deploy` task of @zitadel/cloud (apps/cloud/turbo.json), the last of | ||
| # the `server` service's build (repo-root vercel.json, Go preset), after | ||
| # `migrate`: hand the launcher to Vercel's Go builder, which takes the | ||
| # function from $VERCEL_OUTPUT_FILE, a path outside the repository. Outside | ||
| # a Vercel build there is nothing to hand over. | ||
| set -eu | ||
| cd "$(dirname "$0")" | ||
|
|
||
| if [ -z "${VERCEL_OUTPUT_FILE:-}" ]; then | ||
| echo "no VERCEL_OUTPUT_FILE: the launcher stays in apps/cloud/dist/nextgen-launcher" | ||
| exit 0 | ||
| fi | ||
| mkdir -p "$(dirname "$VERCEL_OUTPUT_FILE")" | ||
| cp dist/nextgen-launcher "$VERCEL_OUTPUT_FILE" | ||
| echo "handed dist/nextgen-launcher to the Go builder" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "name": "@zitadel/cloud", | ||
| "version": "0.0.0", | ||
| "private": true, | ||
| "license": "AGPL-3.0-only", | ||
| "type": "module", | ||
| "scripts": { | ||
| "build": "sh build-launcher.sh", | ||
| "migrate": "cd ../.. && apps/cloud/dist/nextgen-launcher migrate", | ||
| "deploy": "sh deploy.sh", | ||
| "schemas": "node ../../scripts/render-builtin-schemas.mjs", | ||
| "dev": "node ../../scripts/run-cloud.mjs" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| { | ||
| "$schema": "https://turborepo.dev/schema.json", | ||
| "extends": ["//"], | ||
| // The hosted cloud on Vercel: what the repo-root vercel.json's `server` and | ||
| // `schemas` services build. Moon has no project for it (moon's | ||
| // workspace:cloud is this package's `dev`), and the launcher's Go tests run | ||
| // in @zitadel/server#test (`go test ./...`). | ||
| "tasks": { | ||
| // The `server` service's function binary (build-launcher.sh), which | ||
| // `migrate` runs and `deploy` hands to Vercel. Never cached: it runs with | ||
| // the deployment's secrets and becomes its function, and branch builds | ||
| // (previews, CI) can write the team's remote cache, so an entry planted | ||
| // under production's key would run in production. Go's own build cache, | ||
| // in Vercel's build cache of the branch, keeps the compile short. | ||
| // | ||
| // Its inputs still decide when it is affected: the Go files and what | ||
| // they embed (//go:embed), as in apps/server/moon.yml's serverInputs, and | ||
| // the server's version, which it stamps in. The OpenAPI YAML reaches the | ||
| // binary only through the generated Go code. Turbo hashes the ignored | ||
| // files a glob matches, so the trees that hold other Go code are | ||
| // excluded: node_modules, agents' worktrees and, on Vercel, the Go | ||
| // toolchain and module cache inside the checkout (.vercel/cache/golang). | ||
| // Vercel's Go builder sets GOOS and GOARCH for the function's | ||
| // architecture; CGO_ENABLED is pinned in the script. | ||
| "build": { | ||
| "cache": false, | ||
| "passThroughEnv": ["GOFLAGS", "GOOS", "GOARCH"], | ||
| "inputs": [ | ||
| "$TURBO_DEFAULT$", | ||
| "$TURBO_ROOT$/**/*.go", | ||
| "$TURBO_ROOT$/**/*.sql", | ||
| "$TURBO_ROOT$/go.mod", | ||
| "$TURBO_ROOT$/go.sum", | ||
| "$TURBO_ROOT$/api/**/*.json", | ||
| "$TURBO_ROOT$/packages/config/defaults/**", | ||
| "$TURBO_ROOT$/internal/errorpage/*", | ||
| "$TURBO_ROOT$/packages/design-tokens/src/generated/tokens.css", | ||
| "$TURBO_ROOT$/internal/**/*.json", | ||
| "$TURBO_ROOT$/apps/server/package.json", | ||
| "!$TURBO_ROOT$/**/node_modules/**", | ||
| "!$TURBO_ROOT$/.claude/**", | ||
| "!$TURBO_ROOT$/.codex/**", | ||
| "!$TURBO_ROOT$/.cursor/**", | ||
| "!$TURBO_ROOT$/.agents/**", | ||
| "!$TURBO_ROOT$/.vercel/**" | ||
| ], | ||
| "outputs": ["dist/nextgen-launcher"] | ||
| }, | ||
| // The deployment's database: `launcher migrate` creates a preview's when | ||
| // it is missing (launcher/database.go) and migrates it. Migrations run | ||
| // here, before the deployment goes live, never when a function starts, | ||
| // and never from the cache. A failed migration fails the build and the | ||
| // previous deployment keeps serving, so every migration must leave the | ||
| // schema readable by the deployment still serving (expand/contract). | ||
| // | ||
| // It sees the whole environment: the deployment's configuration is the | ||
| // environment, and the launcher also checks every variable the function | ||
| // needs to start (a missing one fails the build), which strict mode would | ||
| // hide unless listed here. | ||
| "migrate": { | ||
| "cache": false, | ||
| "dependsOn": ["build"], | ||
| "passThroughEnv": ["*"] | ||
| }, | ||
| // The last step of the `server` service's build, whose command installs | ||
| // first, as Vercel's Go builder runs no installCommand, and then runs | ||
| // this task: deploy.sh copies the migrated launcher to | ||
| // $VERCEL_OUTPUT_FILE, where the builder takes the function from. | ||
| "deploy": { | ||
| "cache": false, | ||
| "dependsOn": ["migrate"] | ||
| }, | ||
| // The `schemas` service's static files: the built-in schemas the server | ||
| // embeds, rendered as the documents their identifiers name | ||
| // (scripts/render-builtin-schemas.mjs). Node only: on Vercel the | ||
| // service has no Go toolchain, so it renders the committed copies and | ||
| // waits for no generation. | ||
| "schemas": { | ||
| "inputs": [ | ||
| "$TURBO_DEFAULT$", | ||
| "$TURBO_ROOT$/scripts/render-builtin-schemas.mjs", | ||
| "$TURBO_ROOT$/api/openapi/endpoints/schemas/*.json" | ||
| ], | ||
| "outputs": ["dist/cloud-schemas/**"] | ||
| }, | ||
| // The cloud on localhost: `vercel dev` over vercel.json's services | ||
| // (scripts/run-cloud.mjs), which builds what the services' dev servers | ||
| // read itself. `pnpm run cloud` runs the same script without a runner. | ||
| // It sees the whole environment, as `pnpm run cloud` does: `vercel dev` | ||
| // hands it to every service (the server reads NEXTGEN_* and the | ||
| // OpenTelemetry SDK's OTEL_*, each dev server its own), and a list would | ||
| // quietly drop whatever it missed. | ||
| "dev": { | ||
| "inputs": [ | ||
| "$TURBO_DEFAULT$", | ||
| "$TURBO_ROOT$/scripts/run-cloud.mjs", | ||
| "$TURBO_ROOT$/scripts/dev-process.mjs", | ||
| "$TURBO_ROOT$/scripts/task-runner.mjs" | ||
| ], | ||
| "passThroughEnv": ["*"] | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.