diff --git a/docs/configure-coderabbit.md b/docs/configure-coderabbit.md index a4cec30..39ae244 100644 --- a/docs/configure-coderabbit.md +++ b/docs/configure-coderabbit.md @@ -5,7 +5,7 @@ description: CodeRabbit offers various configuration options to tailor the reviews to your specific requirements. Configuration can be made using one of the below options. -sidebar_position: 3 +sidebar_position: 4 --- ```mdx-code-block @@ -47,7 +47,7 @@ Write your configuration file in the below editor to validate: :::note -`.coderabit.yaml` configuration file should exist in the feature branch for CodeRabbit review. +`.coderabit.yaml` configuration file should exist in the feature branch for CodeRabbit review. ::: diff --git a/docs/faq.md b/docs/faq.md index f71f14f..279ab45 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -2,7 +2,7 @@ title: FAQs sidebar_label: FAQs description: Frequently asked questions about CodeRabbit. -sidebar_position: 8 +sidebar_position: 9 --- ### General diff --git a/docs/guides/_category_.yml b/docs/guides/_category_.yml index 674b49b..6f70822 100644 --- a/docs/guides/_category_.yml +++ b/docs/guides/_category_.yml @@ -1,4 +1,4 @@ label: Guides -position: 6 +position: 7 collapsible: true collapsed: true diff --git a/docs/integrations/_category_.yml b/docs/integrations/_category_.yml index 1b85855..54e65b0 100644 --- a/docs/integrations/_category_.yml +++ b/docs/integrations/_category_.yml @@ -1,4 +1,4 @@ label: Integrations -position: 7 +position: 8 collapsible: true collapsed: true diff --git a/docs/platforms/_category_.yaml b/docs/platforms/_category_.yaml index 32fe7bb..31e215f 100644 --- a/docs/platforms/_category_.yaml +++ b/docs/platforms/_category_.yaml @@ -1,4 +1,4 @@ label: Supported Git Platforms -position: 5 +position: 6 collapsible: true collapsed: true diff --git a/docs/self-hosted/_category_.yaml b/docs/self-hosted/_category_.yaml new file mode 100644 index 0000000..f965af1 --- /dev/null +++ b/docs/self-hosted/_category_.yaml @@ -0,0 +1,4 @@ +label: Self-Hosted CodeRabbit +position: 3 +collapsible: true +collapsed: true diff --git a/docs/self-hosted/azure-devops.md b/docs/self-hosted/azure-devops.md new file mode 100644 index 0000000..2e229ec --- /dev/null +++ b/docs/self-hosted/azure-devops.md @@ -0,0 +1,118 @@ +--- +title: Use Self-Hosted CodeRabbit With Azure DevOps +sidebar_label: Azure DevOps +description: Instructions to self-host CodeRabbit and integrate it with Azure DevOps. +sidebar_position: 3 +--- + +## Create a Azure DevOps User + +* **Username**: Set the username to "CodeRabbit" for easier identification (optional). +* **Profile Image**: Use the CodeRabbitAI logo for the user image (optional). + +## Add User to Projects + +Add the CodeRabbit user to each project where you want CodeRabbit to post reviews, with rights to post reviews & open PRs. + +## Create a Personal Access Token for CodeRabbit user + +Generate a personal access token for the CodeRabbit user to be added in the `.env` file as `AZURE_DEVOPS_BOT_TOKEN`. + +**Necessary Scopes**: + +* `Code` - Full +* `Work Items` - Read, write, and manage + +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. + +## Add the necessary webhooks to each project + +1. **Navigate to project's Service Hooks Page**: Go to the service hooks configuration page in the desired Azure DevOps project. + +2. **Add the following webhooks:** + 1. Pull request created + 2. Pull request updated + 3. Pull request commented on + +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. + +## Prepare an `.env` file + +Create an `.env` file with the following content: + +```bash +# if using OpenAI +LLM_PROVIDER=openai +LLM_TIMEOUT=360000 +OPENAI_API_KEYS=<openai-key> +OPENAI_BASE_URL=[<openai-base-url>] +OPENAI_ORG_ID=[<openai-org-id>] +OPENAI_PROJECT_ID=[<openai-project-id>] + +# if using Azure OpenAI +LLM_PROVIDER=azure-openai +LLM_TIMEOUT=360000 +AZURE_OPENAI_ENDPOINT=<azure-openai-endpoint> +AZURE_OPENAI_API_KEY=<key> +AZURE_GPT4OMINI_DEPLOYMENT_NAME=<gpt-4o-mini-deployment-name> +AZURE_GPT4O_DEPLOYMENT_NAME=<gpt-4o-deployment-name, modelVersion: 2024-08-06> +## o1-mini is optional +AZURE_O1_MINI_DEPLOYMENT_NAME=[<o1-mini-deployment-name>] +## o1-preview is optional: it’s very expensive but provides best reviews +AZURE_O1_DEPLOYMENT_NAME=[<o1-preview-deployment-name>] +## gpt-4-turbo is optional: it’s expensive but provides better reviews than gpt-4o +AZURE_GPT4TURBO_DEPLOYMENT_NAME=[<gpt-4-turbo-deployment-name, modelVersion: turbo-2024-04-09>] + +TEMP_PATH=/cache + +AST_GREP_RULES_PATH=/home/jailuser/ast-grep-rules +AST_GREP_ESSENTIALS=ast-grep-essentials + +SELF_HOSTED=azure-devops + +AZURE_DEVOPS_BOT_TOKEN=<personal-access-token> +AZURE_DEVOPS_BOT_USERNAME=<bot-user-username> +CODERABBIT_LICENSE_KEY=<license-key> + +CODERABBIT_API_KEY=[<coderabbitai-api-key>] +ENABLE_LEARNINGS=[true] +ENABLE_METRICS=[true] + +JIRA_HOST=[<jira-host-url>] +JIRA_PAT=[<jira-personal-access-token>] + +LINEAR_PAT=[<linear-personal-access-token>] +``` + +:::note + +* If you are using Azure OpenAI, verify that the model deployment names are in the .env file. +* Values marked with [] are not optional to provide. +* You can generate `CODERABBIT_API_KEY` from CodeRabbit UI -> Organizations Settings -> API Keys. + +::: + +## Pull the CodeRabbit Docker image + +Authenticate and pull the Docker image using the provided credentials file: + +```bash +cat coderabbit.json | docker login -u _json_key --password-stdin us-docker.pkg.dev +docker pull <docker-registry>/coderabbit-agent:latest +``` + +### Verify the image is up + +You can query `/health` endpoint to verify that the coderabbit-agent service is up and running. + +```bash +curl 127.0.0.1:8080/health +``` + +## Host the image + +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: + +```bash +docker run --env-file .env --publish 127.0.0.1:8080:8080 <docker-registry>/coderabbit-agent:latest +``` diff --git a/docs/self-hosted/github.md b/docs/self-hosted/github.md new file mode 100644 index 0000000..2afcf98 --- /dev/null +++ b/docs/self-hosted/github.md @@ -0,0 +1,143 @@ +--- +title: Use Self-Hosted CodeRabbit With GitHub +sidebar_label: GitHub +description: Instructions to self-host CodeRabbit and integrate it with GitHub. +sidebar_position: 1 +--- + +## Create a GitHub App + +Set the following Repository permissions: + +* Checks: Read-only +* Contents: Read and write +* Commit statuses: Read and write +* Discussions: Read-only +* Issues: Read & write +* Metadata: Read-only +* Pull requests: Read & write + +Set the following Organization permissions: + +* Members: Read-only + +Set the following events: + +* Meta +* Issue comment +* Issues +* Label +* Public +* Pull request +* Pull request review +* Pull request review comment +* Pull request review thread +* Push +* Release + +## Gather information from the GitHub App + +* App ID +* Client ID +* Client Secret +* Webhook Secret + +## Prepare an `.env` file + +```bash +# if using OpenAI +LLM_PROVIDER=openai +LLM_TIMEOUT=360000 +OPENAI_API_KEYS=<openai-key> +OPENAI_BASE_URL=[<openai-base-url>] +OPENAI_ORG_ID=[<openai-org-id>] +OPENAI_PROJECT_ID=[<openai-project-id>] + +# if using Azure OpenAI +LLM_PROVIDER=azure-openai +LLM_TIMEOUT=360000 +AZURE_OPENAI_ENDPOINT=<azure-openai-endpoint> +AZURE_OPENAI_API_KEY=<key> +AZURE_GPT4OMINI_DEPLOYMENT_NAME=<gpt-4o-mini-deployment-name> +AZURE_GPT4O_DEPLOYMENT_NAME=<gpt-4o-deployment-name, modelVersion: 2024-08-06> +## o1-mini is optional +AZURE_O1_MINI_DEPLOYMENT_NAME=[<o1-mini-deployment-name>] +## o1-preview is optional: it’s very expensive but provides best reviews +AZURE_O1_DEPLOYMENT_NAME=[<o1-preview-deployment-name>] +## gpt-4-turbo is optional: it’s expensive but provides better reviews than gpt-4o +AZURE_GPT4TURBO_DEPLOYMENT_NAME=[<gpt-4-turbo-deployment-name, modelVersion: turbo-2024-04-09>] + +# if using Anthropic +LLM_PROVIDER=anthropic +LLM_TIMEOUT=360000 +ANTHROPIC_API_KEYS=<anthropic-key> +ANTHROPIC_BASE_URL=[<anthropic-base-url>] + +TEMP_PATH=/cache + +AST_GREP_RULES_PATH=/home/jailuser/ast-grep-rules +AST_GREP_ESSENTIALS=ast-grep-essentials + +SELF_HOSTED=github + +GH_WEBHOOK_SECRET=<webhook-secret> +GITHUB_HOSTNAME=[<github-hostname>] +GITHUB_APP_CLIENT_ID=<github-app-client-id> +GITHUB_APP_CLIENT_SECRET=<github-app-client-secret> +GITHUB_APP_ID=<github-app-id> +GITHUB_APP_PEM_FILE=<flattened-pem-file> + +CODERABBIT_LICENSE_KEY=<license-key> + +CODERABBIT_API_KEY=[<coderabbitai-api-key>] +ENABLE_LEARNINGS=[true] +ENABLE_METRICS=[true] + +JIRA_HOST=[<jira-host-url>] +JIRA_PAT=[<jira-personal-access-token>] + +LINEAR_PAT=[<linear-personal-access-token>] + +OAUTH2_ENDPOINT=[<endpoint>] +OAUTH2_CLIENT_ID=[<client-id>] +OAUTH2_CLIENT_SECRET=[<client-secret>] +``` + +:::note + +* If you are using Azure OpenAI, verify that the model deployment names are in the .env file. +* Values marked with [] are optional to provide. +* For `GITHUB_APP_PEM_FILE`, flatten the PEM file by replacing newlines with `\n`. +* For `GITHUB_HOSTNAME`, use GitHub Enterprise server's hostname, for example, “github.acme-inc.com” +* You can generate `CODERABBIT_API_KEY` from CodeRabbit UI -> Organizations Settings -> API Keys. + +::: + +## Pull the CodeRabbit Docker image + +Using the credentials file shared with you, first authenticate and then pull the image. + +```bash +cat coderabbit.json | docker login -u _json_key --password-stdin us-docker.pkg.dev +docker pull <docker-registry>/coderabbit-agent:latest +``` + +## Host the image + +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: + +```bash +docker run --env-file .env --publish 127.0.0.1:8080:8080 <docker-registry>/coderabbit-agent:latest +``` + +### Verify the image is up + +You can query `/health` endpoint to verify that the coderabbit-agent service is up and running. + +```bash +curl 127.0.0.1:8080/health +``` + +## Install the GitHub App + +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. diff --git a/docs/self-hosted/gitlab.md b/docs/self-hosted/gitlab.md new file mode 100644 index 0000000..dc73872 --- /dev/null +++ b/docs/self-hosted/gitlab.md @@ -0,0 +1,124 @@ +--- +title: Use Self-Hosted CodeRabbit With GitLab +sidebar_label: GitLab +description: Instructions to self-host CodeRabbit and integrate it with GitLab. +sidebar_position: 2 +--- + +## Create a GitLab User + +* **Username**: Set the username to "CodeRabbit" for easier identification (optional). +* **Profile Image**: Use the CodeRabbitAI logo for the user image (optional). + +## Add User to Projects + +Add the CodeRabbit user to each project where you want CodeRabbit to post reviews, with at least `Developer` access. + +## Create a Personal Access Token for CodeRabbit user + +Generate a personal access token for the CodeRabbit user to be added in the `.env` file as `GITLAB_BOT_TOKEN`. + +**Necessary Scopes**: + +* `api` + +Consult official CodeRabbitAI documentation for a detailed [guide](https://docs.coderabbit.ai/integrations/self-hosted-gitlab#generating-personal-access-token) on creating personal access tokens. + +## Add a webhook to each project + +1. **Navigate to Add Webhook Page**: Go to the webhook configuration page in the desired GitLab project. +2. **Add Webhook URL**: Enter the URL pointing to the CodeRabbit service, followed by `/gitlab_webhooks` (e.g., `http://127.0.0.1:8080/gitlab_webhooks`). +3. **Generate and Save Secret Token**: Generate a secret token, add it to the webhook, and store it securely. This will be needed for the `.env` file as `GITLAB_WEBHOOK_SECRET` (you can use a single secret token for all projects). +4. Select triggers: + + * Push events + * Comments + * Issues events + * Merge request events + +## Prepare an `.env` file + +Create an `.env` file with the following content: + +```bash +# if using OpenAI +LLM_PROVIDER=openai +LLM_TIMEOUT=360000 +OPENAI_API_KEYS=<openai-key> +OPENAI_BASE_URL=[<openai-base-url>] +OPENAI_ORG_ID=[<openai-org-id>] +OPENAI_PROJECT_ID=[<openai-project-id>] + +# if using Azure OpenAI +LLM_PROVIDER=azure-openai +LLM_TIMEOUT=360000 +AZURE_OPENAI_ENDPOINT=<azure-openai-endpoint> +AZURE_OPENAI_API_KEY=<key> +AZURE_GPT4OMINI_DEPLOYMENT_NAME=<gpt-4o-mini-deployment-name> +AZURE_GPT4O_DEPLOYMENT_NAME=<gpt-4o-deployment-name, modelVersion: 2024-08-06> +## o1-mini is optional +AZURE_O1_MINI_DEPLOYMENT_NAME=<o1-mini-deployment-name> +## o1-preview is optional: it’s very expensive but provides best reviews +AZURE_O1_DEPLOYMENT_NAME=<o1-preview-deployment-name> +## gpt-4-turbo is optional: it’s expensive but provides better reviews +AZURE_GPT4TURBO_DEPLOYMENT_NAME=[<gpt-4-turbo-deployment-name, modelVersion: turbo-2024-04-09>] + +# if using Anthropic +LLM_PROVIDER=anthropic +LLM_TIMEOUT=360000 +ANTHROPIC_API_KEYS=<anthropic-key> +ANTHROPIC_BASE_URL=[<anthropic-base-url>] + +TEMP_PATH=/cache + +AST_GREP_RULES_PATH=/home/jailuser/ast-grep-rules +AST_GREP_ESSENTIALS=ast-grep-essentials + +SELF_HOSTED=gitlab + +GITLAB_BOT_TOKEN=<personal-access-token> +GITLAB_WEBHOOK_SECRET=<webhook-secret-key> +CODERABBIT_LICENSE_KEY=<license-key> + +CODERABBIT_API_KEY=[<coderabbitai-api-key>] +ENABLE_LEARNINGS=[true] +ENABLE_METRICS=[true] + +JIRA_HOST=[<jira-host-url>] +JIRA_PAT=[<jira-personal-access-token>] + +LINEAR_PAT=[<linear-personal-access-token>] +``` + +:::note + +* If you are using Azure OpenAI, verify that the model deployment names are in the .env file. +* Values marked with [] are not optional to provide. +* You can generate `CODERABBIT_API_KEY` from CodeRabbit UI -> Organizations Settings -> API Keys. + +::: + +## Pull the CodeRabbit Docker image + +Authenticate and pull the Docker image using the provided credentials file: + +```bash +cat coderabbit.json | docker login -u _json_key --password-stdin us-docker.pkg.dev +docker pull <docker-registry>/coderabbit-agent:latest +``` + +### Verify the image is up + +You can query `/health` endpoint to verify that the coderabbit-agent service is up and running. + +```bash +curl 127.0.0.1:8080/health +``` + +## Host the image + +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: + +```bash +docker run --env-file .env --publish 127.0.0.1:8080:8080 <docker-registry>/coderabbit-agent:latest +``` diff --git a/docs/tools/_category_.yml b/docs/tools/_category_.yml index 0ea5859..ede457e 100644 --- a/docs/tools/_category_.yml +++ b/docs/tools/_category_.yml @@ -1,4 +1,4 @@ label: Supported Tools -position: 4 +position: 5 collapsible: true collapsed: true