GeezerVison is showing github.com — chore: move the api worker into the legacy service · jerrylee/opencode@9c318ce
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .github/workflows/deploy.yml +19-4Lines changed: 19 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 61 | 61 | VITE_SENTRY_DSN: ${{ vars.WEB_SENTRY_DSN }} | 62 | 62 | VITE_SENTRY_RELEASE: web@${{ github.sha }} | 63 | 63 |
| 64 | | - # The SST stack owns opncd.ai until this push removes its Share Worker, so this job runs after the | | 64 | + # The SST stack owned api.opencode.ai until this push removes its Api Worker, so this job runs after the | 65 | 65 | # SST deploy to take the hostname without a custom-domain conflict. | 66 | | - share: | | 66 | + legacy: | 67 | 67 | needs: deploy | 68 | 68 | if: github.repository == 'anomalyco/opencode' && github.ref_name != 'beta' | 69 | 69 | runs-on: blacksmith-4vcpu-ubuntu-2404 | | 89 | 89 | secret-ids: CLOUDFLARE_API_TOKEN,opencode/${{ github.ref_name }}/CLOUDFLARE_API_TOKEN | 90 | 90 | parse-json-secrets: false | 91 | 91 |
| 92 | | - - run: bun run deploy:${{ github.ref_name }} | 93 | | - working-directory: services/share | | 92 | + # The GitHub App secrets are read here, not in the step above, so only this step ever has them. They reach cf | | 93 | + # through a file in the runner's temp directory, never argv, and the file is removed when the step ends. | | 94 | + - name: Deploy | | 95 | + working-directory: services/legacy | | 96 | + env: | | 97 | + STAGE: ${{ github.ref_name }} | | 98 | + # An explicit bash runs with pipefail, so a failed secret read fails the step. | | 99 | + shell: bash | | 100 | + run: | | | 101 | + umask 077 | | 102 | + secrets="$RUNNER_TEMP/legacy-secrets.json" | | 103 | + trap 'rm -f "$secrets"' EXIT | | 104 | + for name in GITHUB_APP_ID GITHUB_APP_PRIVATE_KEY; do | | 105 | + aws secretsmanager get-secret-value --secret-id "opencode/$STAGE/$name" --output json | | | 106 | + jq --arg name "$name" '{($name): .SecretString}' | | 107 | + done | jq -s add > "$secrets" | | 108 | + bun run deploy:$STAGE --secrets-file "$secrets" |
Collapse file Copy file name to clipboardExpand all lines: bun.lock +73-88Lines changed: 73 additions & 88 deletions Collapse file Copy file name to clipboardExpand all lines: infra/app.ts -42Lines changed: 0 additions & 42 deletions Collapse file Copy file name to clipboardExpand all lines: packages/function/package.json -23Lines changed: 0 additions & 23 deletions Collapse file Copy file name to clipboardExpand all lines: packages/function/sst-env.d.ts -10Lines changed: 0 additions & 10 deletions Collapse file Copy file name to clipboardExpand all lines: packages/function/tsconfig.json -10Lines changed: 0 additions & 10 deletions Collapse file Copy file name to clipboardExpand all lines: script/release.ts +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -9,11 +9,10 @@ import path from "path" | 9 | 9 | import { parseArgs } from "util" | 10 | 10 |
| 11 | 11 | const root = path.resolve(import.meta.dir, "..") | 12 | | -// Commits that only touch these folders, such as the console, stats, cloud functions, docs, websites, and infra, are | | 12 | +// Commits that only touch these folders, such as the console, stats, services, docs, websites, and infra, are | 13 | 13 | // left out of the changelog. | 14 | 14 | const changelogExclusions = [ | 15 | 15 | ":(exclude)packages/console", | 16 | | - ":(exclude)packages/function", | 17 | 16 | ":(exclude)packages/stats", | 18 | 17 | ":(exclude)services", | 19 | 18 | ":(exclude)infra", | |
Collapse file Copy file name to clipboardExpand all lines: services/README.md +1-1Lines changed: 1 addition & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -6,7 +6,7 @@ and clients live in `packages/`. | 6 | 6 | | Service | Purpose | Deployment | | 7 | 7 | | ---------------------- | ----------------------------------------- | ---------------------------- | | 8 | 8 | | [`site`](./site) | The opencode.ai website and V2 docs | `deploy-site.yml`, `cf` | | 9 | | -| [`share`](./share) | Deprecated: sharing tombstone on opncd.ai | `deploy.yml`, `cf` | | | 9 | +| [`legacy`](./legacy) | Deprecated: opncd.ai and api.opencode.ai | `deploy.yml`, `cf` | | 10 | 10 | | [`updates`](./updates) | Release metadata and update selection | `release.yml`, Wrangler | | 11 | 11 | | [`files`](./files) | Public file distribution at `/files/*` | `deploy-files.yml`, Wrangler | | 12 | 12 |
| |
Collapse file Copy file name to clipboard File renamed without changes. Collapse file Copy file name to clipboard +30Lines changed: 30 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +# Legacy (deprecated) | | 2 | + | | 3 | +> **Deprecated.** What is left of V1's hosted services. Don't add features here. Each hostname can be | | 4 | +> dropped whenever we're fine breaking the old clients that still call it. | | 5 | +
| | 6 | +One Worker that answers by hostname: | | 7 | + | | 8 | +- `opncd.ai` (production) and `dev.opncd.ai` (development) are the retired session-sharing host. | | 9 | + Session sharing was retired in #55716 and V2 has no sharing. They serve the "Session sharing has | | 10 | + been discontinued" page, and the old `/api/share` endpoints still answer so V1 clients keep working | | 11 | + (`src/share.ts`). | | 12 | +- `api.opencode.ai` (production) and `api.dev.opencode.ai` (development) exchange a GitHub Actions | | 13 | + OIDC token for a GitHub App installation token for the V1 GitHub Action | | 14 | + (`POST /exchange_github_app_token`, `src/api.ts`). | | 15 | + | | 16 | +`cloudflare.config.ts` defines the Worker. `deploy:dev` and `deploy:production` deploy it with `cf`, | | 17 | +after the SST job in `.github/workflows/deploy.yml`, because the SST stack owned these hostnames until | | 18 | +the Worker moved here. The deploy job reads the `GITHUB_APP_ID` and `GITHUB_APP_PRIVATE_KEY` Worker | | 19 | +secrets from AWS Secrets Manager (`opencode/<stage>/GITHUB_APP_*`) and uploads them with | | 20 | +`--secrets-file`. | | 21 | + | | 22 | +| Environment | Worker | Hostnames | | | 23 | +| ----------- | ---------------------------- | ------------------------------------- | | | 24 | +| Development | `opencode-legacy-dev` | `dev.opncd.ai`, `api.dev.opencode.ai` | | | 25 | +| Production | `opencode-legacy-production` | `opncd.ai`, `api.opencode.ai` | | | 26 | + | | 27 | +```bash | | 28 | +bun run typecheck | | 29 | +bun test | | 30 | +``` |
|