|
| 1 | +--- |
| 2 | +title: "Configure Github integration for self-hosted Lightdash" |
| 3 | +description: "Description of your new file." |
| 4 | +--- |
| 5 | + |
| 6 | +In this guide we will show you how you can enable the Github integration on your on self-hosted Lightdash server. |
| 7 | + |
| 8 | +### Create a new Github app |
| 9 | + |
| 10 | +Go to app settings in Github, either organization or account developer settings and click `New Github App` |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | +**Settings:** |
| 15 | + |
| 16 | +1. Set the app name: must be unique across Github |
| 17 | +2. Add a description |
| 18 | +3. Homepage URL: e.g. `https://lightdash.com` |
| 19 | +4. Callback URL: `https://<your-domain>/api/v1/github/oauth/callback` |
| 20 | +5. Enable `Expire user authorization tokens` |
| 21 | +6. Enable `Request user authorization (OAuth) during installation` |
| 22 | + |
| 23 | +  |
| 24 | +7. Deactivate webhooks |
| 25 | + |
| 26 | +  |
| 27 | + |
| 28 | +**Repository Permissions:** |
| 29 | + |
| 30 | +- Checks: `Read and write` |
| 31 | +- Contents: `Read and write` |
| 32 | +- Pull requests: `Read and write` |
| 33 | +- Workflows (optional): `Read and write` |
| 34 | + |
| 35 | +**Account Permissions: **None |
| 36 | + |
| 37 | +**Where can this GitHub App be installed? **Any account |
| 38 | + |
| 39 | +### **Generate Certificate and Secret** |
| 40 | + |
| 41 | +After creating your Github account you will need to generate a Client Secret. |
| 42 | + |
| 43 | +Copy it and keep it safe, this will get used for the `GITHUB_CLIENT_SECRET` environment variable. |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | +And a Private Key. |
| 48 | + |
| 49 | +Convert the contents of the private key file into `base64` , this will get used for the `GITHUB_PRIVATE_KEY` environment variable. |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | +<Info> |
| 54 | + You should save both the Client Secret and the Private Key in a safe place as you might need them at a later time. |
| 55 | +</Info> |
| 56 | + |
| 57 | +### Adding credentials to your local environment |
| 58 | + |
| 59 | +Now you need to add the following environment variables to your Lightdash server. |
| 60 | + |
| 61 | +- `GITHUB_PRIVATE_KEY` : This is the `base64` string of the Private Key generated for your Github app |
| 62 | +- `GITHUB_CLIENT_SECRET` : This is the client secret generated for your Github app |
| 63 | +- `GITHUB_CLIENT_ID`: Copy this from your Github app settings \> General |
| 64 | +- `GITHUB_APP_ID`: Copy this from your Github app settings \> General |
| 65 | +- `GITHUB_APP_NAME`: This is the name you set for your app, you can find it in app settings. |
0 commit comments