跳转到主要内容

System Requirements

  • Docker (latest stable version)
  • Node.js (latest LTS version)
  • Yarn or NPM (latest stable version)
  • Domain name or fixed IP (for external deployments)
  • 3000: Kodus Web App
  • 3001: API
  • 3332: Webhooks
  • 5672, 15672, 15692: RabbitMQ (AMQP, management, metrics)
  • 3101: MCP Manager (API, metrics)
  • 5432: PostgreSQL - 27017: MongoDB
Internet access is only required if you plan to connect with cloud-based Git services like GitHub, GitLab, or Bitbucket. For self-hosted Git tools within your network, external internet access is optional.

Domain Name Setup (Optional)

If you're planning to integrate Kodus with cloud-based Git providers (GitHub, GitLab, or Bitbucket), you'll need public-facing URLs for both the Kodus Web App and its API. This allows your server to receive webhooks for proper Code Review functionality and ensures correct application behavior. We recommend setting up two subdomains:
  • One for the Web Application, e.g., kodus-web.yourdomain.com.
  • One for the API, e.g., kodus-api.yourdomain.com.
Both subdomains should have DNS A records pointing to your server's IP address. Later in this guide, we will configure a reverse proxy (Nginx) to route requests to these subdomains to the correct internal services. This setup is essential for full functionality, including webhooks and authentication.
Note: If you're only connecting to self-hosted Git tools on your network and do not require public access or webhooks, you might be able to use a simpler setup, but this guide focuses on public-facing deployments.

Setup

1

Clone the installer repository

git clone https://github.com/kodustech/kodus-installer.git
cd kodus-installer
2

Copy the example environment file

cp .env.example .env
3

Generate secure keys for the required environment variables

./generate-keys.sh
4

Edit the environment file

Edit .env with your values using your preferred text editor.
nano .env
See Environment Variables Configuration for detailed instructions.
5

Run the installer

./scripts/install.sh
6

Success 🎉

When complete, Kodus Services should be running on your machine. You can verify your installation using the following script:
./scripts/doctor.sh
7

Access the web interface

Once you access the web interface for the first time, you'll need to:
  1. Create your admin account - This will be the first user with full system access
  2. Configure your Git provider - Connect GitHub, GitLab, or Bitbucket following the on-screen instructions
  3. Select repositories for analysis - Choose which code repositories Kody will review
For detailed steps on the initial configuration process, refer to our Getting Started Guide.

环境变量配置

使用此部分填写您的 .env。首先从公共 URL 开始,然后设置数据库和 RabbitMQ,最后添加特定于提供商的设置。

命名空间配置

这些设置定义了 Web 应用程序和 API 使用的公共 URL 和主机绑定。如果您不使用 MCP Manager,可以在此处跳过 MCP 条目和下面的完整块。
WEB_HOSTNAME_API="kodus-api.yourdomain.com"    # 公共 API 主机名(例如 kodus-api.yourdomain.com)
NEXTAUTH_URL="https://kodus-web.yourdomain.com" # Web 应用程序的完整公共基本 URL(例如 https://kodus-web.yourdomain.com)
API_HOST=0.0.0.0                              # API 主机(本地开发使用 0.0.0.0)

# 仅在您想使用 MCP 功能时需要。
API_KODUS_SERVICE_MCP_MANAGER=http://kodus-mcp-manager:3101 # MCP Manager URL
API_KODUS_MCP_SERVER_URL=http://kodus-api.yourdomain.com/mcp # Kodus MCP Server URL

LLM 提供商配置

API_LLM_PROVIDER_MODEL="gpt-5"     # 您想要使用的模型
API_OPENAI_FORCE_BASE_URL="https://your-api.com/v1"  # 您的 API 提供商 URL
API_OPEN_AI_API_KEY="your-api-key"          # 您的 API 提供商密钥
查看我们的模型特定指南,获取热门提供商(如 Novita、OpenAI、Anthropic 等)的详细设置说明。

数据库配置

默认情况下,使用本地容器运行 Postgres 和 MongoDB。更新凭据以符合您的安全要求。
# 使用本地容器运行 Postgres 和 MongoDB
USE_LOCAL_DB=true

# PostgreSQL 设置
API_DATABASE_ENV="development"                # development, production, test
API_PG_DB_HOST=db_kodus_postgres              # PostgreSQL 主机
API_PG_DB_PORT=5432                          # PostgreSQL 端口
API_PG_DB_USERNAME=kodusdev                  # 数据库用户名
API_PG_DB_PASSWORD=                          # 数据库密码
API_PG_DB_DATABASE=kodus_db                  # 数据库名称

# MongoDB 设置
API_MG_DB_HOST=db_kodus_mongodb              # MongoDB 主机
API_MG_DB_PORT=27017                         # MongoDB 端口
API_MG_DB_USERNAME=kodusdev                  # 数据库用户名
API_MG_DB_PASSWORD=                          # 数据库密码
API_MG_DB_DATABASE=kodus                     # 数据库名称
API_MG_DB_PRODUCTION_CONFIG=''               # 其他生产设置

RabbitMQ 配置

2.0 需要 RabbitMQ。保持 URI 与以下值同步。
# RabbitMQ 配置
USE_LOCAL_RABBITMQ=true
RABBITMQ_HOSTNAME=rabbitmq                   # Docker 网络中的 RabbitMQ 主机名
RABBITMQ_DEFAULT_USER=kodus                  # RabbitMQ 用户(在生产环境中更改)
RABBITMQ_DEFAULT_PASS=kodus                  # RabbitMQ 密码(在生产环境中更改)

# 保持 URI 与上面的用户、密码和 vhost 同步
API_RABBITMQ_URI=amqp://kodus:kodus@rabbitmq:5672/kodus-ai # RabbitMQ 连接 URI
API_RABBITMQ_ENABLED=true                    # RabbitMQ 是必需的

Git 提供商配置

选择并配置您首选的 Git 提供商。您可以设置一个或多个提供商;对于基本的基于令牌的身份验证,您只需要 webhook URL。
# 基于令牌的身份验证所需
API_GITHUB_CODE_MANAGEMENT_WEBHOOK="https://kodus-api.yourdomain.com/github/webhook"          # GitHub webhook URL(使用您的 API 域名更新)

MCP Manager 配置

仅在您想使用 MCP Manager 时需要。
MCP Manager 是将 Kody 连接到外部工具并在插件屏幕中公开这些工具的服务。查看我们的 MCP Manager 文档了解更多信息。
API_MCP_SERVER_ENABLED=false # 如果您想使用 MCP Manager,请更改为 true
---
API_KODUS_SERVICE_MCP_MANAGER=http://kodus-mcp-manager:3101
API_KODUS_MCP_SERVER_URL=http://localhost:3001/mcp

# MCP Manager 配置
API_MCP_MANAGER_LOG_LEVEL=info
API_MCP_MANAGER_PORT=3101
API_MCP_MANAGER_NODE_ENV=development
API_MCP_MANAGER_DATABASE_ENV=development
API_MCP_MANAGER_CORS_ORIGINS=*
API_MCP_MANAGER_JWT_SECRET=
API_MCP_MANAGER_COMPOSIO_BASE_URL=https://backend.composio.dev/api/v3
API_MCP_MANAGER_COMPOSIO_API_KEY=
API_MCP_MANAGER_MCP_PROVIDERS=kodusmcp,composio,custom
API_MCP_MANAGER_REDIRECT_URI=http://localhost:3000/setup/mcp/oauth
API_MCP_MANAGER_PG_DB_SCHEMA=mcp-manager
API_MCP_MANAGER_ENCRYPTION_SECRET=