Skip to content

Commit 0dca4b0

Browse files
committed
Docs: UI as gateway for local dev; github app
1 parent 61637d4 commit 0dca4b0

File tree

5 files changed

+44
-9
lines changed

5 files changed

+44
-9
lines changed

docs/ce/local-development/backend.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Backend (orchestrator) local setup
2+
title: Orchestrator local setup
33
---
44

55
The backend serves orchestration APIs, GitHub app endpoints, and internal APIs the UI relies on.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
title: GitHub App settings for local dev
3+
---
4+
5+
Use these settings when connecting a GitHub App to your local stack (tunneled via the UI domain).
6+
7+
## Required URLs
8+
9+
- **Callback URL** (OAuth/web): `https://<your-public-ui-domain>/orchestrator/github/callback`
10+
- **Webhook URL**: `https://<your-public-ui-domain>/orchestrator/github/webhook`
11+
- **Setup URL (optional)**: `https://<your-public-ui-domain>/dashboard/onboarding?step=github`
12+
13+
> The UI forwards these to the backend. Ensure `ORCHESTRATOR_BACKEND_URL`/`SECRET` are set in UI and the backend is reachable from the UI host.
14+
15+
## Permissions & events (recommended)
16+
17+
- Permissions: `contents:read`, `pull_requests:write`, `issues:write`, `statuses:write`, `checks:write`, `metadata:read`, `administration:read`, `workflows:write`, `repository_hooks:write`, `members:read`.
18+
- Events: `issue_comment`, `pull_request`, `pull_request_review`, `pull_request_review_comment`, `push`, `check_run`, `status`.
19+
20+
## Install URL
21+
22+
After creating the app, use its install URL (e.g., `https://github.com/apps/<app-name>/installations/new`) as `ORCHESTRATOR_GITHUB_APP_URL` in `ui/.env.local`. This drives the "Connect with GitHub" button.
23+
24+
## Creating an app via the backend wizard
25+
26+
- Open `http://localhost:3000/github/setup` (or the backend’s public URL) to generate a manifest and create the app in GitHub. Needed envs on backend: `HOSTNAME` set to a reachable URL, and optional `GITHUB_ORG` if you want to scope to an org.
27+
- Once created, copy the install URL into `ORCHESTRATOR_GITHUB_APP_URL` and restart the UI.
28+
29+
## Troubleshooting
30+
31+
- **404 on connect**: `ORCHESTRATOR_GITHUB_APP_URL` not set or points to a non-existent path.
32+
- **Callbacks fail**: UI not exposed publicly; tunnel the UI port and update callback/webhook URLs to that domain.
33+
- **Backend rejects /api/github/link**: ensure `DIGGER_ENABLE_API_ENDPOINTS=true` and `DIGGER_INTERNAL_SECRET` matches the UI `ORCHESTRATOR_BACKEND_SECRET`.

docs/ce/local-development/overview.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This section explains how to run the three core services locally:
66

77
- **Backend** (`backend/`, port 3000 by default) – orchestrator + REST APIs for repos/orgs/jobs.
88
- **Statesman** (`taco/cmd/statesman`, port 8080) – state storage API and Terraform Cloud-compatible endpoints.
9-
- **UI** (`ui/`, port 3030) – TanStack Start frontend that talks to both services and WorkOS.
9+
- **UI** (`ui/`, port 3030) – TanStack Start frontend that talks to both services and WorkOS. When tunneling (e.g., ngrok), expose the UI host; WorkOS and GitHub callbacks should point to the UI domain.
1010

1111
## Prerequisites
1212

