How to Create a Self-Hosted GitHub App
If you are using Bencher Cloud, then you can simply sign up or log in
using the GitHub button.
For Bencher Self-Hosted, you will need to have a Bencher Plus Enterprise plan, create your own GitHub App, and update your console server configuration and API sever configuration.
Create a GitHub App
- Create a GitHub App
- GitHub App name
- Choose an unique name (ex:
Bencher for My Enterprise)
- Choose an unique name (ex:
- Homepage URL
- Set it to your Bencher Self-Hosted Console URL (ex:
https://bencher.example.com)
- Set it to your Bencher Self-Hosted Console URL (ex:
- Identifying and authorizing users
- Callback URL
- Set the callback URL to your Bencher Self-Hosted Console URL with the path
/auth/github(ex:https://bencher.example.com/auth/github)
- Set the callback URL to your Bencher Self-Hosted Console URL with the path
- ✅ Expire user authorization tokens
- ✅ Request user authorization (OAuth) during installation
- ✅ Enable Device Flow
- Callback URL
- Webhook
- ❌ Active - Uncheck this box
- Permissions
- Account permissions
- Email addresses:
Read-only
- Email addresses:
- Account permissions
- Where can this GitHub App be installed?
- 🔘 Any account
- Click
Create GitHub App - Now under
Generalfor the newly created app - Note the
Client ID(ex:Iv1.12864abcd1232048) - Client secrets
- Click
Generate a new client secret - Note this secret (ex:
00000abcd12345wxyz123456789abcdefgh0000)
- Click
- Add the Bencher logo PNG under Display information
- Private keys
- Click
Generate a private key
- Click
GitHub App Configuration
Console UI
Set the OAUTH_GITHUB environment variable to true when you run the bencher-console Docker image. (ex: OAUTH_GITHUB=true)
If the Client ID is missing, then the GitHub buttons will not appear in the UI.
API Server
Add the client_id and client_secret to the plus.github section of the server config.
If the GitHub section is missing, then the server will fail any GitHub authentication requests.
Linked Repositories
Upgrade the Bencher Self-Hosted API server and Console to v0.6.16 or later before you change these settings.
For a Project to link a GitHub repository for its detached runs, also set these for the GitHub App:
- Identifying and authorizing users
- Callback URL
- Set the first callback URL to your Bencher Self-Hosted Console URL with the path
/console/github(ex:https://bencher.example.com/console/github). GitHub sends the user to the first callback URL after they install the app. - Keep the callback URL with the path
/auth/githubafter it, for sign in (ex:https://bencher.example.com/auth/github). GitHub refuses a sign in whose callback URL is not listed.
- Set the first callback URL to your Bencher Self-Hosted Console URL with the path
- ✅ Request user authorization (OAuth) during installation
- Callback URL
- Webhook
- ✅ Active - Check this box
- Webhook URL
- Set it to your Bencher Self-Hosted API Server URL with the path
/v0/github/webhook(ex:https://api.bencher.example.com/v0/github/webhook)
- Set it to your Bencher Self-Hosted API Server URL with the path
- Webhook secret
- Enter a random secret and note it (ex:
0123456789abcdef0123456789abcdef)
- Enter a random secret and note it (ex:
- Permissions
- Repository permissions
- Contents:
Read and write
- Contents:
- Subscribe to events
- Leave every event unchecked
- Repository permissions
- Note the app’s slug, the last part of its public page URL (ex:
my-bencher-appinhttps://github.com/apps/my-bencher-app)
Add the slug, the private key, and the webhook secret as app in the plus.github section of the server config.
🐰 Congrats! You have learned how to setup a GitHub App! 🎉