Self-Hosting

GitHub App

UIGraph imports repositories through a GitHub App. Users install it on their own account or organization, pick a repository, and UIGraph onboards it with GitHub Actions.

Every self-hosted installation needs its own app. Until you create one and set its values on the API, GitHub Actions is not offered as a way to onboard. Skip this page if your users onboard with the UIGraph skill instead.

Before you start

  • You can create apps on the GitHub account or organization that should own this one.
  • UIGRAPH_PUBLIC_URL is set and reachable from GitHub, because GitHub sends webhooks to it.

1. Name the app

Open github.com/settings/apps/new, or your organization's settings if the app should belong to the organization. Give the app a name and set Homepage URL to your UIGraph address.

The Create GitHub App form with the app name and homepage URL filled in

2. Set the URLs

Replace your-domain.com with your UIGRAPH_PUBLIC_URL in each value below.

FieldValue
Redirect URIUIGRAPH_PUBLIC_URL + /api/v1/github-app/callback
Setup URLUIGRAPH_PUBLIC_URL + /api/v1/github-app/callback
Webhook URLUIGRAPH_PUBLIC_URL + /api/v1/github-app/webhooks
SecretAny strong random value. Keep it, you need it again in step 5.

Turn on Allow wildcard matching under the redirect URI, and keep Webhook set to Active.

The redirect URI, setup URL, webhook URL, and webhook secret fields of the Create GitHub App form

3. Choose permissions

Under Repository permissions, grant these and leave everything else at No access.

PermissionAccessWhat it is for
MetadataRead-onlyList the repositories the app can see and read their details.
ContentsRead and writeCreate the onboarding branch and commit the generated files.
WorkflowsRead and writeCommit the three UIGraph workflow files under .github/workflows.
Pull requestsRead and writeOpen the pull request at the end of a run.
ActionsRead and writeFollow the onboarding run and retry failed jobs.

GitHub selects Metadata for you and does not let you remove it.

4. Subscribe to events

Under Subscribe to events, select Workflow job, Workflow run, and Pull request. UIGraph uses the first two to follow an onboarding run as it happens, and Pull request to tell whether the pull request it opened was merged or closed without merging.

Workflow job, Workflow run, and Pull request selected under Subscribe to events, above the Create GitHub App button

Under Where can this GitHub App be installed?, choose Any account if repositories outside the owning account should be able to install it. Then select Create GitHub App.

5. Set the values on UIGraph

The app's settings page now has everything the API needs.

On the app's settings pageEnvironment variable
App IDGITHUB_APP_ID
The last part of the app's public URLGITHUB_APP_SLUG
Client IDGITHUB_APP_CLIENT_ID
Generate a new client secretGITHUB_APP_CLIENT_SECRET
Generate a private key, then encode the downloaded .pem fileGITHUB_APP_PRIVATE_KEY_BASE64
The webhook secret from step 2GITHUB_WEBHOOK_SECRET

Encode the private key with:

base64 < your-app.private-key.pem | tr -d '\n'

The first five go together. Set all of them or none of them, otherwise the API will not start. GITHUB_WEBHOOK_SECRET is counted separately, and without it UIGraph does not accept webhooks from GitHub, so onboarding runs are never followed. Restart the API once all six are in place.

On GitHub Enterprise Server, also change GITHUB_API_URL and GITHUB_WEB_URL. Every variable is listed on UIGraph API.

Check it works

Open a UIGraph organization as an admin, start onboarding a service, and pick GitHub Actions. Install GitHub App should open GitHub and return you to UIGraph with the account connected.

SymptomCheck
GitHub Actions is not offeredAll five required variables are set and the API restarted cleanly.
GitHub returns you without connectingThe redirect URI and setup URL match UIGRAPH_PUBLIC_URL exactly, including scheme and host.
The run page never moves past a phaseGITHUB_WEBHOOK_SECRET matches the secret on the app, and the webhook URL is reachable from GitHub. Recent Deliveries on the app's Advanced page shows what GitHub sent and what it got back.

What your users run into once the app works is covered in Troubleshooting.

See also

On this page