@@ -27,7 +27,7 @@ This section explains how to run the three core services locally:
2727
2) **Start statesman** with internal endpoints enabled; use memory storage for quick start.
2828
3) **Configure UI** `.env.local` with URLs + secrets + WorkOS creds; run `pnpm dev --host --port 3030`.
2929
4) **Sync org/user** into backend and statesman (WorkOS org id and user id/email) via the provided curl snippets in each page.
30-
5) (Optional) **GitHub App**: set `ORCHESTRATOR_GITHUB_APP_URL` to your install URL or `http://localhost:3000/github/setup` to create one via the backend.
30+
5) (Optional) **GitHub App**: set `ORCHESTRATOR_GITHUB_APP_URL` to your install URL or `http://localhost:3000/github/setup` to create one via the backend. Use the UI domain for app callback/webhook URLs (see GitHub App settings page).
3131

3232
## Troubleshooting cheatsheet
3333

docs/ce/local-development/ui.mdx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
title: UI local setup
33
---
44

5-
The UI is a TanStack Start app that authenticates via WorkOS and calls both backend and statesman.
5+
The UI is a TanStack Start app that authenticates via WorkOS and calls both backend and statesman. It also acts as the public gateway when tunneling (e.g., ngrok): expose the UI port, and point external callbacks to the UI domain.
66

77
## Quick start
88

99
1. Copy `.env.example` to `.env.local` in `ui/` and fill the essentials:
1010
```bash
1111
# URLs
12-
PUBLIC_URL=http://localhost:3030
13-
ALLOWED_HOSTS=localhost,127.0.0.1
12+
PUBLIC_URL=http://localhost:3030 # replace host with your public tunnel when exposing UI
13+
ALLOWED_HOSTS=localhost,127.0.0.1 # include your public tunnel host here
1414

1515
# WorkOS (User Management)
1616
WORKOS_CLIENT_ID=<your_workos_client_id>
1717
WORKOS_API_KEY=<your_workos_api_key>
1818
WORKOS_COOKIE_PASSWORD=<32+ random chars>
19-
WORKOS_REDIRECT_URI=http://localhost:3030/api/auth/callback
19+
WORKOS_REDIRECT_URI=http://localhost:3030/api/auth/callback # replace host with your public tunnel; must match WorkOS config
2020
WORKOS_WEBHOOK_SECRET=<if using webhooks locally via tunnel>
2121

2222
# Backend
@@ -40,7 +40,7 @@ The UI is a TanStack Start app that authenticates via WorkOS and calls both back
4040
pnpm install # or npm install
4141
pnpm dev --host --port 3030
4242
```
43-
Open `http://localhost:3030` and sign in with a WorkOS user that belongs to at least one org.
43+
Open `http://localhost:3030` (or your tunnel URL) and sign in with a WorkOS user that belongs to at least one org. Ensure the WorkOS redirect URI matches the public URL you configured.
4444
3. Ensure backend + statesman were started and the same secrets are in place (see [Backend](./backend) and [Statesman](./statesman)).
4545
4. Sync the WorkOS org/user to both services using the curl snippets on those pages (required for repos/units to load).
4646

@@ -49,3 +49,4 @@ The UI is a TanStack Start app that authenticates via WorkOS and calls both back
4949
- **NotFound/Forbidden listing units**: statesman org/user not synced or webhook secret mismatch.
5050
- **404 on repos or GitHub connect**: backend missing org/user, `DIGGER_ENABLE_API_ENDPOINTS` not set, or `ORCHESTRATOR_GITHUB_APP_URL` points to a non-existent path.
5151
- **WorkOS login succeeds but dashboard redirects to / or errors**: the signed-in user has no WorkOS org membership; add to an org and resync to services.
52+
- **WorkOS redirect blocked**: public URL not whitelisted; add your tunnel host to `ALLOWED_HOSTS` and to the WorkOS redirect URI list.

docs/docs.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@
171171
"ce/local-development/overview",
172172
"ce/local-development/backend",
173173
"ce/local-development/statesman",
174-
"ce/local-development/ui"
174+
"ce/local-development/ui",
175+
"ce/local-development/github-app"
175176
]
176177
},
177178
{

0 commit comments

Comments
 (0)