|
| 1 | +--- |
| 2 | +title: CodeRabbit for Self-Hosted GitHub |
| 3 | +description: Integrate CodeRabbit with your Self-Hosted GitHub instance. |
| 4 | +sidebar_label: Self-Hosted GitHub |
| 5 | +--- |
| 6 | + |
| 7 | +This page guides you through the process of integrating your CodeRabbit with your self-hosted GitHub instance. |
| 8 | + |
| 9 | +1. [Create a GitHub App](https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/registering-a-github-app) in your Organization or User account. |
| 10 | + |
| 11 | + - Set the following Repository permissions: |
| 12 | + - Checks: Read-only |
| 13 | + - Contents: Read and write |
| 14 | + - Discussions: Read-only |
| 15 | + - Issues: Read & write |
| 16 | + - Metadata: Read-only |
| 17 | + - Pull requests: Read & write |
| 18 | + |
| 19 | + - Set the following Organization permissions: |
| 20 | + - Members: Read-only |
| 21 | + |
| 22 | + - Set the following events: |
| 23 | + - Meta |
| 24 | + - Issue comment |
| 25 | + - Issues |
| 26 | + - Label |
| 27 | + - Public |
| 28 | + - Pull request |
| 29 | + - Pull request review |
| 30 | + - Pull request review comment |
| 31 | + - Pull request review thread |
| 32 | + - Push |
| 33 | + - Release |
| 34 | + |
| 35 | +2. Get the following information from the GitHub App: |
| 36 | + |
| 37 | + - App ID |
| 38 | + - Client ID |
| 39 | + - Client Secret |
| 40 | + - Webhook Secret |
| 41 | + |
| 42 | +3. Prepare `.env` file with the following information: |
| 43 | + |
| 44 | + ```bash |
| 45 | + OPENAI_API_KEYS=<openai-key> |
| 46 | + |
| 47 | + TEMP_PATH=/cache |
| 48 | + |
| 49 | + AST_GREP_RULES_PATH=/home/jailuser/ast-grep-rules |
| 50 | + AST_GREP_ESSENTIALS=ast-grep-essentials |
| 51 | + |
| 52 | + GH_WEBHOOK_SECRET=<webhook-secret> |
| 53 | + GITHUB_APP_CLIENT_ID=<github-app-client-id> |
| 54 | + GITHUB_APP_CLIENT_SECRET=<github-app-client-secret> |
| 55 | + GITHUB_APP_ID=<github-app-id> |
| 56 | + GITHUB_APP_PEM_FILE=<flattened-pem-file> |
| 57 | + ``` |
| 58 | + |
| 59 | + > Note: For the `GITHUB_APP_PEM_FILE`, you need to flatten the PEM file by replacing newlines with `\n`. |
| 60 | + |
| 61 | +4. Pull the CodeRabbit Docker image. The CodeRabbit Docker image is not available for public use. Please contact us at <[email protected]> for access. |
| 62 | + |
| 63 | +5. Host the image on a server, serverless function, or a container environment and expose the port `8080`. |
| 64 | + |
| 65 | +6. Install the GitHub App on your GitHub organization or user account and point the Webhook URL to the hosted CodeRabbit instance, for example, `127.0.0.1:8080/github_webhooks`. GitHub will send events to the CodeRabbit instance. |
0 commit comments