Skip to content

Commit 4ebcc0c

Browse files
add bitbucket docs
1 parent 21e967f commit 4ebcc0c

File tree

1 file changed

+114
-0
lines changed

1 file changed

+114
-0
lines changed

docs/self-hosted/bitbucket.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
---
2+
title: Use Self-Hosted CodeRabbit With Bitbucket Server
3+
sidebar_label: Bitbucket Server
4+
description: Instructions to self-host CodeRabbit and integrate it with Bitbucket Server.
5+
sidebar_position: 4
6+
---
7+
8+
:::note
9+
10+
The self-hosted option is only available for CodeRabbit Enterprise customers with 500 user seats or more. Please contact [CodeRabbit Sales](mailto:sales@coderabbit.ai) to learn more about the CodeRabbit Enterprise plan.
11+
12+
:::
13+
14+
## Create a Bitbucket User
15+
16+
- **Username**: Set the username to "CodeRabbit" for easier identification (optional).
17+
- **Profile Image**: Use the CodeRabbitAI logo for the user image (optional).
18+
19+
## Add User to Projects
20+
21+
Add the CodeRabbit user to each project where you want CodeRabbit to post reviews, with permissions to:
22+
23+
- Post reviews
24+
- Open pull requests
25+
26+
## Create a Personal Access Token for CodeRabbit user
27+
28+
Generate a personal access token for the CodeRabbit user to be added in the `.env` file as `BITBUCKET_SERVER_BOT_TOKEN`.
29+
30+
## Add a webhook to each project
31+
32+
1. **Navigate to Webhook Settings**: Go to the repository settings and locate the webhooks configuration page.
33+
2. **Configure Events**: Enable the following Pull Request events:
34+
- "Opened"
35+
- "Modified"
36+
- "Comment Added"
37+
3. **Add Webhook URL**: Enter the URL pointing to the CodeRabbit service, followed by `/bitbucket_server_webhooks` (e.g., `http://127.0.0.1:8080/bitbucket_server_webhooks`).
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+
AZURE_O1_MINI_DEPLOYMENT_NAME=[<o1-mini-deployment-name>] # Optional
60+
AZURE_O1_DEPLOYMENT_NAME=[<o1-preview-deployment-name>] # Optional: Provides best reviews but very expensive
61+
AZURE_GPT4TURBO_DEPLOYMENT_NAME=[<gpt-4-turbo-deployment-name>] # Optional: modelVersion: turbo-2024-04-09
62+
63+
# System Configuration
64+
TEMP_PATH=/cache
65+
AST_GREP_RULES_PATH=/home/jailuser/ast-grep-rules
66+
AST_GREP_ESSENTIALS=ast-grep-essentials
67+
SELF_HOSTED=bitbucket-server
68+
BITBUCKET_SERVER_URL=<bitbucket-server-url>/rest
69+
BITBUCKET_SERVER_WEBHOOK_SECRET=<webhook-secret>
70+
BITBUCKET_SERVER_BOT_TOKEN=<personal-access-token>
71+
BITBUCKET_SERVER_BOT_USERNAME=<bot-user-username>
72+
CODERABBIT_LICENSE_KEY=<license-key>
73+
CODERABBIT_API_KEY=[<coderabbitai-api-key>]
74+
75+
# Optional Features
76+
ENABLE_LEARNINGS=[true]
77+
ENABLE_METRICS=[true]
78+
JIRA_HOST=[<jira-host-url>]
79+
JIRA_PAT=[<jira-personal-access-token>]
80+
LINEAR_PAT=[<linear-personal-access-token>]
81+
```
82+
83+
:::note
84+
85+
- If you are using Azure OpenAI, verify that the model deployment names are in the .env file.
86+
- Values marked with [] are not optional to provide.
87+
- You can generate `CODERABBIT_API_KEY` from CodeRabbit UI -> Organizations Settings -> API Keys.
88+
89+
:::
90+
91+
## Pull the CodeRabbit Docker image
92+
93+
Authenticate and pull the Docker image using the provided credentials file:
94+
95+
```bash
96+
cat coderabbit.json | docker login -u _json_key --password-stdin us-docker.pkg.dev
97+
docker pull us-docker.pkg.dev/coderabbitprod/self-hosted/coderabbit-agent:latest
98+
```
99+
100+
### Verify the image is up
101+
102+
You can query `/health` endpoint to verify that the coderabbit-agent service is up and running.
103+
104+
```bash
105+
curl 127.0.0.1:8080/health
106+
```
107+
108+
## Host the image
109+
110+
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:
111+
112+
```bash
113+
docker run --env-file .env --publish 127.0.0.1:8080:8080 us-docker.pkg.dev/coderabbitprod/self-hosted/coderabbit-agent:latest
114+
```

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy