Skip to content

Commit 8c14509

Browse files
authored
Add self-hosted section and update category positions (#110)
* add self-hosted section and update category positions * Refactor Docker image pull command to use a placeholder for the Docker registry * Refactor webhook URLs in self-hosted documentation * Refactor webhook URLs in self-hosted documentation
1 parent 0f4ed2b commit 8c14509

File tree

10 files changed

+396
-7
lines changed

10 files changed

+396
-7
lines changed

docs/configure-coderabbit.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description:
55
CodeRabbit offers various configuration options to tailor the reviews to your
66
specific requirements. Configuration can be made using one of the below
77
options.
8-
sidebar_position: 3
8+
sidebar_position: 4
99
---
1010

1111
```mdx-code-block
@@ -47,7 +47,7 @@ Write your configuration file in the below editor to validate:
4747

4848
:::note
4949

50-
`.coderabit.yaml` configuration file should exist in the feature branch for CodeRabbit review.
50+
`.coderabit.yaml` configuration file should exist in the feature branch for CodeRabbit review.
5151

5252
:::
5353

docs/faq.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: FAQs
33
sidebar_label: FAQs
44
description: Frequently asked questions about CodeRabbit.
5-
sidebar_position: 8
5+
sidebar_position: 9
66
---
77

88
### General

docs/guides/_category_.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
label: Guides
2-
position: 6
2+
position: 7
33
collapsible: true
44
collapsed: true

docs/integrations/_category_.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
label: Integrations
2-
position: 7
2+
position: 8
33
collapsible: true
44
collapsed: true

docs/platforms/_category_.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
label: Supported Git Platforms
2-
position: 5
2+
position: 6
33
collapsible: true
44
collapsed: true

docs/self-hosted/_category_.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
label: Self-Hosted CodeRabbit
2+
position: 3
3+
collapsible: true
4+
collapsed: true

docs/self-hosted/azure-devops.md

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
---
2+
title: Use Self-Hosted CodeRabbit With Azure DevOps
3+
sidebar_label: Azure DevOps
4+
description: Instructions to self-host CodeRabbit and integrate it with Azure DevOps.
5+
sidebar_position: 3
6+
---
7+
8+
## Create a Azure DevOps User
9+
10+
* **Username**: Set the username to "CodeRabbit" for easier identification (optional).
11+
* **Profile Image**: Use the CodeRabbitAI logo for the user image (optional).
12+
13+
## Add User to Projects
14+
15+
Add the CodeRabbit user to each project where you want CodeRabbit to post reviews, with rights to post reviews & open PRs.
16+
17+
## Create a Personal Access Token for CodeRabbit user
18+
19+
Generate a personal access token for the CodeRabbit user to be added in the `.env` file as `AZURE_DEVOPS_BOT_TOKEN`.
20+
21+
**Necessary Scopes**:
22+
23+
* `Code` - Full
24+
* `Work Items` - Read, write, and manage
25+
26+
Consult official CodeRabbitAI documentation for a detailed [guide](https://docs.coderabbit.ai/platforms/azure-devops#generating-a-personal-access-token) on creating personal access tokens.
27+
28+
## Add the necessary webhooks to each project
29+
30+
1. **Navigate to project's Service Hooks Page**: Go to the service hooks configuration page in the desired Azure DevOps project.
31+
32+
2. **Add the following webhooks:**
33+
1. Pull request created
34+
2. Pull request updated
35+
3. Pull request commented on
36+
37+
3. **Add Webhook URL**: Enter the URL pointing to the CodeRabbit service, followed by `/azure_webhooks` (e.g., `http://127.0.0.1:8080/azure_webhooks`) for each webhook.
38+
39+
## Prepare an `.env` file
40+
41+
Create an `.env` file with the following content:
42+
43+
```bash
44+
# if using OpenAI
45+
LLM_PROVIDER=openai
46+
LLM_TIMEOUT=360000
47+
OPENAI_API_KEYS=<openai-key>
48+
OPENAI_BASE_URL=[<openai-base-url>]
49+
OPENAI_ORG_ID=[<openai-org-id>]
50+
OPENAI_PROJECT_ID=[<openai-project-id>]
51+
52+
# if using Azure OpenAI
53+
LLM_PROVIDER=azure-openai
54+
LLM_TIMEOUT=360000
55+
AZURE_OPENAI_ENDPOINT=<azure-openai-endpoint>
56+
AZURE_OPENAI_API_KEY=<key>
57+
AZURE_GPT4OMINI_DEPLOYMENT_NAME=<gpt-4o-mini-deployment-name>
58+
AZURE_GPT4O_DEPLOYMENT_NAME=<gpt-4o-deployment-name, modelVersion: 2024-08-06>
59+
## o1-mini is optional
60+
AZURE_O1_MINI_DEPLOYMENT_NAME=[<o1-mini-deployment-name>]
61+
## o1-preview is optional: it’s very expensive but provides best reviews
62+
AZURE_O1_DEPLOYMENT_NAME=[<o1-preview-deployment-name>]
63+
## gpt-4-turbo is optional: it’s expensive but provides better reviews than gpt-4o
64+
AZURE_GPT4TURBO_DEPLOYMENT_NAME=[<gpt-4-turbo-deployment-name, modelVersion: turbo-2024-04-09>]
65+
66+
TEMP_PATH=/cache
67+
68+
AST_GREP_RULES_PATH=/home/jailuser/ast-grep-rules
69+
AST_GREP_ESSENTIALS=ast-grep-essentials
70+
71+
SELF_HOSTED=azure-devops
72+
73+
AZURE_DEVOPS_BOT_TOKEN=<personal-access-token>
74+
AZURE_DEVOPS_BOT_USERNAME=<bot-user-username>
75+
CODERABBIT_LICENSE_KEY=<license-key>
76+
77+
CODERABBIT_API_KEY=[<coderabbitai-api-key>]
78+
ENABLE_LEARNINGS=[true]
79+
ENABLE_METRICS=[true]
80+
81+
JIRA_HOST=[<jira-host-url>]
82+
JIRA_PAT=[<jira-personal-access-token>]
83+
84+
LINEAR_PAT=[<linear-personal-access-token>]
85+
```
86+
87+
:::note
88+
89+
* If you are using Azure OpenAI, verify that the model deployment names are in the .env file.
90+
* Values marked with [] are not optional to provide.
91+
* You can generate `CODERABBIT_API_KEY` from CodeRabbit UI -> Organizations Settings -> API Keys.
92+
93+
:::
94+
95+
## Pull the CodeRabbit Docker image
96+
97+
Authenticate and pull the Docker image using the provided credentials file:
98+
99+
```bash
100+
cat coderabbit.json | docker login -u _json_key --password-stdin us-docker.pkg.dev
101+
docker pull <docker-registry>/coderabbit-agent:latest
102+
```
103+
104+
### Verify the image is up
105+
106+
You can query `/health` endpoint to verify that the coderabbit-agent service is up and running.
107+
108+
```bash
109+
curl 127.0.0.1:8080/health
110+
```
111+
112+
## Host the image
113+
114+
You can host the image on a server, serverless function, or container environment and expose port `8080`. Run the Docker image with the equivalent command on your chosen platform, ensuring you replace the `.env` file path with the path to your actual `.env` file:
115+
116+
```bash
117+
docker run --env-file .env --publish 127.0.0.1:8080:8080 <docker-registry>/coderabbit-agent:latest
118+
```

docs/self-hosted/github.md

+143
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
---
2+
title: Use Self-Hosted CodeRabbit With GitHub
3+
sidebar_label: GitHub
4+
description: Instructions to self-host CodeRabbit and integrate it with GitHub.
5+
sidebar_position: 1
6+
---
7+
8+
## Create a GitHub App
9+
10+
Set the following Repository permissions:
11+
12+
* Checks: Read-only
13+
* Contents: Read and write
14+
* Commit statuses: Read and write
15+
* Discussions: Read-only
16+
* Issues: Read & write
17+
* Metadata: Read-only
18+
* Pull requests: Read & write
19+
20+
Set the following Organization permissions:
21+
22+
* Members: Read-only
23+
24+
Set the following events:
25+
26+
* Meta
27+
* Issue comment
28+
* Issues
29+
* Label
30+
* Public
31+
* Pull request
32+
* Pull request review
33+
* Pull request review comment
34+
* Pull request review thread
35+
* Push
36+
* Release
37+
38+
## Gather information from the GitHub App
39+
40+
* App ID
41+
* Client ID
42+
* Client Secret
43+
* Webhook Secret
44+
45+
## Prepare an `.env` file
46+
47+
```bash
48+
# if using OpenAI
49+
LLM_PROVIDER=openai
50+
LLM_TIMEOUT=360000
51+
OPENAI_API_KEYS=<openai-key>
52+
OPENAI_BASE_URL=[<openai-base-url>]
53+
OPENAI_ORG_ID=[<openai-org-id>]
54+
OPENAI_PROJECT_ID=[<openai-project-id>]
55+
56+
# if using Azure OpenAI
57+
LLM_PROVIDER=azure-openai
58+
LLM_TIMEOUT=360000
59+
AZURE_OPENAI_ENDPOINT=<azure-openai-endpoint>
60+
AZURE_OPENAI_API_KEY=<key>
61+
AZURE_GPT4OMINI_DEPLOYMENT_NAME=<gpt-4o-mini-deployment-name>
62+
AZURE_GPT4O_DEPLOYMENT_NAME=<gpt-4o-deployment-name, modelVersion: 2024-08-06>
63+
## o1-mini is optional
64+
AZURE_O1_MINI_DEPLOYMENT_NAME=[<o1-mini-deployment-name>]
65+
## o1-preview is optional: it’s very expensive but provides best reviews
66+
AZURE_O1_DEPLOYMENT_NAME=[<o1-preview-deployment-name>]
67+
## gpt-4-turbo is optional: it’s expensive but provides better reviews than gpt-4o
68+
AZURE_GPT4TURBO_DEPLOYMENT_NAME=[<gpt-4-turbo-deployment-name, modelVersion: turbo-2024-04-09>]
69+
70+
# if using Anthropic
71+
LLM_PROVIDER=anthropic
72+
LLM_TIMEOUT=360000
73+
ANTHROPIC_API_KEYS=<anthropic-key>
74+
ANTHROPIC_BASE_URL=[<anthropic-base-url>]
75+
76+
TEMP_PATH=/cache
77+
78+
AST_GREP_RULES_PATH=/home/jailuser/ast-grep-rules
79+
AST_GREP_ESSENTIALS=ast-grep-essentials
80+
81+
SELF_HOSTED=github
82+
83+
GH_WEBHOOK_SECRET=<webhook-secret>
84+
GITHUB_HOSTNAME=[<github-hostname>]
85+
GITHUB_APP_CLIENT_ID=<github-app-client-id>
86+
GITHUB_APP_CLIENT_SECRET=<github-app-client-secret>
87+
GITHUB_APP_ID=<github-app-id>
88+
GITHUB_APP_PEM_FILE=<flattened-pem-file>
89+
90+
CODERABBIT_LICENSE_KEY=<license-key>
91+
92+
CODERABBIT_API_KEY=[<coderabbitai-api-key>]
93+
ENABLE_LEARNINGS=[true]
94+
ENABLE_METRICS=[true]
95+
96+
JIRA_HOST=[<jira-host-url>]
97+
JIRA_PAT=[<jira-personal-access-token>]
98+
99+
LINEAR_PAT=[<linear-personal-access-token>]
100+
101+
OAUTH2_ENDPOINT=[<endpoint>]
102+
OAUTH2_CLIENT_ID=[<client-id>]
103+
OAUTH2_CLIENT_SECRET=[<client-secret>]
104+
```
105+
106+
:::note
107+
108+
* If you are using Azure OpenAI, verify that the model deployment names are in the .env file.
109+
* Values marked with [] are optional to provide.
110+
* For `GITHUB_APP_PEM_FILE`, flatten the PEM file by replacing newlines with `\n`.
111+
* For `GITHUB_HOSTNAME`, use GitHub Enterprise server's hostname, for example, “github.acme-inc.com”
112+
* You can generate `CODERABBIT_API_KEY` from CodeRabbit UI -> Organizations Settings -> API Keys.
113+
114+
:::
115+
116+
## Pull the CodeRabbit Docker image
117+
118+
Using the credentials file shared with you, first authenticate and then pull the image.
119+
120+
```bash
121+
cat coderabbit.json | docker login -u _json_key --password-stdin us-docker.pkg.dev
122+
docker pull <docker-registry>/coderabbit-agent:latest
123+
```
124+
125+
## Host the image
126+
127+
You can choose to host it on a server, serverless function, or a container environment and expose the port “8080”. Run the Docker image with the equivalent of the following command on the platform of your choice, replacing the “.env” file with the path to your “.env” file:
128+
129+
```bash
130+
docker run --env-file .env --publish 127.0.0.1:8080:8080 <docker-registry>/coderabbit-agent:latest
131+
```
132+
133+
### Verify the image is up
134+
135+
You can query `/health` endpoint to verify that the coderabbit-agent service is up and running.
136+
137+
```bash
138+
curl 127.0.0.1:8080/health
139+
```
140+
141+
## Install the GitHub App
142+
143+
You can install the GitHub App on your GitHub organization or user account and point the Webhook URL to the hosted CodeRabbit instance, for example, `http://127.0.0.1:8080/github_webhooks`. GitHub will send events to the CodeRabbit instance.

0 commit comments

Comments
 (0)