diff --git a/docs/integrations/self-hosted-github.md b/docs/integrations/self-hosted-github.md new file mode 100644 index 00000000..6884fa97 --- /dev/null +++ b/docs/integrations/self-hosted-github.md @@ -0,0 +1,72 @@ +--- +title: CodeRabbit for Self-Hosted GitHub +description: Integrate CodeRabbit with your Self-Hosted GitHub instance. +sidebar_label: Self-Hosted GitHub +--- + +This page guides you through the process of integrating your CodeRabbit with your self-hosted GitHub instance. + +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. + + - Set the following Repository permissions: + - Checks: Read-only + - Contents: 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 + +2. Get the following information from the GitHub App: + + - App ID + - Client ID + - Client Secret + - Webhook Secret + +3. Prepare a `.env` file with the following information: + + ```bash + OPENAI_API_KEYS= + + TEMP_PATH=/cache + + AST_GREP_RULES_PATH=/home/jailuser/ast-grep-rules + AST_GREP_ESSENTIALS=ast-grep-essentials + + GH_WEBHOOK_SECRET= + GITHUB_APP_CLIENT_ID= + GITHUB_APP_CLIENT_SECRET= + GITHUB_APP_ID= + GITHUB_APP_PEM_FILE= + ``` + + > Note: For the `GITHUB_APP_PEM_FILE`, you need to flatten the PEM file by replacing newlines with `\n`. + +4. Pull the CodeRabbit Docker image. The CodeRabbit Docker image is not available for public use. Please contact us at [contact@coderabbit.ai](mailto:contact@coderabbit.ai) for access. + + ```bash + cat coderabbit.json | docker login -u _json_key --password-stdin https://gcr.io + docker pull gcr.io/coderabbitprod/coderabbit-agent:latest + ``` + + > Note: The `coderabbit.json` file is a service account key file that will be shared with you. + +5. Host the image on a server, serverless function, or a container environment and expose the port `8080`. + +6. 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/package.json b/package.json index 2c5ce110..dfca3882 100644 --- a/package.json +++ b/package.json @@ -1,53 +1,53 @@ { - "name": "coderabbit-docs", - "version": "0.0.0", - "private": true, - "scripts": { - "docusaurus": "docusaurus", - "start": "docusaurus start", - "build": "docusaurus build", - "swizzle": "docusaurus swizzle", - "deploy": "docusaurus deploy", - "clear": "docusaurus clear", - "serve": "docusaurus serve", - "write-translations": "docusaurus write-translations", - "write-heading-ids": "docusaurus write-heading-ids", - "typecheck": "tsc" - }, - "dependencies": { - "@docusaurus/core": "^3.1.1", - "@docusaurus/plugin-client-redirects": "^3.1.1", - "@docusaurus/plugin-content-blog": "^3.1.1", - "@docusaurus/preset-classic": "^3.1.1", - "@mdx-js/react": "^3.0.0", - "autoprefixer": "^10.4.16", - "clsx": "^2.0.0", - "disqus-react": "^1.1.5", - "postcss": "^8.4.32", - "prism-react-renderer": "^2.3.0", - "react": "^18.0.0", - "react-dom": "^18.0.0", - "tailwindcss": "^3.4.0" - }, - "devDependencies": { - "@docusaurus/module-type-aliases": "^3.1.1", - "@docusaurus/tsconfig": "^3.1.1", - "@docusaurus/types": "^3.1.1", - "typescript": "~5.2.2" - }, - "browserslist": { - "production": [ - ">0.5%", - "not dead", - "not op_mini all" - ], - "development": [ - "last 3 chrome version", - "last 3 firefox version", - "last 5 safari version" - ] - }, - "engines": { - "node": ">=18.0" - } + "name": "coderabbit-docs", + "version": "0.0.0", + "private": true, + "scripts": { + "docusaurus": "docusaurus", + "start": "docusaurus start", + "build": "docusaurus build", + "swizzle": "docusaurus swizzle", + "deploy": "docusaurus deploy", + "clear": "docusaurus clear", + "serve": "docusaurus serve", + "write-translations": "docusaurus write-translations", + "write-heading-ids": "docusaurus write-heading-ids", + "typecheck": "tsc" + }, + "dependencies": { + "@docusaurus/core": "^3.1.1", + "@docusaurus/plugin-client-redirects": "^3.1.1", + "@docusaurus/plugin-content-blog": "^3.1.1", + "@docusaurus/preset-classic": "^3.1.1", + "@mdx-js/react": "^3.0.0", + "autoprefixer": "^10.4.16", + "clsx": "^2.0.0", + "disqus-react": "^1.1.5", + "postcss": "^8.4.32", + "prism-react-renderer": "^2.3.0", + "react": "^18.0.0", + "react-dom": "^18.0.0", + "tailwindcss": "^3.4.0" + }, + "devDependencies": { + "@docusaurus/module-type-aliases": "^3.1.1", + "@docusaurus/tsconfig": "^3.1.1", + "@docusaurus/types": "^3.1.1", + "typescript": "~5.2.2" + }, + "browserslist": { + "production": [ + ">0.5%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 3 chrome version", + "last 3 firefox version", + "last 5 safari version" + ] + }, + "engines": { + "node": ">=18.0" + } }