Merge branch 'main' into bkellam/bump_react_email
7
.cursor/rules/style.mdc
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
description:
|
||||||
|
globs:
|
||||||
|
alwaysApply: true
|
||||||
|
---
|
||||||
|
- Always use 4 spaces for indentation
|
||||||
|
- Filenames should always be camelCase. Exception: if there are filenames in the same directory with a format other than camelCase, use that format to keep things consistent.
|
||||||
|
|
@ -18,12 +18,13 @@ SRC_TENANT_ENFORCEMENT_MODE=strict
|
||||||
AUTH_SECRET="00000000000000000000000000000000000000000000"
|
AUTH_SECRET="00000000000000000000000000000000000000000000"
|
||||||
AUTH_URL="http://localhost:3000"
|
AUTH_URL="http://localhost:3000"
|
||||||
# AUTH_CREDENTIALS_LOGIN_ENABLED=true
|
# AUTH_CREDENTIALS_LOGIN_ENABLED=true
|
||||||
# AUTH_GITHUB_CLIENT_ID=""
|
# AUTH_EE_GITHUB_CLIENT_ID=""
|
||||||
# AUTH_GITHUB_CLIENT_SECRET=""
|
# AUTH_EE_GITHUB_CLIENT_SECRET=""
|
||||||
# AUTH_GOOGLE_CLIENT_ID=""
|
# AUTH_EE_GOOGLE_CLIENT_ID=""
|
||||||
# AUTH_GOOGLE_CLIENT_SECRET=""
|
# AUTH_EE_GOOGLE_CLIENT_SECRET=""
|
||||||
|
|
||||||
DATA_CACHE_DIR=${PWD}/.sourcebot # Path to the sourcebot cache dir (ex. ~/sourcebot/.sourcebot)
|
DATA_CACHE_DIR=${PWD}/.sourcebot # Path to the sourcebot cache dir (ex. ~/sourcebot/.sourcebot)
|
||||||
|
SOURCEBOT_PUBLIC_KEY_PATH=${PWD}/public.pem
|
||||||
# CONFIG_PATH=${PWD}/config.json # Path to the sourcebot config file (if one exists)
|
# CONFIG_PATH=${PWD}/config.json # Path to the sourcebot config file (if one exists)
|
||||||
|
|
||||||
# Email
|
# Email
|
||||||
|
|
|
||||||
2
.github/workflows/_gcp-deploy.yml
vendored
|
|
@ -60,6 +60,8 @@ jobs:
|
||||||
NEXT_PUBLIC_SENTRY_ENVIRONMENT=${{ vars.NEXT_PUBLIC_SENTRY_ENVIRONMENT }}
|
NEXT_PUBLIC_SENTRY_ENVIRONMENT=${{ vars.NEXT_PUBLIC_SENTRY_ENVIRONMENT }}
|
||||||
NEXT_PUBLIC_SENTRY_WEBAPP_DSN=${{ vars.NEXT_PUBLIC_SENTRY_WEBAPP_DSN }}
|
NEXT_PUBLIC_SENTRY_WEBAPP_DSN=${{ vars.NEXT_PUBLIC_SENTRY_WEBAPP_DSN }}
|
||||||
NEXT_PUBLIC_SENTRY_BACKEND_DSN=${{ vars.NEXT_PUBLIC_SENTRY_BACKEND_DSN }}
|
NEXT_PUBLIC_SENTRY_BACKEND_DSN=${{ vars.NEXT_PUBLIC_SENTRY_BACKEND_DSN }}
|
||||||
|
NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY=${{ vars.NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY }}
|
||||||
|
NEXT_PUBLIC_LANGFUSE_BASE_URL=${{ vars.NEXT_PUBLIC_LANGFUSE_BASE_URL }}
|
||||||
SENTRY_SMUAT=${{ secrets.SENTRY_SMUAT }}
|
SENTRY_SMUAT=${{ secrets.SENTRY_SMUAT }}
|
||||||
SENTRY_ORG=${{ vars.SENTRY_ORG }}
|
SENTRY_ORG=${{ vars.SENTRY_ORG }}
|
||||||
SENTRY_WEBAPP_PROJECT=${{ vars.SENTRY_WEBAPP_PROJECT }}
|
SENTRY_WEBAPP_PROJECT=${{ vars.SENTRY_WEBAPP_PROJECT }}
|
||||||
|
|
|
||||||
17
.github/workflows/changelog-reminder.yml
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
name: Changelog Reminder
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [opened, synchronize, reopened, ready_for_review]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
remind:
|
||||||
|
name: Changelog Reminder
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ !github.event.pull_request.draft }}
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: mskelton/changelog-reminder-action@v3
|
||||||
2
.github/workflows/deploy-demo.yml
vendored
|
|
@ -2,7 +2,7 @@ name: Deploy Demo
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags: ["v*.*.*"]
|
branches: ["main"]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
|
||||||
18
.github/workflows/deploy-prod.yml
vendored
|
|
@ -1,18 +0,0 @@
|
||||||
name: Deploy Prod
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags: ["v*.*.*"]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
deploy-prod:
|
|
||||||
uses: ./.github/workflows/_gcp-deploy.yml
|
|
||||||
secrets: inherit
|
|
||||||
permissions:
|
|
||||||
contents: 'read'
|
|
||||||
# Requird for OIDC auth with GCP.
|
|
||||||
# @see: https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/about-security-hardening-with-openid-connect#adding-permissions-settings
|
|
||||||
id-token: 'write'
|
|
||||||
with:
|
|
||||||
environment: prod
|
|
||||||
18
.github/workflows/deploy-staging.yml
vendored
|
|
@ -1,18 +0,0 @@
|
||||||
name: Deploy Staging
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
deploy-staging:
|
|
||||||
uses: ./.github/workflows/_gcp-deploy.yml
|
|
||||||
secrets: inherit
|
|
||||||
permissions:
|
|
||||||
contents: 'read'
|
|
||||||
# Requird for OIDC auth with GCP.
|
|
||||||
# @see: https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/about-security-hardening-with-openid-connect#adding-permissions-settings
|
|
||||||
id-token: 'write'
|
|
||||||
with:
|
|
||||||
environment: staging
|
|
||||||
26
.github/workflows/docs-broken-links.yml
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
name: Check for broken links in docs
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: ["main"]
|
||||||
|
paths:
|
||||||
|
- "docs/**"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-links:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Use Node.Js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '20.x'
|
||||||
|
|
||||||
|
- name: Install Mintlify CLI
|
||||||
|
run: npm i -g mintlify
|
||||||
|
|
||||||
|
- name: Check for broken links
|
||||||
|
working-directory: docs
|
||||||
|
run: mintlify broken-links
|
||||||
143
CHANGELOG.md
|
|
@ -7,6 +7,135 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [4.6.0] - 2025-07-25
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Introducing Ask Sourcebot - ask natural langauge about your codebase. Get back comprehensive Markdown responses with inline citations back to the code. Bring your own LLM api key. [#392](https://github.com/sourcebot-dev/sourcebot/pull/392)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Fixed onboarding infinite loop when GCP IAP Auth is enabled. [#381](https://github.com/sourcebot-dev/sourcebot/pull/381)
|
||||||
|
|
||||||
|
## [4.5.3] - 2025-07-20
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Relicense core to FSL-1.1-ALv2. [#388](https://github.com/sourcebot-dev/sourcebot/pull/388)
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Added `GITLAB_CLIENT_QUERY_TIMEOUT_SECONDS` env var to configure the GitLab client's query timeout. [#390](https://github.com/sourcebot-dev/sourcebot/pull/390)
|
||||||
|
|
||||||
|
## [4.5.2] - 2025-07-19
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Fixed typos in UI, docs, code [#369](https://github.com/sourcebot-dev/sourcebot/pull/369)
|
||||||
|
- Add anonymous access option to core and deprecate the `enablePublicAccess` config setting. [#385](https://github.com/sourcebot-dev/sourcebot/pull/385)
|
||||||
|
|
||||||
|
## [4.5.1] - 2025-07-14
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Revamped onboarding experience. [#376](https://github.com/sourcebot-dev/sourcebot/pull/376)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Fixed issue with external source code links being broken for paths with spaces. [#364](https://github.com/sourcebot-dev/sourcebot/pull/364)
|
||||||
|
- Makes base retry indexing configuration configurable and move from a default of `5s` to `60s`. [#377](https://github.com/sourcebot-dev/sourcebot/pull/377)
|
||||||
|
- Fixed issue where files would sometimes never load in the code browser. [#365](https://github.com/sourcebot-dev/sourcebot/pull/365)
|
||||||
|
|
||||||
|
## [4.5.0] - 2025-06-21
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Added code nav and syntax highlighting for TCL. [#362](https://github.com/sourcebot-dev/sourcebot/pull/362)
|
||||||
|
- Added analytics dashboard. [#358](https://github.com/sourcebot-dev/sourcebot/pull/358)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Fixed issue where invites appeared to be created successfully, but were not actually being created in the database. [#359](https://github.com/sourcebot-dev/sourcebot/pull/359)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Audit logging is now enabled by default. [#358](https://github.com/sourcebot-dev/sourcebot/pull/358)
|
||||||
|
|
||||||
|
## [4.4.0] - 2025-06-18
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Added audit logging. [#355](https://github.com/sourcebot-dev/sourcebot/pull/355)
|
||||||
|
<!-- @NOTE: this release includes a API change that affects the MCP package (@sourcebot/mcp). On release, bump the MCP package's version and delete this message. -->
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Delete account join request when redeeming an invite. [#352](https://github.com/sourcebot-dev/sourcebot/pull/352)
|
||||||
|
- Fix issue where a repository would not be included in a search context if the context was created before the repository. [#354](https://github.com/sourcebot-dev/sourcebot/pull/354)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Changed search api (and all apis that depend on it) to return raw source code instead of base64 encoded string. ([356](https://github.com/sourcebot-dev/sourcebot/pull/356)).
|
||||||
|
|
||||||
|
|
||||||
|
## [4.3.0] - 2025-06-11
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Changed repository link in search to file tree + move external link to code host logo. [#340](https://github.com/sourcebot-dev/sourcebot/pull/340)
|
||||||
|
- Added a basic file search dialog when browsing a repository. [#341](https://github.com/sourcebot-dev/sourcebot/pull/341)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Text highlighting clarity. [#342](https://github.com/sourcebot-dev/sourcebot/pull/342)
|
||||||
|
- Fixed repo list column header styling. [#344](https://github.com/sourcebot-dev/sourcebot/pull/344)
|
||||||
|
- Clean up successful and failed jobs in Redis queues. [#343](https://github.com/sourcebot-dev/sourcebot/pull/343)
|
||||||
|
- Fixed issue with files occasionally not loading after moving the cursor rapidly over the file browser. [#346](https://github.com/sourcebot-dev/sourcebot/pull/346)
|
||||||
|
|
||||||
|
## [4.2.0] - 2025-06-09
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Added seperate page for signup. [#311](https://github.com/sourcebot-dev/sourcebot/pull/331)
|
||||||
|
- Fix repo images in authed instance case and add manifest json. [#332](https://github.com/sourcebot-dev/sourcebot/pull/332)
|
||||||
|
- Added encryption logic for license keys. [#335](https://github.com/sourcebot-dev/sourcebot/pull/335)
|
||||||
|
- Added hover tooltip for long repo names in filter panel. [#338](https://github.com/sourcebot-dev/sourcebot/pull/338)
|
||||||
|
- Added repo shard validation on startup. [#339](https://github.com/sourcebot-dev/sourcebot/pull/339)
|
||||||
|
- Added support for a file explorer when browsing files. [#336](https://github.com/sourcebot-dev/sourcebot/pull/336)
|
||||||
|
|
||||||
|
## [4.1.1] - 2025-06-03
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Added copy button for filenames. [#328](https://github.com/sourcebot-dev/sourcebot/pull/328)
|
||||||
|
- Added development docker compose file. [#328](https://github.com/sourcebot-dev/sourcebot/pull/328)
|
||||||
|
- Added keyboard shortcuts for find all refs / go to def. [#329](https://github.com/sourcebot-dev/sourcebot/pull/329)
|
||||||
|
- Added GCP IAP JIT provisioning. [#330](https://github.com/sourcebot-dev/sourcebot/pull/330)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Fixed issue with the symbol hover popover clipping at the top of the page. [#326](https://github.com/sourcebot-dev/sourcebot/pull/326)
|
||||||
|
- Fixed slow rendering issue with large reference/definition lists. [#327](https://github.com/sourcebot-dev/sourcebot/pull/327)
|
||||||
|
|
||||||
|
## [4.1.0] - 2025-06-02
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Added structured logging support. [#323](https://github.com/sourcebot-dev/sourcebot/pull/323)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Fixed issue where new oauth providers weren't being display in the login page. [commit](https://github.com/sourcebot-dev/sourcebot/commit/a2e06266dbe5e5ad4c2c3f730c73d64edecedcf7)
|
||||||
|
- Fixed client side "mark decorations may not be empty" error when viewing certain files. [#325](https://github.com/sourcebot-dev/sourcebot/pull/325)
|
||||||
|
- Fixed issue where the symbol hover popover would not appear for large source files. [#325](https://github.com/sourcebot-dev/sourcebot/pull/325)
|
||||||
|
|
||||||
|
|
||||||
|
## [4.0.1] - 2025-05-28
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Fixed issue with how entitlements are resolved for cloud. [#319](https://github.com/sourcebot-dev/sourcebot/pull/319)
|
||||||
|
|
||||||
|
## [4.0.0] - 2025-05-28
|
||||||
|
|
||||||
|
Sourcebot V4 introduces authentication, performance improvements and code navigation. Checkout the [migration guide](https://docs.sourcebot.dev/docs/upgrade/v3-to-v4-guide) for information on upgrading your instance to v4.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- [**Breaking Change**] Authentication is now required by default. Notes:
|
||||||
|
- When setting up your instance, email / password login will be the default authentication provider.
|
||||||
|
- The first user that logs into the instance is given the `owner` role. ([docs](https://docs.sourcebot.dev/docs/configuration/auth/roles-and-permissions)).
|
||||||
|
- Subsequent users can request to join the instance. The `owner` can approve / deny requests to join the instance via `Settings` > `Members` > `Pending Requests`.
|
||||||
|
- If a user is approved to join the instance, they are given the `member` role.
|
||||||
|
- Additional login providers, including email links and SSO, can be configured with additional environment variables. ([docs](https://docs.sourcebot.dev/docs/configuration/auth/overview)).
|
||||||
|
- Clicking on a search result now takes you to the `/browse` view. Files can still be previewed by clicking the "Preview" button or holding `Cmd` / `Ctrl` when clicking on a search result. [#315](https://github.com/sourcebot-dev/sourcebot/pull/315)
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- [Sourcebot EE] Added search-based code navigation, allowing you to jump between symbol definition and references when viewing source files. [Read the documentation](https://docs.sourcebot.dev/docs/features/code-navigation). [#315](https://github.com/sourcebot-dev/sourcebot/pull/315)
|
||||||
|
- Added collapsible filter panel. [#315](https://github.com/sourcebot-dev/sourcebot/pull/315)
|
||||||
|
- Added Sourcebot API key management for external clients. [#311](https://github.com/sourcebot-dev/sourcebot/pull/311)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Improved scroll performance for large numbers of search results. [#315](https://github.com/sourcebot-dev/sourcebot/pull/315)
|
||||||
|
|
||||||
## [3.2.1] - 2025-05-15
|
## [3.2.1] - 2025-05-15
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
@ -15,7 +144,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
## [3.2.0] - 2025-05-12
|
## [3.2.0] - 2025-05-12
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- Added AI code review agent [#298](https://github.com/sourcebot-dev/sourcebot/pull/298). Checkout the [docs](https://docs.sourcebot.dev/docs/agents/review-agent) for more information.
|
- Added AI code review agent [#298](https://github.com/sourcebot-dev/sourcebot/pull/298). Checkout the [docs](https://docs.sourcebot.dev/docs/features/agents/review-agent) for more information.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fixed issue with repos appearing in the carousel when they fail indexing for the first time. [#305](https://github.com/sourcebot-dev/sourcebot/pull/305)
|
- Fixed issue with repos appearing in the carousel when they fail indexing for the first time. [#305](https://github.com/sourcebot-dev/sourcebot/pull/305)
|
||||||
|
|
@ -84,20 +213,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [3.0.0] - 2025-04-01
|
## [3.0.0] - 2025-04-01
|
||||||
|
|
||||||
Sourcebot v3 is here and brings a number of structural changes to the tool's foundation, including a SQL database, parallelized indexing, authentication support, multitenancy, and more. Checkout the [migration guide](https://docs.sourcebot.dev/self-hosting/upgrade/v2-to-v3-guide) for information on upgrading your instance to v3.
|
Sourcebot v3 is here and brings a number of structural changes to the tool's foundation, including a SQL database, parallelized indexing, authentication support, multitenancy, and more. Checkout the [migration guide](https://docs.sourcebot.dev/docs/upgrade/v2-to-v3-guide) for information on upgrading your instance to v3.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- [**Breaking Change**] Changed the config schema such that connection objects are specified in the `connection` map, instead of the `repos` array. [See migration guide](https://docs.sourcebot.dev/self-hosting/upgrade/v2-to-v3-guide).
|
- [**Breaking Change**] Changed the config schema such that connection objects are specified in the `connection` map, instead of the `repos` array. [See migration guide](https://docs.sourcebot.dev/docs/upgrade/v2-to-v3-guide).
|
||||||
- Updated the tool's color-palette in dark mode.
|
- Updated the tool's color-palette in dark mode.
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- Added parallelized repo indexing and connection syncing via Redis & BullMQ. See the [architecture overview](https://docs.sourcebot.dev/self-hosting/overview#architecture).
|
- Added parallelized repo indexing and connection syncing via Redis & BullMQ. See the [architecture overview](https://docs.sourcebot.dev/docs/overview#architecture).
|
||||||
- Added repo indexing progress indicators in the navbar.
|
- Added repo indexing progress indicators in the navbar.
|
||||||
- Added authentication support via OAuth or email/password. For instructions on enabling, see [this doc](https://docs.sourcebot.dev/self-hosting/more/authentication).
|
- Added authentication support via OAuth or email/password. For instructions on enabling, see [this doc](https://docs.sourcebot.dev/docs/configuration/auth/overview).
|
||||||
- Added the following UI for managing your deployment when **[auth is enabled](https://docs.sourcebot.dev/self-hosting/more/authentication)**:
|
- Added the following UI for managing your deployment when **[auth is enabled](https://docs.sourcebot.dev/docs/configuration/auth/overview)**:
|
||||||
- connection management: create and manage your JSON configs via a integrated web-editor.
|
- connection management: create and manage your JSON configs via a integrated web-editor.
|
||||||
- secrets: import personal access tokens (PAT) into Sourcebot (AES-256 encrypted). Reference secrets in your connection config by name.
|
- secrets: import personal access tokens (PAT) into Sourcebot (AES-256 encrypted). Reference secrets in your connection config by name.
|
||||||
- team & invite management: invite users to your instance to give them access. Configure team [roles & permissions](https://docs.sourcebot.dev/docs/more/roles-and-permissions).
|
- team & invite management: invite users to your instance to give them access. Configure team [roles & permissions](https://docs.sourcebot.dev/docs/configuration/auth/roles-and-permissions).
|
||||||
- Added multi-tenancy support. See [this doc](https://docs.sourcebot.dev/self-hosting/more/tenancy).
|
- Added multi-tenancy support. See [this doc](https://docs.sourcebot.dev/self-hosting/more/tenancy).
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
>[!NOTE]
|
>[!NOTE]
|
||||||
> Building from source is only required if you'd like to contribute. The recommended way to use Sourcebot is to use the [pre-built docker image](https://github.com/sourcebot-dev/sourcebot/pkgs/container/sourcebot).
|
> Building from source is only required if you'd like to contribute. The recommended way to use Sourcebot is to use the [pre-built docker image](https://github.com/sourcebot-dev/sourcebot/pkgs/container/sourcebot).
|
||||||
|
|
||||||
1. Install <a href="https://go.dev/doc/install"><img src="https://go.dev/favicon.ico" width="16" height="16"> go</a>, <a href="https://nodejs.org/"><img src="https://nodejs.org/favicon.ico" width="16" height="16"> NodeJS</a>, [redis](https://redis.io/), and [postgres](https://www.postgresql.org/). Note that a NodeJS version of at least `21.1.0` is required.
|
1. Install <a href="https://go.dev/doc/install"><img src="https://go.dev/favicon.ico" width="16" height="16"> go</a>, <a href="https://docs.docker.com/get-started/get-docker/"><img src="https://www.docker.com/favicon.ico" width="16" height="16"> docker</a>, and <a href="https://nodejs.org/"><img src="https://nodejs.org/favicon.ico" width="16" height="16"> NodeJS</a>. Note that a NodeJS version of at least `21.1.0` is required.
|
||||||
|
|
||||||
2. Install [ctags](https://github.com/universal-ctags/ctags) (required by zoekt)
|
2. Install [ctags](https://github.com/universal-ctags/ctags) (required by zoekt)
|
||||||
```sh
|
```sh
|
||||||
|
|
@ -13,11 +13,15 @@
|
||||||
snap install universal-ctags
|
snap install universal-ctags
|
||||||
```
|
```
|
||||||
|
|
||||||
|
3. Install `yarn`:
|
||||||
|
```sh
|
||||||
|
npm install --global yarn
|
||||||
|
```
|
||||||
|
|
||||||
3. Clone the repository with submodules:
|
3. Clone the repository with submodules:
|
||||||
```sh
|
```sh
|
||||||
git clone --recurse-submodules https://github.com/sourcebot-dev/sourcebot.git
|
git clone --recurse-submodules https://github.com/sourcebot-dev/sourcebot.git
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Run `make` to build zoekt and install dependencies:
|
4. Run `make` to build zoekt and install dependencies:
|
||||||
```sh
|
```sh
|
||||||
cd sourcebot
|
cd sourcebot
|
||||||
|
|
@ -26,15 +30,21 @@
|
||||||
|
|
||||||
The zoekt binaries and web dependencies are placed into `bin` and `node_modules` respectively.
|
The zoekt binaries and web dependencies are placed into `bin` and `node_modules` respectively.
|
||||||
|
|
||||||
5. Create a copy of `.env.development` and name it `.env.development.local`. Update the required environment variables.
|
5. Start the development Docker containers for PostgreSQL and Redis.
|
||||||
|
|
||||||
6. If you're using a declerative configuration file (the default behavior if you didn't enable auth), create a configuration file and update the `CONFIG_PATH` environment variable in your `.env.development.local` file.
|
```sh
|
||||||
|
docker compose -f docker-compose-dev.yml up -d
|
||||||
|
```
|
||||||
|
|
||||||
7. Start Sourcebot with the command:
|
6. Create a copy of `.env.development` and name it `.env.development.local`. Update the required environment variables.
|
||||||
|
|
||||||
|
7. If you're using a declarative configuration file, create a configuration file and update the `CONFIG_PATH` environment variable in your `.env.development.local` file.
|
||||||
|
|
||||||
|
8. Start Sourcebot with the command:
|
||||||
```sh
|
```sh
|
||||||
yarn dev
|
yarn dev
|
||||||
```
|
```
|
||||||
|
|
||||||
A `.sourcebot` directory will be created and zoekt will begin to index the repositories found in the `config.json` file.
|
A `.sourcebot` directory will be created and zoekt will begin to index the repositories found in the `config.json` file.
|
||||||
|
|
||||||
8. Start searching at `http://localhost:3000`.
|
9. Start searching at `http://localhost:3000`.
|
||||||
|
|
|
||||||
23
Dockerfile
|
|
@ -17,6 +17,8 @@ ARG NEXT_PUBLIC_SENTRY_ENVIRONMENT
|
||||||
ARG NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT
|
ARG NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT
|
||||||
ARG NEXT_PUBLIC_SENTRY_WEBAPP_DSN
|
ARG NEXT_PUBLIC_SENTRY_WEBAPP_DSN
|
||||||
ARG NEXT_PUBLIC_SENTRY_BACKEND_DSN
|
ARG NEXT_PUBLIC_SENTRY_BACKEND_DSN
|
||||||
|
ARG NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY
|
||||||
|
ARG NEXT_PUBLIC_LANGFUSE_BASE_URL
|
||||||
|
|
||||||
FROM node:20-alpine3.19 AS node-alpine
|
FROM node:20-alpine3.19 AS node-alpine
|
||||||
FROM golang:1.23.4-alpine3.19 AS go-alpine
|
FROM golang:1.23.4-alpine3.19 AS go-alpine
|
||||||
|
|
@ -42,11 +44,15 @@ COPY ./packages/db ./packages/db
|
||||||
COPY ./packages/schemas ./packages/schemas
|
COPY ./packages/schemas ./packages/schemas
|
||||||
COPY ./packages/crypto ./packages/crypto
|
COPY ./packages/crypto ./packages/crypto
|
||||||
COPY ./packages/error ./packages/error
|
COPY ./packages/error ./packages/error
|
||||||
|
COPY ./packages/logger ./packages/logger
|
||||||
|
COPY ./packages/shared ./packages/shared
|
||||||
|
|
||||||
RUN yarn workspace @sourcebot/db install
|
RUN yarn workspace @sourcebot/db install
|
||||||
RUN yarn workspace @sourcebot/schemas install
|
RUN yarn workspace @sourcebot/schemas install
|
||||||
RUN yarn workspace @sourcebot/crypto install
|
RUN yarn workspace @sourcebot/crypto install
|
||||||
RUN yarn workspace @sourcebot/error install
|
RUN yarn workspace @sourcebot/error install
|
||||||
|
RUN yarn workspace @sourcebot/logger install
|
||||||
|
RUN yarn workspace @sourcebot/shared install
|
||||||
# ------------------------------------
|
# ------------------------------------
|
||||||
|
|
||||||
# ------ Build Web ------
|
# ------ Build Web ------
|
||||||
|
|
@ -63,6 +69,10 @@ ARG NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT
|
||||||
ENV NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT=$NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT
|
ENV NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT=$NEXT_PUBLIC_SOURCEBOT_CLOUD_ENVIRONMENT
|
||||||
ARG NEXT_PUBLIC_SENTRY_WEBAPP_DSN
|
ARG NEXT_PUBLIC_SENTRY_WEBAPP_DSN
|
||||||
ENV NEXT_PUBLIC_SENTRY_WEBAPP_DSN=$NEXT_PUBLIC_SENTRY_WEBAPP_DSN
|
ENV NEXT_PUBLIC_SENTRY_WEBAPP_DSN=$NEXT_PUBLIC_SENTRY_WEBAPP_DSN
|
||||||
|
ARG NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY
|
||||||
|
ENV NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY=$NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY
|
||||||
|
ARG NEXT_PUBLIC_LANGFUSE_BASE_URL
|
||||||
|
ENV NEXT_PUBLIC_LANGFUSE_BASE_URL=$NEXT_PUBLIC_LANGFUSE_BASE_URL
|
||||||
|
|
||||||
# To upload source maps to Sentry, we need to set the following build-time args.
|
# To upload source maps to Sentry, we need to set the following build-time args.
|
||||||
# It's important that we don't set these for oss builds, otherwise the Sentry
|
# It's important that we don't set these for oss builds, otherwise the Sentry
|
||||||
|
|
@ -89,6 +99,8 @@ COPY --from=shared-libs-builder /app/packages/db ./packages/db
|
||||||
COPY --from=shared-libs-builder /app/packages/schemas ./packages/schemas
|
COPY --from=shared-libs-builder /app/packages/schemas ./packages/schemas
|
||||||
COPY --from=shared-libs-builder /app/packages/crypto ./packages/crypto
|
COPY --from=shared-libs-builder /app/packages/crypto ./packages/crypto
|
||||||
COPY --from=shared-libs-builder /app/packages/error ./packages/error
|
COPY --from=shared-libs-builder /app/packages/error ./packages/error
|
||||||
|
COPY --from=shared-libs-builder /app/packages/logger ./packages/logger
|
||||||
|
COPY --from=shared-libs-builder /app/packages/shared ./packages/shared
|
||||||
|
|
||||||
# Fixes arm64 timeouts
|
# Fixes arm64 timeouts
|
||||||
RUN yarn workspace @sourcebot/web install
|
RUN yarn workspace @sourcebot/web install
|
||||||
|
|
@ -128,6 +140,8 @@ COPY --from=shared-libs-builder /app/packages/db ./packages/db
|
||||||
COPY --from=shared-libs-builder /app/packages/schemas ./packages/schemas
|
COPY --from=shared-libs-builder /app/packages/schemas ./packages/schemas
|
||||||
COPY --from=shared-libs-builder /app/packages/crypto ./packages/crypto
|
COPY --from=shared-libs-builder /app/packages/crypto ./packages/crypto
|
||||||
COPY --from=shared-libs-builder /app/packages/error ./packages/error
|
COPY --from=shared-libs-builder /app/packages/error ./packages/error
|
||||||
|
COPY --from=shared-libs-builder /app/packages/logger ./packages/logger
|
||||||
|
COPY --from=shared-libs-builder /app/packages/shared ./packages/shared
|
||||||
RUN yarn workspace @sourcebot/backend install
|
RUN yarn workspace @sourcebot/backend install
|
||||||
RUN yarn workspace @sourcebot/backend build
|
RUN yarn workspace @sourcebot/backend build
|
||||||
|
|
||||||
|
|
@ -156,6 +170,10 @@ ARG NEXT_PUBLIC_SENTRY_WEBAPP_DSN
|
||||||
ENV NEXT_PUBLIC_SENTRY_WEBAPP_DSN=$NEXT_PUBLIC_SENTRY_WEBAPP_DSN
|
ENV NEXT_PUBLIC_SENTRY_WEBAPP_DSN=$NEXT_PUBLIC_SENTRY_WEBAPP_DSN
|
||||||
ARG NEXT_PUBLIC_SENTRY_BACKEND_DSN
|
ARG NEXT_PUBLIC_SENTRY_BACKEND_DSN
|
||||||
ENV NEXT_PUBLIC_SENTRY_BACKEND_DSN=$NEXT_PUBLIC_SENTRY_BACKEND_DSN
|
ENV NEXT_PUBLIC_SENTRY_BACKEND_DSN=$NEXT_PUBLIC_SENTRY_BACKEND_DSN
|
||||||
|
ARG NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY
|
||||||
|
ENV NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY=$NEXT_PUBLIC_LANGFUSE_PUBLIC_KEY
|
||||||
|
ARG NEXT_PUBLIC_LANGFUSE_BASE_URL
|
||||||
|
ENV NEXT_PUBLIC_LANGFUSE_BASE_URL=$NEXT_PUBLIC_LANGFUSE_BASE_URL
|
||||||
# -----------
|
# -----------
|
||||||
|
|
||||||
RUN echo "Sourcebot Version: $NEXT_PUBLIC_SOURCEBOT_VERSION"
|
RUN echo "Sourcebot Version: $NEXT_PUBLIC_SOURCEBOT_VERSION"
|
||||||
|
|
@ -170,6 +188,7 @@ ENV REDIS_DATA_DIR=$DATA_CACHE_DIR/redis
|
||||||
ENV DATABASE_URL="postgresql://postgres@localhost:5432/sourcebot"
|
ENV DATABASE_URL="postgresql://postgres@localhost:5432/sourcebot"
|
||||||
ENV REDIS_URL="redis://localhost:6379"
|
ENV REDIS_URL="redis://localhost:6379"
|
||||||
ENV SRC_TENANT_ENFORCEMENT_MODE=strict
|
ENV SRC_TENANT_ENFORCEMENT_MODE=strict
|
||||||
|
ENV SOURCEBOT_PUBLIC_KEY_PATH=/app/public.pem
|
||||||
|
|
||||||
# Valid values are: debug, info, warn, error
|
# Valid values are: debug, info, warn, error
|
||||||
ENV SOURCEBOT_LOG_LEVEL=info
|
ENV SOURCEBOT_LOG_LEVEL=info
|
||||||
|
|
@ -177,7 +196,7 @@ ENV SOURCEBOT_LOG_LEVEL=info
|
||||||
# Sourcebot collects anonymous usage data using [PostHog](https://posthog.com/). Uncomment this line to disable.
|
# Sourcebot collects anonymous usage data using [PostHog](https://posthog.com/). Uncomment this line to disable.
|
||||||
# ENV SOURCEBOT_TELEMETRY_DISABLED=1
|
# ENV SOURCEBOT_TELEMETRY_DISABLED=1
|
||||||
|
|
||||||
COPY package.json yarn.lock* .yarnrc.yml ./
|
COPY package.json yarn.lock* .yarnrc.yml public.pem ./
|
||||||
COPY .yarn ./.yarn
|
COPY .yarn ./.yarn
|
||||||
|
|
||||||
# Configure zoekt
|
# Configure zoekt
|
||||||
|
|
@ -209,6 +228,8 @@ COPY --from=shared-libs-builder /app/packages/db ./packages/db
|
||||||
COPY --from=shared-libs-builder /app/packages/schemas ./packages/schemas
|
COPY --from=shared-libs-builder /app/packages/schemas ./packages/schemas
|
||||||
COPY --from=shared-libs-builder /app/packages/crypto ./packages/crypto
|
COPY --from=shared-libs-builder /app/packages/crypto ./packages/crypto
|
||||||
COPY --from=shared-libs-builder /app/packages/error ./packages/error
|
COPY --from=shared-libs-builder /app/packages/error ./packages/error
|
||||||
|
COPY --from=shared-libs-builder /app/packages/logger ./packages/logger
|
||||||
|
COPY --from=shared-libs-builder /app/packages/shared ./packages/shared
|
||||||
|
|
||||||
# Configure dependencies
|
# Configure dependencies
|
||||||
RUN apk add --no-cache git ca-certificates bind-tools tini jansson wget supervisor uuidgen curl perl jq redis postgresql postgresql-contrib openssl util-linux unzip
|
RUN apk add --no-cache git ca-certificates bind-tools tini jansson wget supervisor uuidgen curl perl jq redis postgresql postgresql-contrib openssl util-linux unzip
|
||||||
|
|
|
||||||
25
LICENSE
|
|
@ -1,25 +0,0 @@
|
||||||
Copyright (c) 2025 Taqla Inc.
|
|
||||||
|
|
||||||
Portions of this software are licensed as follows:
|
|
||||||
|
|
||||||
- All content that resides under the "ee/" and "packages/web/src/ee/" directories of this repository, if these directories exist, is licensed under the license defined in "ee/LICENSE".
|
|
||||||
- All third party components incorporated into the Sourcebot Software are licensed under the original license provided by the owner of the applicable component.
|
|
||||||
- Content outside of the above mentioned directories or restrictions above is available under the "MIT Expat" license as defined below.
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
115
LICENSE.md
Normal file
|
|
@ -0,0 +1,115 @@
|
||||||
|
Copyright (c) 2025 Taqla Inc.
|
||||||
|
|
||||||
|
Portions of this software are licensed as follows:
|
||||||
|
|
||||||
|
- All content that resides under the "ee/", "packages/web/src/ee/", and "packages/shared/src/ee/" directories of this repository, if these directories exist, is licensed under the license defined in "ee/LICENSE".
|
||||||
|
- All third party components incorporated into the Sourcebot Software are licensed under the original license provided by the owner of the applicable component.
|
||||||
|
- Content outside of the above mentioned directories or restrictions above is available under the "Functional Source License" as defined below.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# Functional Source License, Version 1.1, ALv2 Future License
|
||||||
|
|
||||||
|
## Abbreviation
|
||||||
|
|
||||||
|
FSL-1.1-ALv2
|
||||||
|
|
||||||
|
## Notice
|
||||||
|
|
||||||
|
Copyright 2025 Taqla Inc.
|
||||||
|
|
||||||
|
## Terms and Conditions
|
||||||
|
|
||||||
|
### Licensor ("We")
|
||||||
|
|
||||||
|
The party offering the Software under these Terms and Conditions.
|
||||||
|
|
||||||
|
### The Software
|
||||||
|
|
||||||
|
The "Software" is each version of the software that we make available under
|
||||||
|
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
||||||
|
Conditions with the Software.
|
||||||
|
|
||||||
|
### License Grant
|
||||||
|
|
||||||
|
Subject to your compliance with this License Grant and the Patents,
|
||||||
|
Redistribution and Trademark clauses below, we hereby grant you the right to
|
||||||
|
use, copy, modify, create derivative works, publicly perform, publicly display
|
||||||
|
and redistribute the Software for any Permitted Purpose identified below.
|
||||||
|
|
||||||
|
### Permitted Purpose
|
||||||
|
|
||||||
|
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
||||||
|
means making the Software available to others in a commercial product or
|
||||||
|
service that:
|
||||||
|
|
||||||
|
1. substitutes for the Software;
|
||||||
|
|
||||||
|
2. substitutes for any other product or service we offer using the Software
|
||||||
|
that exists as of the date we make the Software available; or
|
||||||
|
|
||||||
|
3. offers the same or substantially similar functionality as the Software.
|
||||||
|
|
||||||
|
Permitted Purposes specifically include using the Software:
|
||||||
|
|
||||||
|
1. for your internal use and access;
|
||||||
|
|
||||||
|
2. for non-commercial education;
|
||||||
|
|
||||||
|
3. for non-commercial research; and
|
||||||
|
|
||||||
|
4. in connection with professional services that you provide to a licensee
|
||||||
|
using the Software in accordance with these Terms and Conditions.
|
||||||
|
|
||||||
|
### Patents
|
||||||
|
|
||||||
|
To the extent your use for a Permitted Purpose would necessarily infringe our
|
||||||
|
patents, the license grant above includes a license under our patents. If you
|
||||||
|
make a claim against any party that the Software infringes or contributes to
|
||||||
|
the infringement of any patent, then your patent license to the Software ends
|
||||||
|
immediately.
|
||||||
|
|
||||||
|
### Redistribution
|
||||||
|
|
||||||
|
The Terms and Conditions apply to all copies, modifications and derivatives of
|
||||||
|
the Software.
|
||||||
|
|
||||||
|
If you redistribute any copies, modifications or derivatives of the Software,
|
||||||
|
you must include a copy of or a link to these Terms and Conditions and not
|
||||||
|
remove any copyright notices provided in or with the Software.
|
||||||
|
|
||||||
|
### Disclaimer
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
||||||
|
|
||||||
|
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
||||||
|
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
||||||
|
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
||||||
|
|
||||||
|
### Trademarks
|
||||||
|
|
||||||
|
Except for displaying the License Details and identifying us as the origin of
|
||||||
|
the Software, you have no right under these Terms and Conditions to use our
|
||||||
|
trademarks, trade names, service marks or product names.
|
||||||
|
|
||||||
|
## Grant of Future License
|
||||||
|
|
||||||
|
We hereby irrevocably grant you an additional license to use the Software under
|
||||||
|
the Apache License, Version 2.0 that is effective on the second anniversary of
|
||||||
|
the date we make the Software available. On or after that date, you may use the
|
||||||
|
Software under the Apache License, Version 2.0, in which case the following
|
||||||
|
will apply:
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||||
|
this file except in compliance with the License.
|
||||||
|
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software distributed
|
||||||
|
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||||
|
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||||
|
specific language governing permissions and limitations under the License.
|
||||||
4
Makefile
|
|
@ -10,7 +10,7 @@ yarn:
|
||||||
zoekt:
|
zoekt:
|
||||||
mkdir -p bin
|
mkdir -p bin
|
||||||
go build -C vendor/zoekt -o $(PWD)/bin ./cmd/...
|
go build -C vendor/zoekt -o $(PWD)/bin ./cmd/...
|
||||||
export PATH=$(PWD)/bin:$(PATH)
|
export PATH="$(PWD)/bin:$(PATH)"
|
||||||
export CTAGS_COMMANDS=ctags
|
export CTAGS_COMMANDS=ctags
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
@ -34,6 +34,8 @@ clean:
|
||||||
packages/error/dist \
|
packages/error/dist \
|
||||||
packages/mcp/node_modules \
|
packages/mcp/node_modules \
|
||||||
packages/mcp/dist \
|
packages/mcp/dist \
|
||||||
|
packages/shared/node_modules \
|
||||||
|
packages/shared/dist \
|
||||||
.sourcebot
|
.sourcebot
|
||||||
|
|
||||||
soft-reset:
|
soft-reset:
|
||||||
|
|
|
||||||
15
README.md
|
|
@ -8,9 +8,6 @@
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<div>
|
<div>
|
||||||
<h3>
|
<h3>
|
||||||
<a href="https://app.sourcebot.dev">
|
|
||||||
<strong>Sourcebot Cloud</strong>
|
|
||||||
</a> ·
|
|
||||||
<a href="https://docs.sourcebot.dev/self-hosting/overview">
|
<a href="https://docs.sourcebot.dev/self-hosting/overview">
|
||||||
<strong>Self Host</strong>
|
<strong>Self Host</strong>
|
||||||
</a> ·
|
</a> ·
|
||||||
|
|
@ -47,16 +44,20 @@
|
||||||
|
|
||||||
# About
|
# About
|
||||||
|
|
||||||
Sourcebot is the open source Sourcegraph alternative. Index all your repos and branches across multiple code hosts (GitHub, GitLab, Bitbucket, Gitea, or Gerrit) and search through them using a blazingly fast interface.
|
Sourcebot is a self-hosted tool that helps you understand your codebase.
|
||||||
|
|
||||||
https://github.com/user-attachments/assets/ced355f3-967e-4f37-ae6e-74ab8c06b9ec
|
- **Ask Sourcebot:** Ask questions about your codebase and have Sourcebot provide detailed answers grounded with inline citations.
|
||||||
|
- **Code search:** Search and navigate across all your repos and branches, no matter where they’re hosted.
|
||||||
|
|
||||||
|
https://github.com/user-attachments/assets/286ad97a-a543-4eef-a2f1-4fa31bea1b32
|
||||||
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
- 💻 **One-command deployment**: Get started instantly using Docker on your own machine.
|
- 💻 **One-command deployment**: Get started instantly using Docker on your own machine.
|
||||||
- 🔍 **Multi-repo search**: Index and search through multiple public and private repositories and branches on GitHub, GitLab, Bitbucket, Gitea, or Gerrit.
|
- 🤖 **Bring your own model**: Connect Sourcebot to any of the reasoning models you're already using.
|
||||||
|
- 🔍 **Multi-repo support**: Index and search through multiple public and private repositories and branches on GitHub, GitLab, Bitbucket, Gitea, or Gerrit.
|
||||||
- ⚡ **Lightning fast performance**: Built on top of the powerful [Zoekt](https://github.com/sourcegraph/zoekt) search engine.
|
- ⚡ **Lightning fast performance**: Built on top of the powerful [Zoekt](https://github.com/sourcegraph/zoekt) search engine.
|
||||||
- 🎨 **Modern web app**: Enjoy a sleek interface with features like syntax highlighting, light/dark mode, and vim-style navigation
|
- 🎨 **Modern web app**: Enjoy a sleek interface with features like syntax highlighting, light/dark mode, and vim-style navigation.
|
||||||
- 📂 **Full file visualization**: Instantly view the entire file when selecting any search result.
|
- 📂 **Full file visualization**: Instantly view the entire file when selecting any search result.
|
||||||
|
|
||||||
You can try out our public hosted demo [here](https://demo.sourcebot.dev)!
|
You can try out our public hosted demo [here](https://demo.sourcebot.dev)!
|
||||||
|
|
|
||||||
6
_typos.toml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
[default.extend-words]
|
||||||
|
# Don't correct the surname "Do Not Exists"
|
||||||
|
dne = "dne"
|
||||||
|
|
||||||
|
[files]
|
||||||
|
extend-exclude = ["vendor/**/*", "CHANGELOG.md", "packages/web/src/lib/languageMetadata.ts"]
|
||||||
30
docker-compose-dev.yml
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
# docker-compose-dev.yml
|
||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
redis:
|
||||||
|
image: redis:7-alpine
|
||||||
|
container_name: sourcebot-redis
|
||||||
|
ports:
|
||||||
|
- "6379:6379"
|
||||||
|
volumes:
|
||||||
|
- redis_data:/data
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
postgres:
|
||||||
|
image: postgres:16-alpine
|
||||||
|
container_name: sourcebot-postgres
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: postgres
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
volumes:
|
||||||
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
redis_data:
|
||||||
|
postgres_data:
|
||||||
|
|
||||||
|
|
@ -1,107 +0,0 @@
|
||||||
---
|
|
||||||
title: 'Development'
|
|
||||||
description: 'Preview changes locally to update your docs'
|
|
||||||
---
|
|
||||||
|
|
||||||
<Info>
|
|
||||||
**Prerequisite**: Please install Node.js (version 19 or higher) before proceeding. <br />
|
|
||||||
Please upgrade to ```docs.json``` before proceeding and delete the legacy ```mint.json``` file.
|
|
||||||
</Info>
|
|
||||||
|
|
||||||
Follow these steps to install and run Mintlify on your operating system:
|
|
||||||
|
|
||||||
**Step 1**: Install Mintlify:
|
|
||||||
|
|
||||||
<CodeGroup>
|
|
||||||
|
|
||||||
```bash npm
|
|
||||||
npm i -g mintlify
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash yarn
|
|
||||||
yarn global add mintlify
|
|
||||||
```
|
|
||||||
|
|
||||||
</CodeGroup>
|
|
||||||
|
|
||||||
**Step 2**: Navigate to the docs directory (where the `docs.json` file is located) and execute the following command:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mintlify dev
|
|
||||||
```
|
|
||||||
|
|
||||||
A local preview of your documentation will be available at `http://localhost:3000`.
|
|
||||||
|
|
||||||
### Custom Ports
|
|
||||||
|
|
||||||
By default, Mintlify uses port 3000. You can customize the port Mintlify runs on by using the `--port` flag. To run Mintlify on port 3333, for instance, use this command:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mintlify dev --port 3333
|
|
||||||
```
|
|
||||||
|
|
||||||
If you attempt to run Mintlify on a port that's already in use, it will use the next available port:
|
|
||||||
|
|
||||||
```md
|
|
||||||
Port 3000 is already in use. Trying 3001 instead.
|
|
||||||
```
|
|
||||||
|
|
||||||
## Mintlify Versions
|
|
||||||
|
|
||||||
Please note that each CLI release is associated with a specific version of Mintlify. If your local website doesn't align with the production version, please update the CLI:
|
|
||||||
|
|
||||||
<CodeGroup>
|
|
||||||
|
|
||||||
```bash npm
|
|
||||||
npm i -g mintlify@latest
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash yarn
|
|
||||||
yarn global upgrade mintlify
|
|
||||||
```
|
|
||||||
|
|
||||||
</CodeGroup>
|
|
||||||
|
|
||||||
## Validating Links
|
|
||||||
|
|
||||||
The CLI can assist with validating reference links made in your documentation. To identify any broken links, use the following command:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mintlify broken-links
|
|
||||||
```
|
|
||||||
|
|
||||||
## Deployment
|
|
||||||
|
|
||||||
<Tip>
|
|
||||||
Unlimited editors available under the [Pro
|
|
||||||
Plan](https://mintlify.com/pricing) and above.
|
|
||||||
</Tip>
|
|
||||||
|
|
||||||
If the deployment is successful, you should see the following:
|
|
||||||
|
|
||||||
<Frame>
|
|
||||||
<img src="/images/checks-passed.png" style={{ borderRadius: '0.5rem' }} />
|
|
||||||
</Frame>
|
|
||||||
|
|
||||||
## Code Formatting
|
|
||||||
|
|
||||||
We suggest using extensions on your IDE to recognize and format MDX. If you're a VSCode user, consider the [MDX VSCode extension](https://marketplace.visualstudio.com/items?itemName=unifiedjs.vscode-mdx) for syntax highlighting, and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) for code formatting.
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
<AccordionGroup>
|
|
||||||
<Accordion title='Error: Could not load the "sharp" module using the darwin-arm64 runtime'>
|
|
||||||
|
|
||||||
This may be due to an outdated version of node. Try the following:
|
|
||||||
1. Remove the currently-installed version of mintlify: `npm remove -g mintlify`
|
|
||||||
2. Upgrade to Node v19 or higher.
|
|
||||||
3. Reinstall mintlify: `npm install -g mintlify`
|
|
||||||
</Accordion>
|
|
||||||
|
|
||||||
<Accordion title="Issue: Encountering an unknown error">
|
|
||||||
|
|
||||||
Solution: Go to the root of your device and delete the \~/.mintlify folder. Afterwards, run `mintlify dev` again.
|
|
||||||
</Accordion>
|
|
||||||
</AccordionGroup>
|
|
||||||
|
|
||||||
Curious about what changed in the CLI version? [Check out the CLI changelog.](https://www.npmjs.com/package/mintlify?activeTab=versions)
|
|
||||||
134
docs/docs.json
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://mintlify.com/docs.json",
|
"$schema": "https://mintlify.com/docs.json",
|
||||||
"theme": "mint",
|
"theme": "willow",
|
||||||
"name": "Sourcebot",
|
"name": "Sourcebot",
|
||||||
"colors": {
|
"colors": {
|
||||||
"primary": "#851EE7",
|
"primary": "#851EE7",
|
||||||
|
|
@ -15,23 +15,55 @@
|
||||||
"anchors": [
|
"anchors": [
|
||||||
{
|
{
|
||||||
"anchor": "Docs",
|
"anchor": "Docs",
|
||||||
"icon": "book-open",
|
"icon": "books",
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
"group": "General",
|
"group": "Getting Started",
|
||||||
"pages": [
|
"pages": [
|
||||||
"docs/overview",
|
"docs/overview",
|
||||||
"docs/getting-started",
|
"docs/deployment-guide"
|
||||||
"docs/getting-started-selfhost"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"group": "Connecting your code",
|
"group": "Features",
|
||||||
|
"pages": [
|
||||||
|
{
|
||||||
|
"group": "Code Search",
|
||||||
|
"pages": [
|
||||||
|
"docs/features/search/overview",
|
||||||
|
"docs/features/search/syntax-reference",
|
||||||
|
"docs/features/search/multi-branch-indexing",
|
||||||
|
"docs/features/search/search-contexts"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"group": "Ask Sourcebot",
|
||||||
|
"pages": [
|
||||||
|
"docs/features/ask/overview",
|
||||||
|
"docs/features/ask/add-model-providers"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"docs/features/code-navigation",
|
||||||
|
"docs/features/analytics",
|
||||||
|
"docs/features/mcp-server",
|
||||||
|
{
|
||||||
|
"group": "Agents",
|
||||||
|
"tag": "experimental",
|
||||||
|
"pages": [
|
||||||
|
"docs/features/agents/overview",
|
||||||
|
"docs/features/agents/review-agent"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"group": "Configuration",
|
||||||
|
"pages": [
|
||||||
|
"docs/configuration/config-file",
|
||||||
|
{
|
||||||
|
"group": "Indexing your code",
|
||||||
"pages": [
|
"pages": [
|
||||||
"docs/connections/overview",
|
"docs/connections/overview",
|
||||||
{
|
|
||||||
"group": "Supported platforms",
|
|
||||||
"pages": [
|
|
||||||
"docs/connections/github",
|
"docs/connections/github",
|
||||||
"docs/connections/gitlab",
|
"docs/connections/gitlab",
|
||||||
"docs/connections/bitbucket-cloud",
|
"docs/connections/bitbucket-cloud",
|
||||||
|
|
@ -42,63 +74,30 @@
|
||||||
"docs/connections/local-repos",
|
"docs/connections/local-repos",
|
||||||
"docs/connections/request-new"
|
"docs/connections/request-new"
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
"docs/configuration/language-model-providers",
|
||||||
|
{
|
||||||
|
"group": "Authentication",
|
||||||
|
"pages": [
|
||||||
|
"docs/configuration/auth/overview",
|
||||||
|
"docs/configuration/auth/providers",
|
||||||
|
"docs/configuration/auth/access-settings",
|
||||||
|
"docs/configuration/auth/roles-and-permissions",
|
||||||
|
"docs/configuration/auth/faq"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
"docs/configuration/environment-variables",
|
||||||
"group": "Search",
|
"docs/license-key",
|
||||||
"pages": [
|
"docs/configuration/transactional-emails",
|
||||||
"docs/search/syntax-reference",
|
"docs/configuration/structured-logging",
|
||||||
"docs/search/multi-branch-indexing",
|
"docs/configuration/audit-logs"
|
||||||
"docs/search/search-contexts"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"group": "Agents",
|
|
||||||
"pages": [
|
|
||||||
"docs/agents/overview",
|
|
||||||
"docs/agents/review-agent"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"group": "More",
|
|
||||||
"pages": [
|
|
||||||
"docs/more/roles-and-permissions",
|
|
||||||
"docs/more/mcp-server"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"anchor": "Self Hosting",
|
|
||||||
"icon": "server",
|
|
||||||
"groups": [
|
|
||||||
{
|
|
||||||
"group": "Getting Started",
|
|
||||||
"pages": [
|
|
||||||
"self-hosting/overview",
|
|
||||||
"self-hosting/configuration",
|
|
||||||
"self-hosting/license-key"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"group": "More",
|
|
||||||
"pages": [
|
|
||||||
"self-hosting/more/authentication",
|
|
||||||
"self-hosting/more/tenancy",
|
|
||||||
"self-hosting/more/transactional-emails",
|
|
||||||
"self-hosting/more/declarative-config"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"group": "Security",
|
|
||||||
"pages": [
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"group": "Upgrade",
|
"group": "Upgrade",
|
||||||
"pages": [
|
"pages": [
|
||||||
"self-hosting/upgrade/v2-to-v3-guide"
|
"docs/upgrade/v3-to-v4-guide",
|
||||||
|
"docs/upgrade/v2-to-v3-guide"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
@ -120,21 +119,18 @@
|
||||||
"dark": "/logo/dark.png"
|
"dark": "/logo/dark.png"
|
||||||
},
|
},
|
||||||
"navbar": {
|
"navbar": {
|
||||||
"links": [
|
|
||||||
{
|
|
||||||
"label": "GitHub",
|
|
||||||
"href": "https://github.com/sourcebot-dev/sourcebot"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"primary": {
|
"primary": {
|
||||||
"type": "button",
|
"type": "button",
|
||||||
"label": "Sourcebot Cloud",
|
"label": "GitHub",
|
||||||
"href": "https://app.sourcebot.dev"
|
"href": "https://github.com/sourcebot-dev/sourcebot"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"footer": {
|
"footer": {
|
||||||
"socials": {
|
"socials": {
|
||||||
"github": "https://github.com/sourcebot-dev/sourcebot"
|
"github": "https://github.com/sourcebot-dev/sourcebot",
|
||||||
|
"twitter": "https://x.com/sourcebot_dev",
|
||||||
|
"discord": "https://discord.gg/Y6b78RqM",
|
||||||
|
"linkedin": "https://www.linkedin.com/company/sourcebot"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"integrations": {
|
"integrations": {
|
||||||
|
|
@ -144,6 +140,6 @@
|
||||||
},
|
},
|
||||||
"appearance": {
|
"appearance": {
|
||||||
"default": "dark",
|
"default": "dark",
|
||||||
"strict": true
|
"strict": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
211
docs/docs/configuration/audit-logs.mdx
Normal file
|
|
@ -0,0 +1,211 @@
|
||||||
|
---
|
||||||
|
title: Audit Logs
|
||||||
|
sidebarTitle: Audit logs
|
||||||
|
---
|
||||||
|
|
||||||
|
import LicenseKeyRequired from '/snippets/license-key-required.mdx'
|
||||||
|
|
||||||
|
<LicenseKeyRequired />
|
||||||
|
|
||||||
|
Audit logs are a collection of notable events performed by users within a Sourcebot deployment. Each audit log records information on the action taken, the user who performed the
|
||||||
|
action, and when the action took place.
|
||||||
|
|
||||||
|
This feature gives security and compliance teams the necessary information to ensure proper governance and administration of your Sourcebot deployment.
|
||||||
|
|
||||||
|
## Enabling/Disabling Audit Logs
|
||||||
|
Audit logs are enabled by default and can be controlled with the `SOURCEBOT_EE_AUDIT_LOGGING_ENABLED` [environment variable](/docs/configuration/environment-variables).
|
||||||
|
|
||||||
|
## Fetching Audit Logs
|
||||||
|
Audit logs are stored in the [postgres database](/docs/overview#architecture) connected to Sourcebot. To fetch all of the audit logs, you can use the following API:
|
||||||
|
|
||||||
|
```bash icon="terminal" Fetch audit logs
|
||||||
|
curl --request GET '$SOURCEBOT_URL/api/ee/audit' \
|
||||||
|
--header 'X-Org-Domain: ~' \
|
||||||
|
--header 'X-Sourcebot-Api-Key: $SOURCEBOT_OWNER_API_KEY'
|
||||||
|
```
|
||||||
|
|
||||||
|
```json icon="brackets-curly" wrap expandable Fetch audit logs example response
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"id": "cmc146k7m0003xgo2tri5t4br",
|
||||||
|
"timestamp": "2025-06-17T22:48:08.914Z",
|
||||||
|
"action": "api_key.created",
|
||||||
|
"actorId": "cmc12tnje0000xgn58jj8655h",
|
||||||
|
"actorType": "user",
|
||||||
|
"targetId": "205d1da1c6c3772b81d4ad697f5851fa11195176c211055ff0c1509772645d6d",
|
||||||
|
"targetType": "api_key",
|
||||||
|
"sourcebotVersion": "unknown",
|
||||||
|
"orgId": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "cmc146c8r0001xgo2xyu0p463",
|
||||||
|
"timestamp": "2025-06-17T22:47:58.587Z",
|
||||||
|
"action": "user.performed_code_search",
|
||||||
|
"actorId": "cmc12tnje0000xgn58jj8655h",
|
||||||
|
"actorType": "user",
|
||||||
|
"targetId": "1",
|
||||||
|
"targetType": "org",
|
||||||
|
"sourcebotVersion": "unknown",
|
||||||
|
"metadata": {
|
||||||
|
"message": "render branch:HEAD"
|
||||||
|
},
|
||||||
|
"orgId": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "cmc12vqgb0008xgn5nv5hl9y5",
|
||||||
|
"timestamp": "2025-06-17T22:11:44.171Z",
|
||||||
|
"action": "user.performed_code_search",
|
||||||
|
"actorId": "cmc12tnje0000xgn58jj8655h",
|
||||||
|
"actorType": "user",
|
||||||
|
"targetId": "1",
|
||||||
|
"targetType": "org",
|
||||||
|
"sourcebotVersion": "unknown",
|
||||||
|
"metadata": {
|
||||||
|
"message": "render branch:HEAD"
|
||||||
|
},
|
||||||
|
"orgId": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "cmc12txwn0006xgn51ow1odid",
|
||||||
|
"timestamp": "2025-06-17T22:10:20.519Z",
|
||||||
|
"action": "user.performed_code_search",
|
||||||
|
"actorId": "cmc12tnje0000xgn58jj8655h",
|
||||||
|
"actorType": "user",
|
||||||
|
"targetId": "1",
|
||||||
|
"targetType": "org",
|
||||||
|
"sourcebotVersion": "unknown",
|
||||||
|
"metadata": {
|
||||||
|
"message": "render branch:HEAD"
|
||||||
|
},
|
||||||
|
"orgId": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "cmc12tnjx0004xgn5qqeiv1ao",
|
||||||
|
"timestamp": "2025-06-17T22:10:07.101Z",
|
||||||
|
"action": "user.owner_created",
|
||||||
|
"actorId": "cmc12tnje0000xgn58jj8655h",
|
||||||
|
"actorType": "user",
|
||||||
|
"targetId": "1",
|
||||||
|
"targetType": "org",
|
||||||
|
"sourcebotVersion": "unknown",
|
||||||
|
"metadata": null,
|
||||||
|
"orgId": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "cmc12tnjh0002xgn5h6vzu3rl",
|
||||||
|
"timestamp": "2025-06-17T22:10:07.086Z",
|
||||||
|
"action": "user.signed_in",
|
||||||
|
"actorId": "cmc12tnje0000xgn58jj8655h",
|
||||||
|
"actorType": "user",
|
||||||
|
"targetId": "cmc12tnje0000xgn58jj8655h",
|
||||||
|
"targetType": "user",
|
||||||
|
"sourcebotVersion": "unknown",
|
||||||
|
"metadata": null,
|
||||||
|
"orgId": 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
## Audit action types
|
||||||
|
|
||||||
|
| Action | Actor Type | Target Type |
|
||||||
|
| :------- | :------ | :------|
|
||||||
|
| `api_key.creation_failed` | `user` | `org` |
|
||||||
|
| `api_key.created` | `user` | `api_key` |
|
||||||
|
| `api_key.deletion_failed` | `user` | `org` |
|
||||||
|
| `api_key.deleted` | `user` | `api_key` |
|
||||||
|
| `user.creation_failed` | `user` | `user` |
|
||||||
|
| `user.owner_created` | `user` | `org` |
|
||||||
|
| `user.performed_code_search` | `user` | `org` |
|
||||||
|
| `user.performed_find_references` | `user` | `org` |
|
||||||
|
| `user.performed_goto_definition` | `user` | `org` |
|
||||||
|
| `user.jit_provisioning_failed` | `user` | `org` |
|
||||||
|
| `user.jit_provisioned` | `user` | `org` |
|
||||||
|
| `user.join_request_creation_failed` | `user` | `org` |
|
||||||
|
| `user.join_requested` | `user` | `org` |
|
||||||
|
| `user.join_request_approve_failed` | `user` | `account_join_request` |
|
||||||
|
| `user.join_request_approved` | `user` | `account_join_request` |
|
||||||
|
| `user.invite_failed` | `user` | `org` |
|
||||||
|
| `user.invites_created` | `user` | `org` |
|
||||||
|
| `user.invite_accept_failed` | `user` | `invite` |
|
||||||
|
| `user.invite_accepted` | `user` | `invite` |
|
||||||
|
| `user.signed_in` | `user` | `user` |
|
||||||
|
| `user.signed_out` | `user` | `user` |
|
||||||
|
| `org.ownership_transfer_failed` | `user` | `org` |
|
||||||
|
| `org.ownership_transferred` | `user` | `org` |
|
||||||
|
|
||||||
|
|
||||||
|
## Response schema
|
||||||
|
|
||||||
|
```json icon="brackets-curly" expandable wrap Audit log fetch response schema
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||||
|
"title": "FetchAuditLogsResponse",
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"id",
|
||||||
|
"timestamp",
|
||||||
|
"action",
|
||||||
|
"actorId",
|
||||||
|
"actorType",
|
||||||
|
"targetId",
|
||||||
|
"targetType",
|
||||||
|
"sourcebotVersion",
|
||||||
|
"metadata",
|
||||||
|
"orgId"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"timestamp": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time"
|
||||||
|
},
|
||||||
|
"action": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"actorId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"actorType": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": ["user", "api_key"]
|
||||||
|
},
|
||||||
|
"targetId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"targetType": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": ["user", "org", "file", "api_key", "account_join_request", "invite"]
|
||||||
|
},
|
||||||
|
"sourcebotVersion": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"metadata": {
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"message": { "type": "string" },
|
||||||
|
"api_key": { "type": "string" },
|
||||||
|
"emails": { "type": "string" }
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"orgId": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
40
docs/docs/configuration/auth/access-settings.mdx
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
---
|
||||||
|
title: Access Settings
|
||||||
|
sidebarTitle: Access settings
|
||||||
|
---
|
||||||
|
|
||||||
|
There are various settings to control how users access your Sourcebot deployment.
|
||||||
|
|
||||||
|
# Anonymous access
|
||||||
|
|
||||||
|
<Note>Anonymous access cannot be enabled if you have an enterprise license. If you have any questions about this restriction [reach out to us](https://www.sourcebot.dev/contact).</Note>
|
||||||
|
|
||||||
|
By default, your Sourcebot deployment is gated with a login page. If you'd like users to access the deployment anonymously, you can enable anonymous access.
|
||||||
|
|
||||||
|
This can be enabled by navigating to **Settings -> Access** or by setting the `FORCE_ENABLE_ANONYMOUS_ACCESS` environment variable.
|
||||||
|
|
||||||
|
When accessing Sourcebot anonymously, a user's permissions are limited to that of the [Guest](/docs/configuration/auth/roles-and-permissions) role.
|
||||||
|
|
||||||
|
# Member Approval
|
||||||
|
|
||||||
|
By default, Sourcebot requires new members to be approved by the owner of the deployment. This section explains how approvals work and how
|
||||||
|
to configure this behavior.
|
||||||
|
|
||||||
|
### Configuration
|
||||||
|
Member approval can be configured by the owner of the deployment by navigating to **Settings -> Members**:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Managing Requests
|
||||||
|
|
||||||
|
If member approval is enabled, new members will be asked to submit a join request after signing up. They will not have access to the Sourcebot deployment
|
||||||
|
until this request is approved by the owner.
|
||||||
|
|
||||||
|
The owner can see and manage all pending join requests by navigating to **Settings -> Members**.
|
||||||
|
|
||||||
|
## Invite link
|
||||||
|
|
||||||
|
If member approval is required, an owner of the deployment can enable an invite link. When enabled, users
|
||||||
|
can use this invite link to register and be automatically added to the organization without approval:
|
||||||
|
|
||||||
|

|
||||||
46
docs/docs/configuration/auth/faq.mdx
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
---
|
||||||
|
title: FAQ
|
||||||
|
---
|
||||||
|
|
||||||
|
This page covers a range of frequently asked questions about Sourcebot's built-in authentication system.
|
||||||
|
|
||||||
|
<AccordionGroup>
|
||||||
|
<Accordion title="Can I disable the authentication system?">
|
||||||
|
No, at this time it's not possible to disable the authentication system. If this is preventing you from deploying Sourcebot
|
||||||
|
within your organization please [reach out](https://www.sourcebot.dev/contact)
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
|
<Accordion title="I don't want to restrict access to my Sourcebot deployment, what should I do?">
|
||||||
|
Every user must register an account within your Sourcebot deployment. However, this dosn't mean their access
|
||||||
|
is restricted.
|
||||||
|
|
||||||
|
Unless member approval is required, anyone can sign up for an account on your deployment and immediately be granted access.
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
|
<Accordion title="Does any data related to authentication (emails, passwords, etc) leave my deployment?">
|
||||||
|
**No data related to authentication (or your code) leaves your deployment**. Authentication is handled
|
||||||
|
purely by your deployment and the authentication providers you configure.
|
||||||
|
|
||||||
|
This data does not leave your device and is stored within in the database managed by your deployment. If you're
|
||||||
|
using credential login, passwords are encrypted at rest and in transit.
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
|
<Accordion title="I'm deploying Sourcebot behind an identity proxy, do I still need to create an account in Sourcebot?">
|
||||||
|
<Note>Please note that IAP bridges are an enterprise feature</Note>
|
||||||
|
Sourcebot supports connecting your identity proxy directly into the built-in auth system using an IAP bridge. This allows Sourcebot to
|
||||||
|
register and authenticate automatically on a successful identity proxy log in.
|
||||||
|
|
||||||
|
Sourcebot currently supports [GCP IAP](/docs/configuration/auth/providers#gcp-iap). If you're using a different IAP
|
||||||
|
and require support, please [reach out](https://www.sourcebot.dev/contact)
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
|
<Accordion title="How does Sourcebot implement authentication?">
|
||||||
|
Sourcebot uses [Auth.js](https://authjs.dev/) as its underlying authentication framework. Auth.js provides authentication providers
|
||||||
|
(credientials, Google, GitHub, etc) and an interface to enable user registration and log in. Internally, Auth.js uses JWT to provide
|
||||||
|
Sourcebot secure and reliable information about user authentication.
|
||||||
|
</Accordion>
|
||||||
|
</AccordionGroup>
|
||||||
|
|
||||||
|
|
||||||
|
Have a question that's not answered here? Submit it on our [GitHub discussions](https://github.com/sourcebot-dev/sourcebot/discussions)
|
||||||
|
page and we'll get back to you as soon as we can!
|
||||||
28
docs/docs/configuration/auth/overview.mdx
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
---
|
||||||
|
title: Overview
|
||||||
|
---
|
||||||
|
|
||||||
|
<Warning>If you're deploying Sourcebot behind a domain, you must set the [AUTH_URL](/docs/configuration/environment-variables) environment variable.</Warning>
|
||||||
|
|
||||||
|
Sourcebot's built-in authentication system gates your deployment, and allows administrators to manage users and their permissions.
|
||||||
|
|
||||||
|
<CardGroup cols={2}>
|
||||||
|
<Card horizontal title="Authentication providers" icon="lock" href="/docs/configuration/auth/providers">
|
||||||
|
Configure additional authentication providers for your deployment.
|
||||||
|
</Card>
|
||||||
|
<Card horizontal title="Inviting members" icon="user" href="/docs/configuration/auth/inviting-members">
|
||||||
|
Learn how to configure how members join your deployment.
|
||||||
|
</Card>
|
||||||
|
<Card horizontal title="Roles and permissions" icon="shield" href="/docs/configuration/auth/roles-and-permissions">
|
||||||
|
Learn more about the different roles and permissions in Sourcebot.
|
||||||
|
</Card>
|
||||||
|
<Card horizontal title="FAQ" icon="question" href="/docs/configuration/auth/faq">
|
||||||
|
Have a question about Sourcebot's auth system? We might have the answers here.
|
||||||
|
</Card>
|
||||||
|
</CardGroup>
|
||||||
|
|
||||||
|
|
||||||
|
# Troubleshooting
|
||||||
|
|
||||||
|
- If you experience issues logging in, logging out, or accessing an organization you should have access to, try clearing your cookies & performing a full page refresh (`Cmd/Ctrl + Shift + R` on most browsers).
|
||||||
|
- Still not working? Reach out to us on our [discord](https://discord.com/invite/6Fhp27x7Pb) or [github discussions](https://github.com/sourcebot-dev/sourcebot/discussions)
|
||||||
105
docs/docs/configuration/auth/providers.mdx
Normal file
|
|
@ -0,0 +1,105 @@
|
||||||
|
---
|
||||||
|
title: Providers
|
||||||
|
---
|
||||||
|
|
||||||
|
Sourcebot supports a wide range of different authentication providers through it's integration with [Auth.js](https://authjs.dev/). This page
|
||||||
|
highlights how to configure the various supported providers.
|
||||||
|
|
||||||
|
If theres an authentication provider you'd like us to support, please [reach out](https://www.sourcebot.dev/contact).
|
||||||
|
|
||||||
|
# Core Authentication Providers
|
||||||
|
|
||||||
|
### Email / Password
|
||||||
|
---
|
||||||
|
Email / password authentication is enabled by default. It can be **disabled** by setting `AUTH_CREDENTIALS_LOGIN_ENABLED` to `false`.
|
||||||
|
|
||||||
|
### Email codes
|
||||||
|
---
|
||||||
|
Email codes are 6 digit codes sent to a provided email. Email codes are enabled when transactional emails are configured using the following environment variables:
|
||||||
|
|
||||||
|
- `AUTH_EMAIL_CODE_LOGIN_ENABLED`
|
||||||
|
- `SMTP_CONNECTION_URL`
|
||||||
|
- `EMAIL_FROM_ADDRESS`
|
||||||
|
|
||||||
|
|
||||||
|
See [transactional emails](/docs/configuration/transactional-emails) for more details.
|
||||||
|
|
||||||
|
# Enterprise Authentication Providers
|
||||||
|
|
||||||
|
The following authentication providers require an [enterprise license](/docs/license-key) to be enabled.
|
||||||
|
|
||||||
|
### GitHub
|
||||||
|
---
|
||||||
|
|
||||||
|
[Auth.js GitHub Provider Docs](https://authjs.dev/getting-started/providers/github)
|
||||||
|
|
||||||
|
**Required environment variables:**
|
||||||
|
- `AUTH_EE_GITHUB_CLIENT_ID`
|
||||||
|
- `AUTH_EE_GITHUB_CLIENT_SECRET`
|
||||||
|
|
||||||
|
Optional environment variables:
|
||||||
|
- `AUTH_EE_GITHUB_BASE_URL` - Base URL for GitHub Enterprise (defaults to https://github.com)
|
||||||
|
|
||||||
|
### GitLab
|
||||||
|
---
|
||||||
|
|
||||||
|
[Auth.js GitLab Provider Docs](https://authjs.dev/getting-started/providers/gitlab)
|
||||||
|
|
||||||
|
**Required environment variables:**
|
||||||
|
- `AUTH_EE_GITLAB_CLIENT_ID`
|
||||||
|
- `AUTH_EE_GITLAB_CLIENT_SECRET`
|
||||||
|
|
||||||
|
Optional environment variables:
|
||||||
|
- `AUTH_EE_GITLAB_BASE_URL` - Base URL for GitLab instance (defaults to https://gitlab.com)
|
||||||
|
|
||||||
|
### Google
|
||||||
|
---
|
||||||
|
|
||||||
|
[Auth.js Google Provider Docs](https://authjs.dev/getting-started/providers/google)
|
||||||
|
|
||||||
|
**Required environment variables:**
|
||||||
|
- `AUTH_EE_GOOGLE_CLIENT_ID`
|
||||||
|
- `AUTH_EE_GOOGLE_CLIENT_SECRET`
|
||||||
|
|
||||||
|
### GCP IAP
|
||||||
|
---
|
||||||
|
|
||||||
|
<Note>If you're running Sourcebot in an environment that blocks egress, make sure you allow the [IAP IP ranges](https://www.gstatic.com/ipranges/goog.json)</Note>
|
||||||
|
|
||||||
|
Custom provider built to enable automatic Sourcebot account registration/login when using GCP IAP.
|
||||||
|
|
||||||
|
**Required environment variables**
|
||||||
|
- `AUTH_EE_GCP_IAP_ENABLED`
|
||||||
|
- `AUTH_EE_GCP_IAP_AUDIENCE`
|
||||||
|
- This can be found by selecting the ⋮ icon next to the IAP-enabled backend service and pressing `Get JWT audience code`
|
||||||
|
|
||||||
|
### Okta
|
||||||
|
---
|
||||||
|
|
||||||
|
[Auth.js Okta Provider Docs](https://authjs.dev/getting-started/providers/okta)
|
||||||
|
|
||||||
|
**Required environment variables:**
|
||||||
|
- `AUTH_EE_OKTA_CLIENT_ID`
|
||||||
|
- `AUTH_EE_OKTA_CLIENT_SECRET`
|
||||||
|
- `AUTH_EE_OKTA_ISSUER`
|
||||||
|
|
||||||
|
### Keycloak
|
||||||
|
---
|
||||||
|
|
||||||
|
[Auth.js Keycloak Provider Docs](https://authjs.dev/getting-started/providers/keycloak)
|
||||||
|
|
||||||
|
**Required environment variables:**
|
||||||
|
- `AUTH_EE_KEYCLOAK_CLIENT_ID`
|
||||||
|
- `AUTH_EE_KEYCLOAK_CLIENT_SECRET`
|
||||||
|
- `AUTH_EE_KEYCLOAK_ISSUER`
|
||||||
|
|
||||||
|
### Microsoft Entra ID
|
||||||
|
|
||||||
|
[Auth.js Microsoft Entra ID Provider Docs](https://authjs.dev/getting-started/providers/microsoft-entra-id)
|
||||||
|
|
||||||
|
**Required environment variables:**
|
||||||
|
- `AUTH_EE_MICROSOFT_ENTRA_ID_CLIENT_ID`
|
||||||
|
- `AUTH_EE_MICROSOFT_ENTRA_ID_CLIENT_SECRET`
|
||||||
|
- `AUTH_EE_MICROSOFT_ENTRA_ID_ISSUER`
|
||||||
|
|
||||||
|
---
|
||||||
14
docs/docs/configuration/auth/roles-and-permissions.mdx
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
---
|
||||||
|
title: Roles and Permissions
|
||||||
|
sidebarTitle: Roles and permissions
|
||||||
|
---
|
||||||
|
|
||||||
|
<Note>Looking to sync permissions with your identify provider? We're working on it - [reach out](https://www.sourcebot.dev/contact) to us to learn more</Note>
|
||||||
|
|
||||||
|
Each member has a role which defines their permissions within an organization:
|
||||||
|
|
||||||
|
| Role | Permission |
|
||||||
|
| :--- | :--------- |
|
||||||
|
| `Owner` | Each organization has a single `Owner`. This user has full access rights, including: connection management, organization management, and inviting new members. |
|
||||||
|
| `Member` | Read-only access to the organization. A `Member` can search across the repos indexed by an organization's connections, as well as view the organizations configuration and member list. However, they cannot modify this configuration or invite new members. |
|
||||||
|
| `Guest` | When accessing Sourcebot [anonymously](/docs/configuration/auth/access-settings#anonymous-access), a user has the `Guest` role. `Guest`'s can search across repos indexed by an organization's connections, but cannot view any information regarding the organizations configuration or members. |
|
||||||
49
docs/docs/configuration/config-file.mdx
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
---
|
||||||
|
title: Config File
|
||||||
|
sidebarTitle: Config file
|
||||||
|
---
|
||||||
|
|
||||||
|
When self-hosting Sourcebot, you **must** provide it a config file. This is done by defining a config file in a volume that's mounted to Sourcebot, and providing the path to this
|
||||||
|
file in the `CONFIG_PATH` environment variable. For example:
|
||||||
|
|
||||||
|
```bash icon="terminal" Passing in a CONFIG_PATH to Sourcebot
|
||||||
|
docker run \
|
||||||
|
-v $(pwd)/config.json:/data/config.json \
|
||||||
|
-e CONFIG_PATH=/data/config.json \
|
||||||
|
... \ # other options
|
||||||
|
ghcr.io/sourcebot-dev/sourcebot:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
The config file tells Sourcebot which repos to index, what language models to use, and various other settings as defined in the [schema](#config-file-schema).
|
||||||
|
|
||||||
|
# Config File Schema
|
||||||
|
|
||||||
|
The config file you provide Sourcebot must follow the [schema](https://github.com/sourcebot-dev/sourcebot/blob/main/schemas/v3/index.json). This schema consists of the following properties:
|
||||||
|
|
||||||
|
- [Connections](/docs/connections/overview) (`connections`): Defines a set of connections that tell Sourcebot which repos to index and from where
|
||||||
|
- [Language Models](/docs/configuration/language-model-providers) (`models`): Defines a set of language model providers for use with [Ask Sourcebot](/docs/features/ask)
|
||||||
|
- [Settings](#settings) (`settings`): Additional settings to tweak your Sourcebot deployment
|
||||||
|
- [Search Contexts](/docs/features/search/search-contexts) (`contexts`): Groupings of repos that you can search against
|
||||||
|
|
||||||
|
# Config File Syncing
|
||||||
|
|
||||||
|
Sourcebot syncs the config file on startup, and automatically whenever a change is detected.
|
||||||
|
|
||||||
|
# Settings
|
||||||
|
|
||||||
|
The following are settings that can be provided in your config file to modify Sourcebot's behavior
|
||||||
|
|
||||||
|
| Setting | Type | Default | Minimum | Description / Notes |
|
||||||
|
|-------------------------------------------|---------|------------|---------|----------------------------------------------------------------------------------------|
|
||||||
|
| `maxFileSize` | number | 2 MB | 1 | Maximum size (bytes) of a file to index. Files exceeding this are skipped. |
|
||||||
|
| `maxTrigramCount` | number | 20 000 | 1 | Maximum trigrams per document. Larger files are skipped. |
|
||||||
|
| `reindexIntervalMs` | number | 1 hour | 1 | Interval at which all repositories are re‑indexed. |
|
||||||
|
| `resyncConnectionIntervalMs` | number | 24 hours | 1 | Interval for checking connections that need re‑syncing. |
|
||||||
|
| `resyncConnectionPollingIntervalMs` | number | 1 second | 1 | DB polling rate for connections that need re‑syncing. |
|
||||||
|
| `reindexRepoPollingIntervalMs` | number | 1 second | 1 | DB polling rate for repos that should be re‑indexed. |
|
||||||
|
| `maxConnectionSyncJobConcurrency` | number | 8 | 1 | Concurrent connection‑sync jobs. |
|
||||||
|
| `maxRepoIndexingJobConcurrency` | number | 8 | 1 | Concurrent repo‑indexing jobs. |
|
||||||
|
| `maxRepoGarbageCollectionJobConcurrency` | number | 8 | 1 | Concurrent repo‑garbage‑collection jobs. |
|
||||||
|
| `repoGarbageCollectionGracePeriodMs` | number | 10 seconds | 1 | Grace period to avoid deleting shards while loading. |
|
||||||
|
| `repoIndexTimeoutMs` | number | 2 hours | 1 | Timeout for a single repo‑indexing run. |
|
||||||
|
| `enablePublicAccess` **(deprecated)** | boolean | false | — | Use the `FORCE_ENABLE_ANONYMOUS_ACCESS` environment variable instead. |
|
||||||
|
|
@ -5,10 +5,6 @@ sidebarTitle: Declarative config
|
||||||
|
|
||||||
import ConfigSchema from '/snippets/schemas/v3/index.schema.mdx'
|
import ConfigSchema from '/snippets/schemas/v3/index.schema.mdx'
|
||||||
|
|
||||||
<Warning>
|
|
||||||
Declaratively defining `connections` is not available when [multi-tenancy](/self-hosting/more/tenancy) is enabled.
|
|
||||||
</Warning>
|
|
||||||
|
|
||||||
Some teams require Sourcebot to be configured via a file (where it can be stored in version control, run through CI/CD pipelines, etc.) instead of a web UI. For more information on configuring connections, see this [overview](/docs/connections/overview).
|
Some teams require Sourcebot to be configured via a file (where it can be stored in version control, run through CI/CD pipelines, etc.) instead of a web UI. For more information on configuring connections, see this [overview](/docs/connections/overview).
|
||||||
|
|
||||||
|
|
||||||
75
docs/docs/configuration/environment-variables.mdx
Normal file
|
|
@ -0,0 +1,75 @@
|
||||||
|
---
|
||||||
|
title: Environment variables
|
||||||
|
sidebarTitle: Environment variables
|
||||||
|
mode: "wide"
|
||||||
|
---
|
||||||
|
|
||||||
|
<Note>This page provides a detailed reference of all environment variables supported by Sourcebot. If you're just looking to get up and running, we recommend starting with the [deployment guide](/docs/deployment-guide) instead.</Note>
|
||||||
|
|
||||||
|
### Core Environment Variables
|
||||||
|
The following environment variables allow you to configure your Sourcebot deployment.
|
||||||
|
|
||||||
|
| Variable | Default | Description |
|
||||||
|
| :------- | :------ | :---------- |
|
||||||
|
| `AUTH_CREDENTIALS_LOGIN_ENABLED` | `true` | <p>Enables/disables authentication with basic credentials. Username and passwords are stored encrypted at rest within the postgres database. Checkout the [auth docs](/docs/configuration/auth/overview) for more info</p> |
|
||||||
|
| `AUTH_EMAIL_CODE_LOGIN_ENABLED` | `false` | <p>Enables/disables authentication with a login code that's sent to a users email. `SMTP_CONNECTION_URL` and `EMAIL_FROM_ADDRESS` must also be set. Checkout the [auth docs](/docs/configuration/auth/overview) for more info </p> |
|
||||||
|
| `AUTH_SECRET` | Automatically generated at startup if no value is provided. Generated using `openssl rand -base64 33` | <p>Used to validate login session cookies</p> |
|
||||||
|
| `AUTH_URL` | - | <p>URL of your Sourcebot deployment, e.g., `https://example.com` or `http://localhost:3000`.</p> |
|
||||||
|
| `CONFIG_PATH` | `-` | <p>The container relative path to the declerative configuration file. See [this doc](/docs/configuration/declarative-config) for more info.</p> |
|
||||||
|
| `DATA_CACHE_DIR` | `$DATA_DIR/.sourcebot` | <p>The root data directory in which all data written to disk by Sourcebot will be located.</p> |
|
||||||
|
| `DATA_DIR` | `/data` | <p>The directory within the container to store all persistent data. Typically, this directory will be volume mapped such that data is persisted across container restarts (e.g., `docker run -v $(pwd):/data`)</p> |
|
||||||
|
| `DATABASE_DATA_DIR` | `$DATA_CACHE_DIR/db` | <p>The data directory for the default Postgres database.</p> |
|
||||||
|
| `DATABASE_URL` | `postgresql://postgres@ localhost:5432/sourcebot` | <p>Connection string of your Postgres database. By default, a Postgres database is automatically provisioned at startup within the container.</p><p>If you'd like to use a non-default schema, you can provide it as a parameter in the database url </p> |
|
||||||
|
| `EMAIL_FROM_ADDRESS` | `-` | <p>The email address that transactional emails will be sent from. See [this doc](/docs/configuration/transactional-emails) for more info.</p> |
|
||||||
|
| `FORCE_ENABLE_ANONYMOUS_ACCESS` | `false` | <p>When enabled, [anonymous access](/docs/configuration/auth/access-settings#anonymous-access) to the organization will always be enabled</p>
|
||||||
|
| `REDIS_DATA_DIR` | `$DATA_CACHE_DIR/redis` | <p>The data directory for the default Redis instance.</p> |
|
||||||
|
| `REDIS_URL` | `redis://localhost:6379` | <p>Connection string of your Redis instance. By default, a Redis database is automatically provisioned at startup within the container.</p> |
|
||||||
|
| `REDIS_REMOVE_ON_COMPLETE` | `0` | <p>Controls how many completed jobs are allowed to remain in Redis queues</p> |
|
||||||
|
| `REDIS_REMOVE_ON_FAIL` | `100` | <p>Controls how many failed jobs are allowed to remain in Redis queues</p> |
|
||||||
|
| `REPO_SYNC_RETRY_BASE_SLEEP_SECONDS` | `60` | <p>The base sleep duration (in seconds) for exponential backoff when retrying repository sync operations that fail</p> |
|
||||||
|
| `GITLAB_CLIENT_QUERY_TIMEOUT_SECONDS` | `600` | <p>The timeout duration (in seconds) for GitLab client queries</p> |
|
||||||
|
| `SHARD_MAX_MATCH_COUNT` | `10000` | <p>The maximum shard count per query</p> |
|
||||||
|
| `SMTP_CONNECTION_URL` | `-` | <p>The url to the SMTP service used for sending transactional emails. See [this doc](/docs/configuration/transactional-emails) for more info.</p> |
|
||||||
|
| `SOURCEBOT_ENCRYPTION_KEY` | Automatically generated at startup if no value is provided. Generated using `openssl rand -base64 24` | <p>Used to encrypt connection secrets and generate API keys.</p> |
|
||||||
|
| `SOURCEBOT_PUBLIC_KEY_PATH` | `/app/public.pem` | <p>Sourcebot's public key that's used to verify encrypted license key signatures.</p> |
|
||||||
|
| `SOURCEBOT_LOG_LEVEL` | `info` | <p>The Sourcebot logging level. Valid values are `debug`, `info`, `warn`, `error`, in order of severity.</p> |
|
||||||
|
| `SOURCEBOT_STRUCTURED_LOGGING_ENABLED` | `false` | <p>Enables/disable structured JSON logging. See [this doc](/docs/configuration/structured-logging) for more info.</p> |
|
||||||
|
| `SOURCEBOT_STRUCTURED_LOGGING_FILE` | - | <p>Optional file to log to if structured logging is enabled</p> |
|
||||||
|
| `SOURCEBOT_TELEMETRY_DISABLED` | `false` | <p>Enables/disables telemetry collection in Sourcebot. See [this doc](/docs/overview.mdx#telemetry) for more info.</p> |
|
||||||
|
| `TOTAL_MAX_MATCH_COUNT` | `100000` | <p>The maximum number of matches per query</p> |
|
||||||
|
| `ZOEKT_MAX_WALL_TIME_MS` | `10000` | <p>The maximum real world duration (in milliseconds) per zoekt query</p> |
|
||||||
|
|
||||||
|
### Enterprise Environment Variables
|
||||||
|
| Variable | Default | Description |
|
||||||
|
| :------- | :------ | :---------- |
|
||||||
|
| `SOURCEBOT_EE_AUDIT_LOGGING_ENABLED` | `true` | <p>Enables/disables audit logging</p> |
|
||||||
|
| `AUTH_EE_GITHUB_BASE_URL` | `https://github.com` | <p>The base URL for GitHub Enterprise SSO authentication.</p> |
|
||||||
|
| `AUTH_EE_GITHUB_CLIENT_ID` | `-` | <p>The client ID for GitHub Enterprise SSO authentication.</p> |
|
||||||
|
| `AUTH_EE_GITHUB_CLIENT_SECRET` | `-` | <p>The client secret for GitHub Enterprise SSO authentication.</p> |
|
||||||
|
| `AUTH_EE_GITLAB_BASE_URL` | `https://gitlab.com` | <p>The base URL for GitLab Enterprise SSO authentication.</p> |
|
||||||
|
| `AUTH_EE_GITLAB_CLIENT_ID` | `-` | <p>The client ID for GitLab Enterprise SSO authentication.</p> |
|
||||||
|
| `AUTH_EE_GITLAB_CLIENT_SECRET` | `-` | <p>The client secret for GitLab Enterprise SSO authentication.</p> |
|
||||||
|
| `AUTH_EE_GOOGLE_CLIENT_ID` | `-` | <p>The client ID for Google SSO authentication.</p> |
|
||||||
|
| `AUTH_EE_GOOGLE_CLIENT_SECRET` | `-` | <p>The client secret for Google SSO authentication.</p> |
|
||||||
|
| `AUTH_EE_KEYCLOAK_CLIENT_ID` | `-` | <p>The client ID for Keycloak SSO authentication.</p> |
|
||||||
|
| `AUTH_EE_KEYCLOAK_CLIENT_SECRET` | `-` | <p>The client secret for Keycloak SSO authentication.</p> |
|
||||||
|
| `AUTH_EE_KEYCLOAK_ISSUER` | `-` | <p>The issuer URL for Keycloak SSO authentication.</p> |
|
||||||
|
| `AUTH_EE_OKTA_CLIENT_ID` | `-` | <p>The client ID for Okta SSO authentication.</p> |
|
||||||
|
| `AUTH_EE_OKTA_CLIENT_SECRET` | `-` | <p>The client secret for Okta SSO authentication.</p> |
|
||||||
|
| `AUTH_EE_OKTA_ISSUER` | `-` | <p>The issuer URL for Okta SSO authentication.</p> |
|
||||||
|
| `AUTH_EE_GCP_IAP_ENABLED` | `false` | <p>When enabled, allows Sourcebot to automatically register/login from a successful GCP IAP redirect</p> |
|
||||||
|
| `AUTH_EE_GCP_IAP_AUDIENCE` | - | <p>The GCP IAP audience to use when verifying JWT tokens. Must be set to enable GCP IAP JIT provisioning</p> |
|
||||||
|
|
||||||
|
|
||||||
|
### Review Agent Environment Variables
|
||||||
|
| Variable | Default | Description |
|
||||||
|
| :------- | :------ | :---------- |
|
||||||
|
| `GITHUB_APP_ID` | `-` | <p>The GitHub App ID used for review agent authentication.</p> |
|
||||||
|
| `GITHUB_APP_PRIVATE_KEY_PATH` | `-` | <p>The container relative path to the private key file for the GitHub App used by the review agent.</p> |
|
||||||
|
| `GITHUB_APP_WEBHOOK_SECRET` | `-` | <p>The webhook secret for the GitHub App used by the review agent.</p> |
|
||||||
|
| `OPENAI_API_KEY` | `-` | <p>The OpenAI API key used by the review agent.</p> |
|
||||||
|
| `REVIEW_AGENT_API_KEY` | `-` | <p>The Sourcebot API key used by the review agent.</p> |
|
||||||
|
| `REVIEW_AGENT_AUTO_REVIEW_ENABLED` | `false` | <p>Enables/disables automatic code reviews by the review agent.</p> |
|
||||||
|
| `REVIEW_AGENT_LOGGING_ENABLED` | `true` | <p>Enables/disables logging for the review agent. Logs are saved in `DATA_CACHE_DIR/review-agent`</p> |
|
||||||
|
| `REVIEW_AGENT_REVIEW_COMMAND` | `review` | <p>The command used to trigger a code review by the review agent.</p> |
|
||||||
|
|
||||||
291
docs/docs/configuration/language-model-providers.mdx
Normal file
|
|
@ -0,0 +1,291 @@
|
||||||
|
---
|
||||||
|
title: Language Model Providers
|
||||||
|
sidebarTitle: Language model providers
|
||||||
|
---
|
||||||
|
|
||||||
|
To use [Ask Sourcebot](/docs/features/ask) you must define at least one Language Model Provider. These providers are defined within the [config file](/docs/configuration/config-file) you
|
||||||
|
provide Sourcebot.
|
||||||
|
|
||||||
|
|
||||||
|
```json wrap icon="code" Example config with language model provider
|
||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
|
||||||
|
"models": [
|
||||||
|
// 1. Google Vertex config for Gemini 2.5 Pro
|
||||||
|
{
|
||||||
|
"provider": "google-vertex",
|
||||||
|
"model": "gemini-2.5-pro",
|
||||||
|
"displayName": "Gemini 2.5 Pro",
|
||||||
|
"project": "sourcebot",
|
||||||
|
"credentials": {
|
||||||
|
"env": "GOOGLE_APPLICATION_CREDENTIALS"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 2. OpenAI config for o3
|
||||||
|
{
|
||||||
|
"provider": "openai",
|
||||||
|
"model": "o3",
|
||||||
|
"displayName": "o3",
|
||||||
|
"token": {
|
||||||
|
"env": "OPENAI_API_KEY"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Supported Providers
|
||||||
|
|
||||||
|
Sourcebot uses the [Vercel AI SDK](https://ai-sdk.dev/docs/introduction), so it can integrate with any provider the SDK supports. If you don't see your provider below please submit
|
||||||
|
a [feature request](https://github.com/sourcebot-dev/sourcebot/discussions/categories/feature-requests).
|
||||||
|
|
||||||
|
For a detailed description of all the providers, please refer to the [schema](https://github.com/sourcebot-dev/sourcebot/blob/main/schemas/v3/languageModel.json).
|
||||||
|
|
||||||
|
<Note>Any parameter defined using `env` will read the value from the corresponding environment variable you provide Sourcebot</Note>
|
||||||
|
|
||||||
|
### Amazon Bedrock
|
||||||
|
|
||||||
|
[Vercel AI SDK Amazon Bedrock Docs](https://v5.ai-sdk.dev/providers/ai-sdk-providers/amazon-bedrock)
|
||||||
|
|
||||||
|
```json wrap icon="code" Example config with Amazon Bedrock provider
|
||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
|
||||||
|
"models": [
|
||||||
|
{
|
||||||
|
"provider": "amazon-bedrock",
|
||||||
|
"model": "YOUR_MODEL_HERE",
|
||||||
|
"displayName": "OPTIONAL_DISPLAY_NAME",
|
||||||
|
"accessKeyId": {
|
||||||
|
"env": "AWS_ACCESS_KEY_ID"
|
||||||
|
},
|
||||||
|
"accessKeySecret": {
|
||||||
|
"env": "AWS_SECRET_ACCESS_KEY"
|
||||||
|
},
|
||||||
|
"region": "YOUR_REGION_HERE", // defaults to the AWS_REGION env var if not set
|
||||||
|
"baseUrl": "OPTIONAL_BASE_URL"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Anthropic
|
||||||
|
|
||||||
|
[Vercel AI SDK Anthropic Docs](https://v5.ai-sdk.dev/providers/ai-sdk-providers/anthropic)
|
||||||
|
|
||||||
|
```json wrap icon="code" Example config with Anthropic provider
|
||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
|
||||||
|
"models": [
|
||||||
|
{
|
||||||
|
"provider": "anthropic",
|
||||||
|
"model": "YOUR_MODEL_HERE",
|
||||||
|
"displayName": "OPTIONAL_DISPLAY_NAME",
|
||||||
|
"token": {
|
||||||
|
"env": "ANTHROPIC_API_KEY"
|
||||||
|
},
|
||||||
|
"baseUrl": "OPTIONAL_BASE_URL"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Azure OpenAI
|
||||||
|
|
||||||
|
[Vercel AI SDK Azure OpenAI Docs](https://v5.ai-sdk.dev/providers/ai-sdk-providers/azure)
|
||||||
|
|
||||||
|
```json wrap icon="code" Example config with Azure AI provider
|
||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
|
||||||
|
"models": [
|
||||||
|
{
|
||||||
|
"provider": "azure",
|
||||||
|
"model": "YOUR_MODEL_HERE",
|
||||||
|
"displayName": "OPTIONAL_DISPLAY_NAME",
|
||||||
|
"resourceName": "YOUR_RESOURCE_NAME", // defaults to the AZURE_RESOURCE_NAME env var if not set
|
||||||
|
"apiVersion": "OPTIONAL_API_VERSION", // defailts to 'preview' if not set
|
||||||
|
"token": {
|
||||||
|
"env": "AZURE_API_KEY"
|
||||||
|
},
|
||||||
|
"baseUrl": "OPTIONAL_BASE_URL"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Deepseek
|
||||||
|
|
||||||
|
[Vercel AI SDK Deepseek Docs](https://v5.ai-sdk.dev/providers/ai-sdk-providers/deepseek)
|
||||||
|
|
||||||
|
```json wrap icon="code" Example config with Deepseek provider
|
||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
|
||||||
|
"models": [
|
||||||
|
{
|
||||||
|
"provider": "deepseek",
|
||||||
|
"model": "YOUR_MODEL_HERE",
|
||||||
|
"displayName": "OPTIONAL_DISPLAY_NAME",
|
||||||
|
"token": {
|
||||||
|
"env": "DEEPSEEK_API_KEY"
|
||||||
|
},
|
||||||
|
"baseUrl": "OPTIONAL_BASE_URL"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Google Generative AI
|
||||||
|
|
||||||
|
[Vercel AI SDK Google Generative AI Docs](https://v5.ai-sdk.dev/providers/ai-sdk-providers/google-generative-ai)
|
||||||
|
|
||||||
|
```json wrap icon="code" Example config with Google Generative AI provider
|
||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
|
||||||
|
"models": [
|
||||||
|
{
|
||||||
|
"provider": "google-generative-ai",
|
||||||
|
"model": "YOUR_MODEL_HERE",
|
||||||
|
"displayName": "OPTIONAL_DISPLAY_NAME",
|
||||||
|
"token": {
|
||||||
|
"env": "GOOGLE_GENERATIVE_AI_API_KEY"
|
||||||
|
},
|
||||||
|
"baseUrl": "OPTIONAL_BASE_URL"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Google Vertex
|
||||||
|
|
||||||
|
<Note>If you're using an Anthropic model on Google Vertex, you must define a [Google Vertex Anthropic](#google-vertex-anthropic) provider instead</Note>
|
||||||
|
<Note>The `credentials` paramater here expects a **path** to a [credentials](https://console.cloud.google.com/apis/credentials) file. This file **must be in a volume mounted by Sourcebot** for it to be readable.</Note>
|
||||||
|
|
||||||
|
[Vercel AI SDK Google Vertex AI Docs](https://v5.ai-sdk.dev/providers/ai-sdk-providers/google-vertex)
|
||||||
|
|
||||||
|
```json wrap icon="code" Example config with Google Vertex provider
|
||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
|
||||||
|
"models": [
|
||||||
|
{
|
||||||
|
"provider": "google-vertex",
|
||||||
|
"model": "YOUR_MODEL_HERE",
|
||||||
|
"displayName": "OPTIONAL_DISPLAY_NAME",
|
||||||
|
"project": "YOUR_PROJECT_ID", // defaults to the GOOGLE_VERTEX_PROJECT env var if not set
|
||||||
|
"region": "YOUR_REGION_HERE", // defaults to the GOOGLE_VERTEX_REGION env var if not set
|
||||||
|
"credentials": {
|
||||||
|
"env": "GOOGLE_APPLICATION_CREDENTIALS"
|
||||||
|
},
|
||||||
|
"baseUrl": "OPTIONAL_BASE_URL"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Google Vertex Anthropic
|
||||||
|
|
||||||
|
<Note>The `credentials` paramater here expects a **path** to a [credentials](https://console.cloud.google.com/apis/credentials) file. This file **must be in a volume mounted by Sourcebot** for it to be readable.</Note>
|
||||||
|
|
||||||
|
|
||||||
|
[Vercel AI SDK Google Vertex Anthropic Docs](https://v5.ai-sdk.dev/providers/ai-sdk-providers/google-vertex#google-vertex-anthropic-provider-usage)
|
||||||
|
|
||||||
|
```json wrap icon="code" Example config with Google Vertex Anthropic provider
|
||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
|
||||||
|
"models": [
|
||||||
|
{
|
||||||
|
"provider": "google-vertex-anthropic",
|
||||||
|
"model": "YOUR_MODEL_HERE",
|
||||||
|
"displayName": "OPTIONAL_DISPLAY_NAME",
|
||||||
|
"project": "YOUR_PROJECT_ID", // defaults to the GOOGLE_VERTEX_PROJECT env var if not set
|
||||||
|
"region": "YOUR_REGION_HERE", // defaults to the GOOGLE_VERTEX_REGION env var if not set
|
||||||
|
"credentials": {
|
||||||
|
"env": "GOOGLE_APPLICATION_CREDENTIALS"
|
||||||
|
},
|
||||||
|
"baseUrl": "OPTIONAL_BASE_URL"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Mistral
|
||||||
|
|
||||||
|
[Vercel AI SDK Mistral Docs](https://v5.ai-sdk.dev/providers/ai-sdk-providers/mistral)
|
||||||
|
|
||||||
|
```json wrap icon="code" Example config with Mistral provider
|
||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
|
||||||
|
"models": [
|
||||||
|
{
|
||||||
|
"provider": "mistral",
|
||||||
|
"model": "YOUR_MODEL_HERE",
|
||||||
|
"displayName": "OPTIONAL_DISPLAY_NAME",
|
||||||
|
"token": {
|
||||||
|
"env": "MISTRAL_API_KEY"
|
||||||
|
},
|
||||||
|
"baseUrl": "OPTIONAL_BASE_URL"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### OpenAI
|
||||||
|
|
||||||
|
[Vercel AI SDK OpenAI Docs](https://v5.ai-sdk.dev/providers/ai-sdk-providers/openai)
|
||||||
|
|
||||||
|
```json wrap icon="code" Example config with OpenAI provider
|
||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
|
||||||
|
"models": [
|
||||||
|
{
|
||||||
|
"provider": "openai",
|
||||||
|
"model": "YOUR_MODEL_HERE",
|
||||||
|
"displayName": "OPTIONAL_DISPLAY_NAME",
|
||||||
|
"token": {
|
||||||
|
"env": "OPENAI_API_KEY"
|
||||||
|
},
|
||||||
|
"baseUrl": "OPTIONAL_BASE_URL"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### OpenRouter
|
||||||
|
|
||||||
|
[Vercel AI SDK OpenRouter Docs](https://v5.ai-sdk.dev/providers/community-providers/openrouter)
|
||||||
|
|
||||||
|
```json wrap icon="code" Example config with OpenRouter provider
|
||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
|
||||||
|
"models": [
|
||||||
|
{
|
||||||
|
"provider": "openai",
|
||||||
|
"model": "YOUR_MODEL_HERE",
|
||||||
|
"displayName": "OPTIONAL_DISPLAY_NAME",
|
||||||
|
"token": {
|
||||||
|
"env": "OPENROUTER_API_KEY"
|
||||||
|
},
|
||||||
|
"baseUrl": "OPTIONAL_BASE_URL"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### xAI
|
||||||
|
|
||||||
|
[Vercel AI SDK xAI Docs](https://v5.ai-sdk.dev/providers/ai-sdk-providers/xai)
|
||||||
|
|
||||||
|
```json wrap icon="code" Example config with xAI provider
|
||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
|
||||||
|
"models": [
|
||||||
|
{
|
||||||
|
"provider": "xai",
|
||||||
|
"model": "YOUR_MODEL_HERE",
|
||||||
|
"displayName": "OPTIONAL_DISPLAY_NAME",
|
||||||
|
"token": {
|
||||||
|
"env": "XAI_API_KEY"
|
||||||
|
},
|
||||||
|
"baseUrl": "OPTIONAL_BASE_URL"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
40
docs/docs/configuration/structured-logging.mdx
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
---
|
||||||
|
title: Structured Logging
|
||||||
|
sidebarTitle: Structured logging
|
||||||
|
---
|
||||||
|
|
||||||
|
By default, Sourcebot will output logs to the console in a human readable format. If you'd like Sourcebot to output structured JSON logs, set the following env vars:
|
||||||
|
|
||||||
|
- `SOURCEBOT_STRUCTURED_LOGGING_ENABLED` (default: `false`): Controls whether logs are in a structured JSON format
|
||||||
|
- `SOURCEBOT_STRUCTURED_LOGGING_FILE`: If structured logging is enabled and this env var is set, structured logs will be written to this file (ex. `/data/sourcebot.log`)
|
||||||
|
|
||||||
|
### Structured log schema
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||||
|
"type": "object",
|
||||||
|
"title": "SourcebotLog",
|
||||||
|
"properties": {
|
||||||
|
"level": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The log level (error, warning, info, debug)"
|
||||||
|
},
|
||||||
|
"service": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The Sourcebot component that generated the log"
|
||||||
|
},
|
||||||
|
"message": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The log message"
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The same value as the level field added for datadog support"
|
||||||
|
},
|
||||||
|
"timestamp": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The timestamp of the log in ISO 8061 format"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
@ -4,7 +4,7 @@ sidebarTitle: Multi tenancy
|
||||||
---
|
---
|
||||||
|
|
||||||
<Warning>If you're switching from single-tenant mode, delete the Sourcebot cache (the `.sourcebot` folder) before starting.</Warning>
|
<Warning>If you're switching from single-tenant mode, delete the Sourcebot cache (the `.sourcebot` folder) before starting.</Warning>
|
||||||
<Warning>[Authentication](/self-hosting/more/authentication) must be enabled to enable multi tenancy mode</Warning>
|
<Warning>[Authentication](/docs/configuration/auth/overview) must be enabled to enable multi tenancy mode</Warning>
|
||||||
Multi tenancy allows your Sourcebot deployment to have **multiple organizations**, each with their own set of members and repos. To enable multi tenancy mode, define an environment variable
|
Multi tenancy allows your Sourcebot deployment to have **multiple organizations**, each with their own set of members and repos. To enable multi tenancy mode, define an environment variable
|
||||||
named `SOURCEBOT_TENANCY_MODE` and set its value to `multi`. When multi tenancy mode is enabled:
|
named `SOURCEBOT_TENANCY_MODE` and set its value to `multi`. When multi tenancy mode is enabled:
|
||||||
|
|
||||||
|
|
@ -6,9 +6,10 @@ sidebarTitle: Transactional email
|
||||||
To enable transactional emails in your deployment, set the following environment variables. We recommend using [Resend](https://resend.com/), but you can use any provider. Setting this enables you to:
|
To enable transactional emails in your deployment, set the following environment variables. We recommend using [Resend](https://resend.com/), but you can use any provider. Setting this enables you to:
|
||||||
|
|
||||||
- Send emails when new members are invited
|
- Send emails when new members are invited
|
||||||
- Log into the Sourcebot deployment using [email codes](self-hosting/more/authentication#email-codes)
|
- Send emails when organization join requests are created/accepted
|
||||||
|
- Log into the Sourcebot deployment using [email codes](/docs/configuration/auth/overview#email-codes)
|
||||||
|
|
||||||
| Variable | Description |
|
| Variable | Description |
|
||||||
| :------- | :---------- |
|
| :------- | :---------- |
|
||||||
| `SMTP_CONNECTION_URL` | SMTP server connection. |
|
| `SMTP_CONNECTION_URL` | SMTP server connection (`smtp://[user[:password]@]host[:port]`)|
|
||||||
| `EMAIL_FROM_ADDRESS` | The sender's email address |
|
| `EMAIL_FROM_ADDRESS` | The sender's email address |
|
||||||
|
|
@ -1,12 +1,19 @@
|
||||||
---
|
---
|
||||||
title: Linking code from Bitbucket Cloud
|
title: Linking code from Bitbucket Cloud
|
||||||
sidebarTitle: Bitbucket Cloud
|
sidebarTitle: Bitbucket Cloud
|
||||||
|
icon: Bitbucket
|
||||||
---
|
---
|
||||||
|
|
||||||
import BitbucketToken from '/snippets/bitbucket-token.mdx';
|
import BitbucketToken from '/snippets/bitbucket-token.mdx';
|
||||||
import BitbucketAppPassword from '/snippets/bitbucket-app-password.mdx';
|
import BitbucketAppPassword from '/snippets/bitbucket-app-password.mdx';
|
||||||
import BitbucketSchema from '/snippets/schemas/v3/bitbucket.schema.mdx'
|
import BitbucketSchema from '/snippets/schemas/v3/bitbucket.schema.mdx'
|
||||||
|
|
||||||
|
<Note>
|
||||||
|
Looking for docs on Bitbucket Data Center? See [this doc](/docs/connections/bitbucket-data-center).
|
||||||
|
</Note>
|
||||||
|
|
||||||
|
If you're not familiar with Sourcebot [connections](/docs/connections/overview), please read that overview first.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
<AccordionGroup>
|
<AccordionGroup>
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,19 @@
|
||||||
---
|
---
|
||||||
title: Linking code from Bitbucket Data Center
|
title: Linking code from Bitbucket Data Center
|
||||||
sidebarTitle: Bitbucket Data Center
|
sidebarTitle: Bitbucket Data Center
|
||||||
|
icon: Bitbucket
|
||||||
---
|
---
|
||||||
|
|
||||||
import BitbucketToken from '/snippets/bitbucket-token.mdx';
|
import BitbucketToken from '/snippets/bitbucket-token.mdx';
|
||||||
import BitbucketAppPassword from '/snippets/bitbucket-app-password.mdx';
|
import BitbucketAppPassword from '/snippets/bitbucket-app-password.mdx';
|
||||||
import BitbucketSchema from '/snippets/schemas/v3/bitbucket.schema.mdx'
|
import BitbucketSchema from '/snippets/schemas/v3/bitbucket.schema.mdx'
|
||||||
|
|
||||||
|
<Note>
|
||||||
|
Looking for docs on Bitbucket Cloud? See [this doc](/docs/connections/bitbucket-cloud).
|
||||||
|
</Note>
|
||||||
|
|
||||||
|
If you're not familiar with Sourcebot [connections](/docs/connections/overview), please read that overview first.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
<AccordionGroup>
|
<AccordionGroup>
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,14 @@
|
||||||
---
|
---
|
||||||
title: Other Git hosts
|
title: Other Git hosts
|
||||||
|
icon: git-alt
|
||||||
---
|
---
|
||||||
|
|
||||||
import GenericGitHost from '/snippets/schemas/v3/genericGitHost.schema.mdx'
|
import GenericGitHost from '/snippets/schemas/v3/genericGitHost.schema.mdx'
|
||||||
|
|
||||||
Sourcebot can sync code from any Git host (by clone url). This is helpful when you want to search code that not in a [supported code host](/docs/connections/overview#supported-code-hosts).
|
Sourcebot can sync code from any Git host (by clone url). This is helpful when you want to search code that not in a [supported code host](/docs/connections/overview#supported-code-hosts).
|
||||||
|
|
||||||
|
If you're not familiar with Sourcebot [connections](/docs/connections/overview), please read that overview first.
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
To connect to a Git host, create a new [connection](/docs/connections/overview) with type `git` and specify the clone url in the `url` property. For example:
|
To connect to a Git host, create a new [connection](/docs/connections/overview) with type `git` and specify the clone url in the `url` property. For example:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
---
|
---
|
||||||
title: Linking code from Gerrit
|
title: Linking code from Gerrit
|
||||||
sidebarTitle: Gerrit
|
sidebarTitle: Gerrit
|
||||||
|
icon: crow
|
||||||
---
|
---
|
||||||
|
|
||||||
import GerritSchema from '/snippets/schemas/v3/gerrit.schema.mdx'
|
import GerritSchema from '/snippets/schemas/v3/gerrit.schema.mdx'
|
||||||
|
|
@ -9,6 +10,8 @@ import GerritSchema from '/snippets/schemas/v3/gerrit.schema.mdx'
|
||||||
|
|
||||||
Sourcebot can sync code from self-hosted gerrit instances.
|
Sourcebot can sync code from self-hosted gerrit instances.
|
||||||
|
|
||||||
|
If you're not familiar with Sourcebot [connections](/docs/connections/overview), please read that overview first.
|
||||||
|
|
||||||
## Connecting to a Gerrit instance
|
## Connecting to a Gerrit instance
|
||||||
|
|
||||||
To connect to a gerrit instance, provide the `url` property to your config:
|
To connect to a gerrit instance, provide the `url` property to your config:
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,15 @@
|
||||||
---
|
---
|
||||||
title: Linking code from Gitea
|
title: Linking code from Gitea
|
||||||
sidebarTitle: Gitea
|
sidebarTitle: Gitea
|
||||||
|
icon: mug-tea
|
||||||
---
|
---
|
||||||
|
|
||||||
import GiteaSchema from '/snippets/schemas/v3/gitea.schema.mdx'
|
import GiteaSchema from '/snippets/schemas/v3/gitea.schema.mdx'
|
||||||
|
|
||||||
Sourcebot can sync code from Gitea Cloud, and self-hosted.
|
Sourcebot can sync code from Gitea Cloud, and self-hosted.
|
||||||
|
|
||||||
|
If you're not familiar with Sourcebot [connections](/docs/connections/overview), please read that overview first.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
<AccordionGroup>
|
<AccordionGroup>
|
||||||
|
|
@ -82,7 +85,7 @@ Next, provide the access token via the `token` property, either as an environmen
|
||||||
|
|
||||||
<Tabs>
|
<Tabs>
|
||||||
<Tab title="Environment Variable">
|
<Tab title="Environment Variable">
|
||||||
<Note>Environment variables are only supported in a [declarative config](/self-hosting/more/declarative-config) and cannot be used in the web UI.</Note>
|
<Note>Environment variables are only supported in a [declarative config](/docs/configuration/declarative-config) and cannot be used in the web UI.</Note>
|
||||||
|
|
||||||
1. Add the `token` property to your connection config:
|
1. Add the `token` property to your connection config:
|
||||||
```json
|
```json
|
||||||
|
|
@ -107,7 +110,7 @@ Next, provide the access token via the `token` property, either as an environmen
|
||||||
</Tab>
|
</Tab>
|
||||||
|
|
||||||
<Tab title="Secret">
|
<Tab title="Secret">
|
||||||
<Note>Secrets are only supported when [authentication](/self-hosting/more/authentication) is enabled.</Note>
|
<Note>Secrets are only supported when [authentication](/docs/configuration/auth/overview) is enabled.</Note>
|
||||||
|
|
||||||
1. Navigate to **Secrets** in settings and create a new secret with your PAT:
|
1. Navigate to **Secrets** in settings and create a new secret with your PAT:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,15 @@
|
||||||
---
|
---
|
||||||
title: Linking code from GitHub
|
title: Linking code from GitHub
|
||||||
sidebarTitle: GitHub
|
sidebarTitle: GitHub
|
||||||
|
icon: GitHub
|
||||||
---
|
---
|
||||||
|
|
||||||
import GitHubSchema from '/snippets/schemas/v3/github.schema.mdx'
|
import GitHubSchema from '/snippets/schemas/v3/github.schema.mdx'
|
||||||
|
|
||||||
Sourcebot can sync code from GitHub.com, GitHub Enterprise Server, and GitHub Enterprise Cloud.
|
Sourcebot can sync code from GitHub.com, GitHub Enterprise Server, and GitHub Enterprise Cloud.
|
||||||
|
|
||||||
|
If you're not familiar with Sourcebot [connections](/docs/connections/overview), please read that overview first.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
<AccordionGroup>
|
<AccordionGroup>
|
||||||
|
|
@ -103,15 +106,33 @@ Sourcebot can sync code from GitHub.com, GitHub Enterprise Server, and GitHub En
|
||||||
|
|
||||||
## Authenticating with GitHub
|
## Authenticating with GitHub
|
||||||
|
|
||||||
In order to index private repositories, you'll need to generate a GitHub Personal Access Token (PAT). Create a new PAT [here](https://github.com/settings/tokens/new) and make sure you select the `repo` scope:
|
In order to index private repositories, you'll need to generate a access token and provide it to Sourcebot. GitHub provides [two types](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#types-of-personal-access-tokens) of access tokens:
|
||||||
|
|
||||||
|
|
||||||
|
<AccordionGroup>
|
||||||
|
<Accordion title="Fine-grained personal access tokens" defaultOpen>
|
||||||
|
Create a new fine-grained PAT [here](https://github.com/settings/personal-access-tokens/new). First, select the resource owner and the repositories that you want Sourcebot to have access to.
|
||||||
|
|
||||||
|
Next, under "Repository permissions", select permissions `Contents` and `Metadata` with access `Read-only`. The permissions should look like the following:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
[GitHub docs](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#fine-grained-personal-access-tokens)
|
||||||
|
</Accordion>
|
||||||
|
<Accordion title="Personal access tokens (classic)">
|
||||||
|
Create a new PAT [here](https://github.com/settings/tokens/new) and make sure you select the `repo` scope:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Next, provide the PAT via the `token` property, either as an environment variable or a secret:
|
[GitHub docs](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#personal-access-tokens-classic)
|
||||||
|
</Accordion>
|
||||||
|
</AccordionGroup>
|
||||||
|
|
||||||
|
Next, provide the access token via the `token` property, either as an environment variable or a secret:
|
||||||
|
|
||||||
<Tabs>
|
<Tabs>
|
||||||
<Tab title="Environment Variable">
|
<Tab title="Environment Variable">
|
||||||
<Note>Environment variables are only supported in a [declarative config](/self-hosting/more/declarative-config) and cannot be used in the web UI.</Note>
|
<Note>Environment variables are only supported in a [declarative config](/docs/configuration/declarative-config) and cannot be used in the web UI.</Note>
|
||||||
|
|
||||||
1. Add the `token` property to your connection config:
|
1. Add the `token` property to your connection config:
|
||||||
```json
|
```json
|
||||||
|
|
@ -136,7 +157,7 @@ Next, provide the PAT via the `token` property, either as an environment variabl
|
||||||
</Tab>
|
</Tab>
|
||||||
|
|
||||||
<Tab title="Secret">
|
<Tab title="Secret">
|
||||||
<Note>Secrets are only supported when [authentication](/self-hosting/more/authentication) is enabled.</Note>
|
<Note>Secrets are only supported when [authentication](/docs/configuration/auth/overview) is enabled.</Note>
|
||||||
|
|
||||||
1. Navigate to **Secrets** in settings and create a new secret with your PAT:
|
1. Navigate to **Secrets** in settings and create a new secret with your PAT:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
---
|
---
|
||||||
title: Linking code from GitLab
|
title: Linking code from GitLab
|
||||||
sidebarTitle: GitLab
|
sidebarTitle: GitLab
|
||||||
|
icon: GitLab
|
||||||
---
|
---
|
||||||
|
|
||||||
import GitLabSchema from '/snippets/schemas/v3/gitlab.schema.mdx'
|
import GitLabSchema from '/snippets/schemas/v3/gitlab.schema.mdx'
|
||||||
|
|
||||||
Sourcebot can sync code from GitLab.com, Self Managed (CE & EE), and Dedicated.
|
Sourcebot can sync code from GitLab.com, Self Managed (CE & EE), and Dedicated.
|
||||||
|
|
||||||
|
If you're not familiar with Sourcebot [connections](/docs/connections/overview), please read that overview first.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
|
@ -116,7 +118,7 @@ Next, provide the PAT via the `token` property, either as an environment variabl
|
||||||
|
|
||||||
<Tabs>
|
<Tabs>
|
||||||
<Tab title="Environment Variable">
|
<Tab title="Environment Variable">
|
||||||
<Note>Environment variables are only supported in a [declarative config](/self-hosting/more/declarative-config) and cannot be used in the web UI.</Note>
|
<Note>Environment variables are only supported in a [declarative config](/docs/configuration/declarative-config) and cannot be used in the web UI.</Note>
|
||||||
|
|
||||||
1. Add the `token` property to your connection config:
|
1. Add the `token` property to your connection config:
|
||||||
```json
|
```json
|
||||||
|
|
@ -141,7 +143,7 @@ Next, provide the PAT via the `token` property, either as an environment variabl
|
||||||
</Tab>
|
</Tab>
|
||||||
|
|
||||||
<Tab title="Secret">
|
<Tab title="Secret">
|
||||||
<Note>Secrets are only supported when [authentication](/self-hosting/more/authentication) is enabled.</Note>
|
<Note>Secrets are only supported when [authentication](/docs/configuration/auth/overview) is enabled.</Note>
|
||||||
|
|
||||||
1. Navigate to **Secrets** in settings and create a new secret with your PAT:
|
1. Navigate to **Secrets** in settings and create a new secret with your PAT:
|
||||||
|
|
||||||
|
|
@ -174,6 +176,10 @@ To connect to a GitLab host other than `gitlab.com`, provide the `url` property
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
- If you're seeing errors like `GitbeakerTimeoutError: Query timeout was reached` when syncing a large number of projects, you can increase the client's timeout by setting the `GITLAB_CLIENT_QUERY_TIMEOUT_SECONDS` environment variable. [#162](https://github.com/sourcebot-dev/sourcebot/issues/162)
|
||||||
|
|
||||||
## Schema reference
|
## Schema reference
|
||||||
|
|
||||||
<Accordion title="Reference">
|
<Accordion title="Reference">
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,13 @@
|
||||||
---
|
---
|
||||||
title: Local Git repositories
|
title: Local Git repositories
|
||||||
|
icon: folder
|
||||||
---
|
---
|
||||||
|
|
||||||
import GenericGitHost from '/snippets/schemas/v3/genericGitHost.schema.mdx'
|
import GenericGitHost from '/snippets/schemas/v3/genericGitHost.schema.mdx'
|
||||||
|
|
||||||
<Note>
|
Sourcebot can sync code from generic git repositories stored in a local directory. This can be helpful in scenarios where you already have a large number of repos already checked out. Local repositories are treated as **read-only**, meaning Sourcebot will **not** `git fetch` new revisions.
|
||||||
This feature is only supported when [self-hosting](/self-hosting/overview).
|
|
||||||
</Note>
|
|
||||||
|
|
||||||
Sourcebot can sync code from generic git repositories stored in a local directory. This can be helpful in scenarios where you already have a large number of repos already checked out. Local repositories are treated as **read-only**, meaing Sourcebot will **not** `git fetch` new revisions.
|
If you're not familiar with Sourcebot [connections](/docs/connections/overview), please read that overview first.
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
|
|
@ -30,7 +29,7 @@ To get Sourcebot to index these repositories:
|
||||||
|
|
||||||
<Steps>
|
<Steps>
|
||||||
<Step title="Mount a volume">
|
<Step title="Mount a volume">
|
||||||
We need to mount a docker volume to the `repos` directory so Sourcebot can read it's contents. Sourcebot will **not** write to local repositories, so we can mount a seperate **read-only** volume:
|
We need to mount a docker volume to the `repos` directory so Sourcebot can read it's contents. Sourcebot will **not** write to local repositories, so we can mount a separate **read-only** volume:
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
docker run \
|
docker run \
|
||||||
|
|
|
||||||
|
|
@ -3,35 +3,79 @@ title: Overview
|
||||||
sidebarTitle: Overview
|
sidebarTitle: Overview
|
||||||
---
|
---
|
||||||
|
|
||||||
To connect your code to Sourcebot you create **connections**. A **connection** is a configuration object that describes how Sourcebot should fetch information from a supported code host.
|
import SupportedPlatforms from '/snippets/platform-support.mdx'
|
||||||
|
import ConfigSchema from '/snippets/schemas/v3/index.schema.mdx'
|
||||||
|
|
||||||
There are two ways to define connections:
|
A **connection** represents Sourcebot's link to a code host platform (GitHub, GitLab, etc). Connections are defined within the [config file](/docs/configuration/config-file) you provide Sourcebot.
|
||||||
|
|
||||||
<AccordionGroup>
|
Each connection defines how Sourcebot should authenticate and interact with a particular host, and which repositories to sync and index from that host. Connections are uniquely identified by their name.
|
||||||
<Accordion title="Declarative configuration file">
|
|
||||||
This is only supported when self-hosting, and is the default mechanism to define connections. Connections are defined in a [JSON file](/self-hosting/more/declarative-config)
|
|
||||||
and the path to the file is provided through the `CONFIG_PATH` environment variable
|
|
||||||
</Accordion>
|
|
||||||
<Accordion title="UI connection management">
|
|
||||||
This is the only way to define connections when using Sourcebot Cloud, and can be configured when self-hosting by enabling [authentication](/self-hosting/more/authentications).
|
|
||||||
|
|
||||||
In this method, connections are defined and managed within the webapp:
|
```json wrap icon="code" Example config with two connections
|
||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
|
||||||
|
"connections": {
|
||||||
|
// 1. A connection to GitHub.com
|
||||||
|
"github-connection": {
|
||||||
|
"type": "github",
|
||||||
|
"repos": [
|
||||||
|
"sourcebot-dev/sourcebot"
|
||||||
|
],
|
||||||
|
"token": {
|
||||||
|
"env": "GITHUB_TOKEN"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 2. A self-hosted GitLab instance
|
||||||
|
"gitlab-connection": {
|
||||||
|
"type": "gitlab",
|
||||||
|
"url": "https://gitlab.example.com",
|
||||||
|
"groups": [
|
||||||
|
"my-group",
|
||||||
|
"my-other-group/sub-group"
|
||||||
|
],
|
||||||
|
"token": {
|
||||||
|
"env": "GITLAB_TOKEN"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||

|
Configuration files must conform to the [JSON schema](#schema-reference).
|
||||||
</Accordion>
|
|
||||||
</AccordionGroup>
|
|
||||||
|
|
||||||
### Supported code hosts
|
## Connection Syncing
|
||||||
|
|
||||||
<CardGroup cols={2}>
|
When a connection is first discovered, or the `resyncConnectionIntervalMs` [setting](/docs/configuration/config-file#settings) has exceeded, the connection will be synced. This consists of:
|
||||||
<Card horizontal title="GitHub" icon="github" href="/docs/connections/github" />
|
1. Fetching the latest changes from `HEAD` (and any [additional branches](/docs/features/search/multi-branch-indexing)) from the code host.
|
||||||
<Card horizontal title="GitLab" icon="gitlab" href="/docs/connections/gitlab" />
|
2. Re-indexing the repository.
|
||||||
<Card horizontal title="Bitbucket Cloud" icon="bitbucket" href="/docs/connections/bitbucket-cloud" />
|
|
||||||
<Card horizontal title="Bitbucket Data Center" icon="bitbucket" href="/docs/connections/bitbucket-data-center" />
|
This is processed in a [job queue](/docs/overview#architecture), and is parallelized across multiple worker processes. Jobs will take longer to complete the first time a repository is synced, or when a diff is large.
|
||||||
<Card horizontal title="Gitea" href="/docs/connections/gitea" />
|
|
||||||
<Card horizontal title="Gerrit" href="/docs/connections/gerrit" />
|
On the home page, you can view the sync status of ongoing jobs:
|
||||||
<Card horizontal title="Other Git hosts" icon="git-alt" href="/docs/connections/generic-git-host" />
|
|
||||||
<Card horizontal title="Local Git repos" icon="folder" href="/docs/connections/local-repos" />
|
<video
|
||||||
</CardGroup>
|
autoPlay
|
||||||
|
muted
|
||||||
|
loop
|
||||||
|
playsInline
|
||||||
|
className="w-full aspect-video"
|
||||||
|
src="https://framerusercontent.com/assets/7YyxK8ctPEy9Rf68X2kIdMI.mp4"
|
||||||
|
></video>
|
||||||
|
|
||||||
|
## Platform Connection Guides
|
||||||
|
|
||||||
|
To learn more about how to create a connection for a specific code host, check out the guides below.
|
||||||
|
|
||||||
|
<SupportedPlatforms />
|
||||||
|
|
||||||
<Note>Missing your code host? [Submit a feature request on GitHub](https://github.com/sourcebot-dev/sourcebot/discussions/categories/ideas).</Note>
|
<Note>Missing your code host? [Submit a feature request on GitHub](https://github.com/sourcebot-dev/sourcebot/discussions/categories/ideas).</Note>
|
||||||
|
|
||||||
|
|
||||||
|
## Schema reference
|
||||||
|
---
|
||||||
|
|
||||||
|
<Accordion title="Reference">
|
||||||
|
[schemas/v3/index.json](https://github.com/sourcebot-dev/sourcebot/blob/main/schemas/v3/index.json)
|
||||||
|
|
||||||
|
<ConfigSchema />
|
||||||
|
|
||||||
|
</Accordion>
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
sidebarTitle: Request another host
|
sidebarTitle: Request another host
|
||||||
url: https://github.com/sourcebot-dev/sourcebot/discussions/categories/ideas
|
url: https://github.com/sourcebot-dev/sourcebot/discussions/categories/ideas
|
||||||
title: Request another code host
|
title: Request another code host
|
||||||
|
icon: plus
|
||||||
---
|
---
|
||||||
|
|
||||||
Is your code host not supported? Please open a [feature request](https://github.com/sourcebot-dev/sourcebot/discussions/categories/ideas).
|
Is your code host not supported? Please open a [feature request](https://github.com/sourcebot-dev/sourcebot/discussions/categories/ideas).
|
||||||
89
docs/docs/deployment-guide.mdx
Normal file
|
|
@ -0,0 +1,89 @@
|
||||||
|
---
|
||||||
|
title: "Deployment guide"
|
||||||
|
---
|
||||||
|
|
||||||
|
import SupportedPlatforms from '/snippets/platform-support.mdx'
|
||||||
|
|
||||||
|
The following guide will walk you through the steps to deploy Sourcebot on your own infrastructure. Sourcebot is distributed as a [single docker container](/docs/overview#architecture) that can be deployed to a k8s cluster, a VM, or any platform that supports docker.
|
||||||
|
|
||||||
|
|
||||||
|
<Note>Hit an issue? Please let us know on [GitHub discussions](https://github.com/sourcebot-dev/sourcebot/discussions/categories/support) or by [emailing us](mailto:team@sourcebot.dev).</Note>
|
||||||
|
|
||||||
|
<Steps>
|
||||||
|
<Step title="Requirements">
|
||||||
|
- Docker -> use [Docker Desktop](https://www.docker.com/products/docker-desktop/) on Mac or Windows.
|
||||||
|
</Step>
|
||||||
|
<Step title="Create a config.json">
|
||||||
|
Create a `config.json` file that tells Sourcebot which repositories to sync and index:
|
||||||
|
|
||||||
|
```bash wrap icon="terminal" Create example config
|
||||||
|
touch config.json
|
||||||
|
echo '{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
|
||||||
|
"connections": {
|
||||||
|
// comments are supported
|
||||||
|
"starter-connection": {
|
||||||
|
"type": "github",
|
||||||
|
"repos": [
|
||||||
|
"sourcebot-dev/sourcebot"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}' > config.json
|
||||||
|
```
|
||||||
|
|
||||||
|
This config creates a single GitHub connection named `starter-connection` that specifies [Sourcebot](https://github.com/sourcebot-dev/sourcebot) as a repo to sync. [Learn more about the config file](/docs/connections/overview).
|
||||||
|
</Step>
|
||||||
|
|
||||||
|
<Step title="Launch your instance">
|
||||||
|
<Warning>If you're deploying Sourcebot behind a domain, you must set the [AUTH_URL](/docs/configuration/environment-variables) environment variable.</Warning>
|
||||||
|
|
||||||
|
|
||||||
|
In the same directory as `config.json`, run the following command to start your instance:
|
||||||
|
|
||||||
|
``` bash icon="terminal" Start the Sourcebot container
|
||||||
|
docker run \
|
||||||
|
-p 3000:3000 \
|
||||||
|
--pull=always \
|
||||||
|
--rm \
|
||||||
|
-v $(pwd):/data \
|
||||||
|
-e CONFIG_PATH=/data/config.json \
|
||||||
|
--name sourcebot \
|
||||||
|
ghcr.io/sourcebot-dev/sourcebot:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
<Accordion title="Details">
|
||||||
|
**This command**:
|
||||||
|
- pulls the latest version of the `sourcebot` docker image.
|
||||||
|
- mounts the working directory to `/data` in the container to allow Sourcebot to persist data across restarts, and to access the `config.json`. In your local directory, you should see a `.sourcebot` folder created that contains all persistent data.
|
||||||
|
- runs any pending database migrations.
|
||||||
|
- starts up all services, including the webserver exposed on port 3000.
|
||||||
|
- reads `config.json` and starts syncing.
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
|
</Step>
|
||||||
|
|
||||||
|
<Step title="Complete onboarding">
|
||||||
|
Navigate to `http://localhost:3000` and complete the onboarding flow.
|
||||||
|
|
||||||
|
<Note>
|
||||||
|
By default, only email / password authentication is enabled. [Learn more about authentication](/docs/configuration/auth/overview).
|
||||||
|
</Note>
|
||||||
|
</Step>
|
||||||
|
|
||||||
|
<Step title="Done">
|
||||||
|
You're all set! If you'd like to setup [Ask Sourcebot](/docs/features/ask/overview), configure a language model [provider](/docs/configuration/language-model-providers)
|
||||||
|
</Step>
|
||||||
|
</Steps>
|
||||||
|
|
||||||
|
## Next steps
|
||||||
|
---
|
||||||
|
|
||||||
|
<CardGroup cols={2}>
|
||||||
|
<Card title="Connecting your code" icon="code" href="/docs/connections/overview">
|
||||||
|
Learn more about how to connect your code to Sourcebot.
|
||||||
|
</Card>
|
||||||
|
<Card title="Setup other authentication providers" icon="lock" href="/docs/configuration/auth/overview">
|
||||||
|
Learn more about how to setup SSO, email codes, and other authentication providers.
|
||||||
|
</Card>
|
||||||
|
</CardGroup>
|
||||||
|
|
@ -3,15 +3,15 @@ title: "Agents Overview"
|
||||||
sidebarTitle: "Overview"
|
sidebarTitle: "Overview"
|
||||||
---
|
---
|
||||||
|
|
||||||
<Note>
|
<Warning>
|
||||||
Have an idea for an agent that we haven't built? Submit a [feature request](https://github.com/sourcebot-dev/sourcebot/discussions/categories/feature-requests) on our GitHub
|
Agents are currently a experimental feature. Have an idea for an agent that we haven't built? Submit a [feature request](https://github.com/sourcebot-dev/sourcebot/discussions/categories/feature-requests) on our GitHub.
|
||||||
</Note>
|
</Warning>
|
||||||
|
|
||||||
Agents are automations that leverage the code indexed on Sourcebot to perform a specific task. Once you've setup Sourcebot, check out the
|
Agents are automations that leverage the code indexed on Sourcebot to perform a specific task. Once you've setup Sourcebot, check out the
|
||||||
guides below to configure additional agents.
|
guides below to configure additional agents.
|
||||||
|
|
||||||
<CardGroup cols={2}>
|
<CardGroup cols={2}>
|
||||||
<Card horizontal title="Review Agent" icon="gear" href="/docs/agents/review-agent">
|
<Card horizontal title="Review Agent" icon="gear" href="/docs/features/agents/review-agent">
|
||||||
An AI agent that reviews your PRs to identify issues
|
An AI agent that reviews your PRs to identify issues
|
||||||
</Card>
|
</Card>
|
||||||
</CardGroup>
|
</CardGroup>
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
title: AI Code Review Agent
|
title: AI Code Review Agent
|
||||||
sidebarTitle: AI Code Review Agent
|
sidebarTitle: AI code review agent
|
||||||
---
|
---
|
||||||
|
|
||||||
<Note>
|
<Note>
|
||||||
|
|
@ -10,7 +10,7 @@ codebase that the agent may fetch to perform the review.
|
||||||
|
|
||||||
This agent provides codebase-aware reviews for your PRs. For each diff, this agent fetches relevant context from Sourcebot and feeds it into an LLM for a detailed review of your changes.
|
This agent provides codebase-aware reviews for your PRs. For each diff, this agent fetches relevant context from Sourcebot and feeds it into an LLM for a detailed review of your changes.
|
||||||
|
|
||||||
The AI Code Review Agent is [open source](https://github.com/sourcebot-dev/sourcebot/tree/main/packages/web/src/features/agents/review-agent) and packaged in [Sourcebot](https://github.com/sourcebot-dev/sourcebot). To get started using this agent, [deploy Sourcebot](/self-hosting/overview)
|
The AI Code Review Agent is [open source](https://github.com/sourcebot-dev/sourcebot/tree/main/packages/web/src/features/agents/review-agent) and packaged in [Sourcebot](https://github.com/sourcebot-dev/sourcebot). To get started using this agent, [deploy Sourcebot](/docs/deployment-guide)
|
||||||
and then follow the configuration instructions below.
|
and then follow the configuration instructions below.
|
||||||
|
|
||||||

|

|
||||||
|
|
@ -53,6 +53,7 @@ Before you get started, make sure you have an OpenAPI account that you can creat
|
||||||
directory that you mount to Sourcebot
|
directory that you mount to Sourcebot
|
||||||

|

|
||||||
- `OPENAI_API_KEY`: Your OpenAI API key
|
- `OPENAI_API_KEY`: Your OpenAI API key
|
||||||
|
- `REVIEW_AGENT_API_KEY`: The Sourcebot API key that the review agent uses to hit the Sourcebot API to fetch code context
|
||||||
- `REVIEW_AGENT_AUTO_REVIEW_ENABLED` (default: `false`): If enabled, the review agent will automatically review any new or updated PR. If disabled, you must invoke it using the command defined by `REVIEW_AGENT_REVIEW_COMMAND`
|
- `REVIEW_AGENT_AUTO_REVIEW_ENABLED` (default: `false`): If enabled, the review agent will automatically review any new or updated PR. If disabled, you must invoke it using the command defined by `REVIEW_AGENT_REVIEW_COMMAND`
|
||||||
- `REVIEW_AGENT_REVIEW_COMMAND` (default: `review`): The command that invokes the review agent (ex. `/review`) when a user comments on the PR. Don't include the slash character in this value.
|
- `REVIEW_AGENT_REVIEW_COMMAND` (default: `review`): The command that invokes the review agent (ex. `/review`) when a user comments on the PR. Don't include the slash character in this value.
|
||||||
|
|
||||||
|
|
@ -76,6 +77,7 @@ Before you get started, make sure you have an OpenAPI account that you can creat
|
||||||
GITHUB_APP_ID: "my-github-app-id"
|
GITHUB_APP_ID: "my-github-app-id"
|
||||||
GITHUB_APP_WEBHOOK_SECRET: "my-github-app-webhook-secret"
|
GITHUB_APP_WEBHOOK_SECRET: "my-github-app-webhook-secret"
|
||||||
GITHUB_APP_PRIVATE_KEY_PATH: "/data/review-agent-key.pem"
|
GITHUB_APP_PRIVATE_KEY_PATH: "/data/review-agent-key.pem"
|
||||||
|
REVIEW_AGENT_API_KEY: "sourcebot-my-key"
|
||||||
OPENAI_API_KEY: "sk-proj-my-open-api-key"
|
OPENAI_API_KEY: "sk-proj-my-open-api-key"
|
||||||
```
|
```
|
||||||
</Step>
|
</Step>
|
||||||
51
docs/docs/features/analytics.mdx
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
---
|
||||||
|
title: Analytics
|
||||||
|
sidebarTitle: Analytics
|
||||||
|
---
|
||||||
|
|
||||||
|
import LicenseKeyRequired from '/snippets/license-key-required.mdx'
|
||||||
|
import { Callout } from 'nextra/components'
|
||||||
|
|
||||||
|
<LicenseKeyRequired />
|
||||||
|
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
Analytics provides comprehensive insights into your organization's usage of Sourcebot, helping you understand adoption patterns and
|
||||||
|
quantify the value of time saved.
|
||||||
|
|
||||||
|
This dashboard is backed by [audit log](/docs/configuration/audit-logs) events. Please ensure you have audit logging enabled in order to see these insights.
|
||||||
|
|
||||||
|
<video
|
||||||
|
autoPlay
|
||||||
|
muted
|
||||||
|
loop
|
||||||
|
playsInline
|
||||||
|
className="w-full aspect-video"
|
||||||
|
src="/images/analytics_demo.mp4"
|
||||||
|
></video>
|
||||||
|
|
||||||
|
## Data Metrics
|
||||||
|
|
||||||
|
### Active Users
|
||||||
|
Tracks the number of unique users who performed any Sourcebot operation within each time period. This metric helps you understand team adoption
|
||||||
|
and engagement with Sourcebot.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Code Searches
|
||||||
|
Counts the number of code search operations performed by your team.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Code Navigation
|
||||||
|
Tracks "Go to Definition" and "Find All References" navigation actions. Navigation actions help developers quickly move
|
||||||
|
between code locations and understand code relationships.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Cost Savings Calculator
|
||||||
|
|
||||||
|
The analytics dashboard includes a built-in cost savings calculator that helps you quantify the ROI of using Sourcebot.
|
||||||
|
|
||||||
|

|
||||||
5
docs/docs/features/ask/add-model-providers.mdx
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
sidebarTitle: Configure language models
|
||||||
|
url: /docs/configuration/language-model-providers
|
||||||
|
title: Configure Language Models
|
||||||
|
---
|
||||||
56
docs/docs/features/ask/overview.mdx
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
---
|
||||||
|
title: Overview
|
||||||
|
---
|
||||||
|
|
||||||
|
Ask Sourcebot gives you the ability to ask complex questions about your codebase in natural language.
|
||||||
|
|
||||||
|
It uses Sourcebot’s existing [code search](/docs/features/search/overview) and [navigation](/docs/features/code-navigation) tools to allow reasoning models to search your code,
|
||||||
|
follow code nav references, and provide an answer that’s rich with inline citations and navigable code snippets.
|
||||||
|
|
||||||
|
<CardGroup>
|
||||||
|
<Card title="Configure language models" icon="robot" href="/docs/configuration/language-model-providers" horizontal="true">
|
||||||
|
Learn how to connect your language model to Sourcebot
|
||||||
|
</Card>
|
||||||
|
<Card title="Index repos" icon="book" href="/docs/connections/overview" horizontal="true">
|
||||||
|
Learn how to index your repos so you can ask questions about them
|
||||||
|
</Card>
|
||||||
|
<Card title="Deployment guide" icon="server" href="/docs/deployment-guide" horizontal="true">
|
||||||
|
Learn how to self-host Sourcebot in a few simple steps.
|
||||||
|
</Card>
|
||||||
|
<Card title="Public demo" icon="globe" href="https://demo.sourcebot.dev/" horizontal="true">
|
||||||
|
Try Ask Sourcebot on our public demo instance.
|
||||||
|
</Card>
|
||||||
|
</CardGroup>
|
||||||
|
|
||||||
|
<video
|
||||||
|
autoPlay
|
||||||
|
muted
|
||||||
|
loop
|
||||||
|
playsInline
|
||||||
|
className="w-full aspect-video"
|
||||||
|
src="/images/ask_sourcebot_low_res.mp4"
|
||||||
|
></video>
|
||||||
|
|
||||||
|
# Why do we need another AI dev tool?
|
||||||
|
|
||||||
|
Existing AI dev tools (Cursor, Claude Code, Copilot) are great at generating code. However, we believe one of the hardest parts of being
|
||||||
|
a software engineer is **understanding code**.
|
||||||
|
|
||||||
|
In this domain, these tools fall short:
|
||||||
|
- You can only ask questions about the code you have checked out locally
|
||||||
|
- You get a wall of text that's difficult to parse, requiring you to go back and forth through different code snippets in the response
|
||||||
|
- The richness of the explanation is limited by the fact that you're in your IDE
|
||||||
|
|
||||||
|
We built Ask Sourcebot to address these problems. With Ask Sourcebot, you can:
|
||||||
|
- Ask questions about your teams entire codebase (even on repos you don't have locally)
|
||||||
|
- Easily parse the response with side-by-side citations and code navigation
|
||||||
|
- Share answers with your team to spread the knowledge
|
||||||
|
|
||||||
|
Being a web app is less convenient than being in your IDE, but it allows Sourcebot to provide responses in a richer UI that isn't constrained by the IDE.
|
||||||
|
|
||||||
|
We believe this experience of understanding your codebase is superior, and we hope you find it useful. We'd love to know what you think! Feel free to join the discussion on our
|
||||||
|
[GitHub](https://github.com/sourcebot-dev/sourcebot/discussions).
|
||||||
|
|
||||||
|
# Troubleshooting
|
||||||
|
|
||||||
|
- **Network timeouts**: If you are hitting generic "network error" message while the answer is streaming when Sourcebot is deployed in a production environment, it may be due to your load balancer or proxy not being configured to handle long-lived connections. The timeout should be configured to a sufficiently large value (e.g., 5 minutes).
|
||||||
43
docs/docs/features/code-navigation.mdx
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
---
|
||||||
|
title: Code navigation
|
||||||
|
sidebarTitle: Code navigation
|
||||||
|
---
|
||||||
|
|
||||||
|
import SearchContextSchema from '/snippets/schemas/v3/searchContext.schema.mdx'
|
||||||
|
import LicenseKeyRequired from '/snippets/license-key-required.mdx'
|
||||||
|
|
||||||
|
<LicenseKeyRequired />
|
||||||
|
|
||||||
|
**Code navigation** allows you to jump between symbol definition and references when viewing source files in Sourcebot. This feature is enabled **automatically** when a valid license key is present and works with all popular programming languages.
|
||||||
|
|
||||||
|
|
||||||
|
<video src="https://framerusercontent.com/assets/B9ZxrlsUeO9NJyzkKyvVV2KSU4.mp4" className="w-full aspect-video" controls></video>
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
| Feature | Description |
|
||||||
|
|:--------|:------------|
|
||||||
|
| **Hover popover** | Hovering over a symbol reveals the symbol's definition signature as a inline preview. |
|
||||||
|
| **Go to definition** | Clicking the "go to definition" button in the popover or clicking the symbol name navigates to the symbol's definition. |
|
||||||
|
| **Find references** | Clicking the "find all references" button in the popover lists all references in the explore panel. |
|
||||||
|
| **Explore panel** | Lists all references and definitions for the symbol selected in the popover. |
|
||||||
|
|
||||||
|
## How does it work?
|
||||||
|
|
||||||
|
Code navigation is **search-based**, meaning it uses the same code search engine and [query language](/docs/features/search/syntax-reference) to estimate a symbol's references and definitions. We refer to these estimations as "search heuristics". We have two search heuristics to enable the following operations:
|
||||||
|
|
||||||
|
### Find references
|
||||||
|
Given a `symbolName`, along with information about the file the symbol is contained within (`git_revision`, and `language`), runs the following search:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
\\b{symbolName}\\b rev:{git_revision} lang:{language} case:yes
|
||||||
|
```
|
||||||
|
|
||||||
|
### Find definitions
|
||||||
|
Given a `symbolName`, along with information about the file the symbol is contained within (`git_revision`, and `language`), runs the following search:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sym:\\b{symbolName}\\b rev:{git_revision} lang:{language}
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that the `sym:` prefix is used to filter the search by symbol definitions. These are created at index time by [universal ctags](https://ctags.io/).
|
||||||
|
|
@ -3,21 +3,25 @@ title: Sourcebot MCP server (@sourcebot/mcp)
|
||||||
sidebarTitle: Sourcebot MCP server
|
sidebarTitle: Sourcebot MCP server
|
||||||
---
|
---
|
||||||
|
|
||||||
<Note>
|
|
||||||
This feature is only available when [self-hosting](/self-hosting) with [authentication](/self-hosting/more/authentication) disabled.
|
|
||||||
</Note>
|
|
||||||
|
|
||||||
The [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) is an open standard for providing context to LLMs. The [@sourcebot/mcp](https://www.npmjs.com/package/@sourcebot/mcp) package is a MCP server that enables LLMs to interface with your Sourcebot instance, enabling MCP clients like Cursor, Vscode, and others to have context over your entire codebase.
|
The [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) is an open standard for providing context to LLMs. The [@sourcebot/mcp](https://www.npmjs.com/package/@sourcebot/mcp) package is a MCP server that enables LLMs to interface with your Sourcebot instance, enabling MCP clients like Cursor, Vscode, and others to have context over your entire codebase.
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
<Steps>
|
<Steps>
|
||||||
<Step title="Launch Sourcebot">
|
<Step title="Launch Sourcebot">
|
||||||
Follow the self-hosting [quick start guide](/self-hosting/overview#quick-start-guide) to launch Sourcebot and get your code indexed. The host url of your instance (e.g., `http://localhost:3000`) is passed to the MCP server via the `SOURCEBOT_HOST` url.
|
Follow the [deployment guide](/docs/deployment-guide) to launch Sourcebot and get your code indexed. The host url of your instance (e.g., `http://localhost:3000`) is passed to the MCP server via the `SOURCEBOT_HOST` url.
|
||||||
|
|
||||||
If a host is not provided, then the server will fallback to using the demo instance hosted at https://demo.sourcebot.dev. You can see the list of repositories indexed [here](https://demo.sourcebot.dev/~/repos). Add additional repositories by [opening a PR](https://github.com/sourcebot-dev/sourcebot/blob/main/demo-site-config.json).
|
If a host is not provided, then the server will fallback to using the demo instance hosted at https://demo.sourcebot.dev. You can see the list of repositories indexed [here](https://demo.sourcebot.dev/~/repos). Add additional repositories by [opening a PR](https://github.com/sourcebot-dev/sourcebot/blob/main/demo-site-config.json).
|
||||||
</Step>
|
</Step>
|
||||||
|
|
||||||
|
<Step title="Create an API key">
|
||||||
|
Create an API key to allow the MCP server to query your Sourcebot instance. To create an API key, login to your Sourcebot instance and navigate to **Settings -> API Keys**:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Copy the API key and set it as the `SOURCEBOT_API_KEY` environment variable.
|
||||||
|
</Step>
|
||||||
|
|
||||||
<Step title="Install the MCP server">
|
<Step title="Install the MCP server">
|
||||||
<Note>
|
<Note>
|
||||||
Ensure you have [Node.js](https://nodejs.org/en) >= v18.0.0 installed.
|
Ensure you have [Node.js](https://nodejs.org/en) >= v18.0.0 installed.
|
||||||
|
|
@ -39,7 +43,8 @@ The [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP)
|
||||||
"command": "npx",
|
"command": "npx",
|
||||||
"args": ["-y", "@sourcebot/mcp@latest" ],
|
"args": ["-y", "@sourcebot/mcp@latest" ],
|
||||||
"env": {
|
"env": {
|
||||||
"SOURCEBOT_HOST": "http://localhost:3000"
|
"SOURCEBOT_HOST": "http://localhost:3000",
|
||||||
|
"SOURCEBOT_API_KEY": "your-api-key"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -62,7 +67,8 @@ The [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP)
|
||||||
"command": "npx",
|
"command": "npx",
|
||||||
"args": ["-y", "@sourcebot/mcp@latest" ],
|
"args": ["-y", "@sourcebot/mcp@latest" ],
|
||||||
"env": {
|
"env": {
|
||||||
"SOURCEBOT_HOST": "http://localhost:3000"
|
"SOURCEBOT_HOST": "http://localhost:3000",
|
||||||
|
"SOURCEBOT_API_KEY": "your-api-key"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -75,19 +81,18 @@ The [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP)
|
||||||
<Accordion title="VS Code">
|
<Accordion title="VS Code">
|
||||||
[VS Code MCP docs](https://code.visualstudio.com/docs/copilot/chat/mcp-servers)
|
[VS Code MCP docs](https://code.visualstudio.com/docs/copilot/chat/mcp-servers)
|
||||||
|
|
||||||
Add the following to your [settings.json](https://code.visualstudio.com/docs/copilot/chat/mcp-servers):
|
Add the following to your [.vscode/mcp.json](https://code.visualstudio.com/docs/copilot/chat/mcp-servers#_add-an-mcp-server-to-your-workspace) file:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"mcp": {
|
|
||||||
"servers": {
|
"servers": {
|
||||||
"sourcebot": {
|
"sourcebot": {
|
||||||
"type": "stdio",
|
"type": "stdio",
|
||||||
"command": "npx",
|
"command": "npx",
|
||||||
"args": ["-y", "@sourcebot/mcp@latest"]
|
"args": ["-y", "@sourcebot/mcp@latest"],
|
||||||
},
|
|
||||||
"env": {
|
"env": {
|
||||||
"SOURCEBOT_HOST": "http://localhost:3000"
|
"SOURCEBOT_HOST": "http://localhost:3000",
|
||||||
|
"SOURCEBOT_API_KEY": "your-api-key"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -102,7 +107,7 @@ The [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP)
|
||||||
Run the following command:
|
Run the following command:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
claude mcp add sourcebot -e SOURCEBOT_HOST=http://localhost:3000 -- npx -y @sourcebot/mcp@latest
|
claude mcp add sourcebot -e SOURCEBOT_HOST=http://localhost:3000 -e SOURCEBOT_API_KEY=your-api-key -- npx -y @sourcebot/mcp@latest
|
||||||
```
|
```
|
||||||
|
|
||||||
Replace `http://localhost:3000` with wherever your Sourcebot instance is hosted.
|
Replace `http://localhost:3000` with wherever your Sourcebot instance is hosted.
|
||||||
|
|
@ -119,7 +124,8 @@ The [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP)
|
||||||
"command": "npx",
|
"command": "npx",
|
||||||
"args": ["-y", "@sourcebot/mcp@latest"],
|
"args": ["-y", "@sourcebot/mcp@latest"],
|
||||||
"env": {
|
"env": {
|
||||||
"SOURCEBOT_HOST": "http://localhost:3000"
|
"SOURCEBOT_HOST": "http://localhost:3000",
|
||||||
|
"SOURCEBOT_API_KEY": "your-api-key"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -176,6 +182,7 @@ Parameters:
|
||||||
| Name | Default | Description |
|
| Name | Default | Description |
|
||||||
|:-------------------------|:-----------------------|:--------------------------------------------------|
|
|:-------------------------|:-----------------------|:--------------------------------------------------|
|
||||||
| `SOURCEBOT_HOST` | http://localhost:3000 | URL of your Sourcebot instance. |
|
| `SOURCEBOT_HOST` | http://localhost:3000 | URL of your Sourcebot instance. |
|
||||||
|
| `SOURCEBOT_API_KEY` | - | Sourcebot API key. |
|
||||||
| `DEFAULT_MINIMUM_TOKENS` | 10000 | Minimum number of tokens to return in responses. |
|
| `DEFAULT_MINIMUM_TOKENS` | 10000 | Minimum number of tokens to return in responses. |
|
||||||
| `DEFAULT_MATCHES` | 10000 | Number of code matches to fetch per search. |
|
| `DEFAULT_MATCHES` | 10000 | Number of code matches to fetch per search. |
|
||||||
| `DEFAULT_CONTEXT_LINES` | 5 | Lines of context to include above/below matches. |
|
| `DEFAULT_CONTEXT_LINES` | 5 | Lines of context to include above/below matches. |
|
||||||
|
|
@ -15,7 +15,7 @@ By default, only the default branch of a repository is indexed and can be search
|
||||||
Multi-branch indexing is currently limited to 64 branches and tags. If this limitation impacts your use-case, please [open a discussion](https://github.com/sourcebot-dev/sourcebot/discussions/categories/support).
|
Multi-branch indexing is currently limited to 64 branches and tags. If this limitation impacts your use-case, please [open a discussion](https://github.com/sourcebot-dev/sourcebot/discussions/categories/support).
|
||||||
</Warning>
|
</Warning>
|
||||||
|
|
||||||
Multi-branch indexing is configured on in the [connection](/docs/connections/overview) using the `revisions.branches` and `revisions.tags` arrays. Glob patterns are supported. For example:
|
Multi-branch indexing is configured in the [connection](/docs/connections/overview) using the `revisions.branches` and `revisions.tags` arrays. Glob patterns are supported. For example:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
40
docs/docs/features/search/overview.mdx
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
---
|
||||||
|
title: Overview
|
||||||
|
---
|
||||||
|
|
||||||
|
Search across all your repos/branches across any code host platform. Blazingly fast, and supports regular expressions, repo/language search filters, boolean logic, and more.
|
||||||
|
|
||||||
|
<Accordion title="Key benefits">
|
||||||
|
- **Regex support:** Use regular expressions to find code with precision.
|
||||||
|
- **Query language:** Scope searches to specific files, repos, languages, symbol definitions and more using a rich [query language](/docs/features/search/syntax-reference).
|
||||||
|
- **Branch search:** Specify a list of branches to search across ([docs](/docs/features/search/multi-branch-indexing)).
|
||||||
|
- **Fast & scalable:** Sourcebot uses [trigram indexing](https://en.wikipedia.org/wiki/Trigram_search), allowing it to scale to massive codebases.
|
||||||
|
- **Syntax highlighting:** Syntax highlighting support for over [100+ languages](https://github.com/sourcebot-dev/sourcebot/blob/57724689303f351c279d37f45b6406f1d5d5d5ab/packages/web/src/lib/codemirrorLanguage.ts#L125).
|
||||||
|
- **Multi-repository:** Search across all of your repositories in a single search.
|
||||||
|
- **Search suggestions:** Get search suggestions as you craft your query.
|
||||||
|
- **Filter panel:** Filter results by repository or by language.
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
|
<CardGroup>
|
||||||
|
<Card title="Index repos" icon="book" href="/docs/connections/overview" horizontal="true">
|
||||||
|
Learn how to index your repos so you can ask questions about them
|
||||||
|
</Card>
|
||||||
|
<Card title="Branches" icon="split" href="/docs/features/search/multi-branch-indexing" horizontal="true">
|
||||||
|
Learn how to index and search through your branches
|
||||||
|
</Card>
|
||||||
|
<Card title="Deployment guide" icon="server" href="/docs/deployment-guide" horizontal="true">
|
||||||
|
Learn how to self-host Sourcebot in a few simple steps.
|
||||||
|
</Card>
|
||||||
|
<Card title="Public demo" icon="globe" href="https://demo.sourcebot.dev/" horizontal="true">
|
||||||
|
Try Sourcebot's code search on our public demo instance.
|
||||||
|
</Card>
|
||||||
|
</CardGroup>
|
||||||
|
|
||||||
|
<video
|
||||||
|
autoPlay
|
||||||
|
muted
|
||||||
|
loop
|
||||||
|
playsInline
|
||||||
|
className="w-full aspect-video"
|
||||||
|
src="https://framerusercontent.com/assets/cEqHNSLiMbNeG3bk5xheQWXmKqc.mp4"
|
||||||
|
></video>
|
||||||
|
|
@ -1,13 +1,12 @@
|
||||||
---
|
---
|
||||||
title: Search contexts
|
title: Search contexts
|
||||||
sidebarTitle: Search contexts (EE)
|
sidebarTitle: Search contexts
|
||||||
---
|
---
|
||||||
|
|
||||||
import SearchContextSchema from '/snippets/schemas/v3/searchContext.schema.mdx'
|
import SearchContextSchema from '/snippets/schemas/v3/searchContext.schema.mdx'
|
||||||
|
import LicenseKeyRequired from '/snippets/license-key-required.mdx'
|
||||||
|
|
||||||
<Note>
|
<LicenseKeyRequired />
|
||||||
This feature is only available when [self-hosting](/self-hosting) with an active Enterprise license. Please add your [license key](/self-hosting/license-key) to activate it.
|
|
||||||
</Note>
|
|
||||||
|
|
||||||
A **search context** is a user-defined grouping of repositories that helps focus searches on specific areas of your codebase, like frontend, backend, or infrastructure code. Some example queries using search contexts:
|
A **search context** is a user-defined grouping of repositories that helps focus searches on specific areas of your codebase, like frontend, backend, or infrastructure code. Some example queries using search contexts:
|
||||||
|
|
||||||
|
|
@ -16,7 +15,7 @@ A **search context** is a user-defined grouping of repositories that helps focus
|
||||||
- `( context:project1 or context:project2 ) logger\.debug` - search for debug log calls in project1 and project2
|
- `( context:project1 or context:project2 ) logger\.debug` - search for debug log calls in project1 and project2
|
||||||
|
|
||||||
|
|
||||||
Search contexts are defined in the `context` object inside of a [declarative config](/self-hosting/more/declarative-config). Repositories can be included / excluded from a search context by specifying the repo's URL in either the `include` array or `exclude` array. Glob patterns are supported.
|
Search contexts are defined in the `context` object inside of a [declarative config](/docs/configuration/declarative-config). Repositories can be included / excluded from a search context by specifying the repo's URL in either the `include` array or `exclude` array. Glob patterns are supported.
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
|
|
@ -41,7 +40,7 @@ shared/
|
||||||
├─ ...
|
├─ ...
|
||||||
```
|
```
|
||||||
|
|
||||||
To make searching easier, we can create three search contexts in our [config.json](/self-hosting/more/declarative-config):
|
To make searching easier, we can create three search contexts in our [config.json](/docs/configuration/declarative-config):
|
||||||
- `web`: For all frontend-related code
|
- `web`: For all frontend-related code
|
||||||
- `backend`: For backend services and shared APIs
|
- `backend`: For backend services and shared APIs
|
||||||
- `pipelines`: For all CI/CD configurations
|
- `pipelines`: For all CI/CD configurations
|
||||||
|
|
@ -105,7 +104,7 @@ Like other prefixes, contexts can be negated using `-` or combined using `or`:
|
||||||
- `-context:web` excludes frontend repositories from results
|
- `-context:web` excludes frontend repositories from results
|
||||||
- `( context:web or context:backend )` searches across both frontend and backend code
|
- `( context:web or context:backend )` searches across both frontend and backend code
|
||||||
|
|
||||||
See [this doc](/docs/search/syntax-reference) for more details on the search query syntax.
|
See [this doc](/docs/features/search/syntax-reference) for more details on the search query syntax.
|
||||||
|
|
||||||
## Schema reference
|
## Schema reference
|
||||||
|
|
||||||
|
|
@ -32,4 +32,4 @@ Expressions can be prefixed with certain keywords to modify search behavior. Som
|
||||||
| `rev:` | Filter results from a specific branch or tag. By default **only** the default branch is searched. | `rev:beta` - Filter results to branches that match regex `/beta/` |
|
| `rev:` | Filter results from a specific branch or tag. By default **only** the default branch is searched. | `rev:beta` - Filter results to branches that match regex `/beta/` |
|
||||||
| `lang:` | Filter results by language (as defined by [linguist](https://github.com/github-linguist/linguist/blob/main/lib/linguist/languages.yml)). By default all languages are searched. | `lang:TypeScript` - Filter results to TypeScript files<br/>`-lang:YAML` - Ignore results from YAML files |
|
| `lang:` | Filter results by language (as defined by [linguist](https://github.com/github-linguist/linguist/blob/main/lib/linguist/languages.yml)). By default all languages are searched. | `lang:TypeScript` - Filter results to TypeScript files<br/>`-lang:YAML` - Ignore results from YAML files |
|
||||||
| `sym:` | Match symbol definitions created by [universal ctags](https://ctags.io/) at index time. | `sym:\bmain\b` - Filter results to symbols that match regex `/\bmain\b/` |
|
| `sym:` | Match symbol definitions created by [universal ctags](https://ctags.io/) at index time. | `sym:\bmain\b` - Filter results to symbols that match regex `/\bmain\b/` |
|
||||||
| `context:` | Filter results to a predefined [search context](/docs/search/search-contexts). | `context:web` - Filter results to the web context<br/>`-context:pipelines` - Ignore results from the pipelines context |
|
| `context:` | Filter results to a predefined [search context](/docs/features/search/search-contexts). | `context:web` - Filter results to the web context<br/>`-context:pipelines` - Ignore results from the pipelines context |
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
---
|
|
||||||
sidebarTitle: Quick start guide (self-host)
|
|
||||||
url: /self-hosting/overview
|
|
||||||
---
|
|
||||||
|
|
||||||
{/*This page acts as a navigation link*/}
|
|
||||||
|
|
||||||
[Quick start guide (self-host)](/self-hosting/overview)
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
||||||
---
|
|
||||||
title: Cloud quick start guide
|
|
||||||
sidebarTitle: Quick start guide (cloud)
|
|
||||||
---
|
|
||||||
|
|
||||||
<Note>Looking for a self-hosted solution? Checkout our [self-hosting docs](/self-hosting/overview).</Note>
|
|
||||||
|
|
||||||
This page will provide a quick walkthrough of how to get onboarded on Sourcebot, import your code, and start searching.
|
|
||||||
|
|
||||||
{/*@todo: record a quick start guide
|
|
||||||
<iframe
|
|
||||||
width="560"
|
|
||||||
height="315"
|
|
||||||
src="https://www.youtube.com/embed/4KzFe50RQkQ"
|
|
||||||
title="YouTube video player"
|
|
||||||
frameborder="0"
|
|
||||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
|
||||||
allowfullscreen
|
|
||||||
></iframe>
|
|
||||||
*/}
|
|
||||||
|
|
||||||
<Steps>
|
|
||||||
<Step title="Register an account">
|
|
||||||
Head over to [app.sourcebot.dev](https://app.sourcebot.dev) and create an account.
|
|
||||||
</Step>
|
|
||||||
|
|
||||||
<Step title="Create an organization">
|
|
||||||
After logging in, you'll be asked to create an organization. You'll invite your team members to this organization later so they can also use Sourcebot.
|
|
||||||
|
|
||||||

|
|
||||||
</Step>
|
|
||||||
|
|
||||||
<Step title="Link your code host">
|
|
||||||
After selecting a code host you want to connect to, you'll be presented with the connection creation page. This page has the following three inputs:
|
|
||||||
- Connection name (required): The name of the connection within Sourcebot
|
|
||||||
- Secret (optional): An [access token](/access-tokens/overview) that is used to fetch private repos
|
|
||||||
- Configuration: The JSON configuration schema that defines the repos/orgs to fetch.
|
|
||||||
|
|
||||||
For a more detailed explanation of connections, check out the [Connections](/docs/connections/overview) page.
|
|
||||||
|
|
||||||
The example below shows a connection named `sourcebot-org` that fetches all of the repos for the `sourcebot-dev` GitHub organization, but excludes the `sourcebot-dev/zoekt` repo
|
|
||||||
|
|
||||||
<Note>This page won't let you continue with an invalid connection schema. If you're hitting errors, make sure the input you're providing is a valid JSON</Note>
|
|
||||||

|
|
||||||
</Step>
|
|
||||||
</Steps>
|
|
||||||
|
|
||||||
### Search
|
|
||||||
|
|
||||||
Once you create your organization's first connection successfully, you'll be redirected to your org's main search page. From here, you can use the search bar to search across all
|
|
||||||
of the repos you've indexed
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
Congrats, you've successfuly setup Sourcebot! Read on to learn more about the Sourcebot's capabilities. Checkout the [Connections](/docs/connections/overview) page to learn how to control which repos Sourcebot fetches
|
|
||||||
45
docs/docs/license-key.mdx
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
---
|
||||||
|
title: License key
|
||||||
|
sidebarTitle: License key
|
||||||
|
---
|
||||||
|
|
||||||
|
<Note>
|
||||||
|
If you'd like a trial license, [reach out](https://www.sourcebot.dev/contact) and we'll send one over within 24 hours
|
||||||
|
</Note>
|
||||||
|
|
||||||
|
All core Sourcebot features are available in Sourcebot OSS (MIT Licensed) without any limits. Some additional features require a license key. See the [pricing page](https://www.sourcebot.dev/pricing) for more details.
|
||||||
|
|
||||||
|
|
||||||
|
## Activating a license key
|
||||||
|
---
|
||||||
|
|
||||||
|
After purchasing a license key, you can activate it by setting the `SOURCEBOT_EE_LICENSE_KEY` environment variable.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run \
|
||||||
|
-e SOURCEBOT_EE_LICENSE_KEY=<your-license-key> \
|
||||||
|
/* additional args */ \
|
||||||
|
ghcr.io/sourcebot-dev/sourcebot:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
## Feature availability
|
||||||
|
---
|
||||||
|
|
||||||
|
| Feature | OSS | Licensed |
|
||||||
|
|:---------|:-----|:----------|
|
||||||
|
| [Search](/docs/features/search/syntax-reference) | ✅ | ✅ |
|
||||||
|
| [Full code host support](/docs/connections/overview) | ✅ | ✅ |
|
||||||
|
| [MCP Server](/docs/features/mcp-server) | ✅ | ✅ |
|
||||||
|
| [Agents](/docs/features/agents/overview) | ✅ | ✅ |
|
||||||
|
| [Login with credentials](/docs/configuration/auth/overview) | ✅ | ✅ |
|
||||||
|
| [Login with email codes](/docs/configuration/auth/overview) | ✅ | ✅ |
|
||||||
|
| [Login with SSO](/docs/configuration/auth/overview#enterprise-authentication-providers) | 🛑 | ✅ |
|
||||||
|
| [Code navigation](/docs/features/code-navigation) | 🛑 | ✅ |
|
||||||
|
| [Search contexts](/docs/features/search/search-contexts) | 🛑 | ✅ |
|
||||||
|
| [Audit logs](/docs/configuration/audit-logs) | 🛑 | ✅ |
|
||||||
|
| [Analytics](/docs/features/analytics) | 🛑 | ✅ |
|
||||||
|
|
||||||
|
|
||||||
|
## Questions?
|
||||||
|
|
||||||
|
If you have any questions regarding licensing, please [contact us](https://www.sourcebot.dev/contact).
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
---
|
|
||||||
title: Roles and Permissions
|
|
||||||
---
|
|
||||||
|
|
||||||
<Note>Looking to sync permissions with your identify provider? We're working on it - [reach out](https://www.sourcebot.dev/contact) to us to learn more</Note>
|
|
||||||
|
|
||||||
If you're using Sourcebot Cloud, or are self-hosting with [authentication](/self-hosting/more/authentication) enabled, you may have multiple members in your organization. Each
|
|
||||||
member has a role which defines their permissions:
|
|
||||||
|
|
||||||
| Role | Permission |
|
|
||||||
| :--- | :--------- |
|
|
||||||
| `Owner` | Each organization has a single `Owner`. This user has full access rights, including: connection management, organization management, and inviting new members. |
|
|
||||||
| `Member` | Read-only access to the organization. A `Member` can search across the repos indexed by an organization's connections, but may not manage the organization or its connections. |
|
|
||||||
|
|
@ -2,19 +2,225 @@
|
||||||
title: "Overview"
|
title: "Overview"
|
||||||
---
|
---
|
||||||
|
|
||||||
Sourcebot is an **[open-source](https://github.com/sourcebot-dev/sourcebot) code search tool** that is purpose built to search multi-million line codebases in seconds. It integrates with [GitHub](/docs/connections/github), [GitLab](/docs/connections/gitlab), and [other platforms](/docs/connections).
|
[Sourcebot](https://github.com/sourcebot-dev/sourcebot) is a self-hosted tool that helps you understand your codebase.
|
||||||
|
|
||||||
## Getting Started
|
- [Code search](/docs/features/search/overview): Search and navigate across all your repos and branches, no matter where they’re hosted
|
||||||
|
- [Ask Sourcebot](/docs/features/ask): Ask questions about your codebase and have Sourcebot provide detailed answers grounded with inline citations
|
||||||
|
|
||||||
There are two ways to get started using Sourcebot:
|
<CardGroup>
|
||||||
|
<Card title="Deployment guide" icon="server" href="/docs/deployment-guide" horizontal="true">
|
||||||
<CardGroup cols={2}>
|
Learn how to self-host Sourcebot in a few simple steps.
|
||||||
<Card horizontal title="Self-Host" icon="server" href="/self-hosting/overview">
|
|
||||||
Deploy Sourcebot on your own infrastructure.
|
|
||||||
</Card>
|
</Card>
|
||||||
<Card horizontal title="Sourcebot Cloud" icon="cloud" href="/docs/getting-started">
|
<Card title="Public demo" icon="globe" href="https://demo.sourcebot.dev/" horizontal="true">
|
||||||
Use Sourcebot on our managed infrastructure.
|
Check out Sourcebot's features on our public demo instance.
|
||||||
</Card>
|
</Card>
|
||||||
</CardGroup>
|
</CardGroup>
|
||||||
|
|
||||||
We also have a [public demo](https://demo.sourcebot.dev) if you'd like to try Sourcebot out before registering.
|
<AccordionGroup>
|
||||||
|
<Accordion title="Why Sourcebot?">
|
||||||
|
- **Full-featured search:** Fast indexed-based search with regex support, filters, branch search, boolean logic, and more.
|
||||||
|
- **Self-hosted:** Deploy it in minutes using our official [docker container](https://github.com/sourcebot-dev/sourcebot/pkgs/container/sourcebot). All of your data stays on your machine.
|
||||||
|
- **Modern design:** Light/Dark mode, vim keybindings, keyboard shortcuts, syntax highlighting, etc.
|
||||||
|
- **Scalable:** Scales to millions of lines of code.
|
||||||
|
- **Open-source:** Core features are MIT licensed.
|
||||||
|
</Accordion>
|
||||||
|
</AccordionGroup>
|
||||||
|
|
||||||
|
## Features
|
||||||
|
---
|
||||||
|
|
||||||
|
<Info>
|
||||||
|
Find an overview of all Sourcebot features below. For details, see the individual documentation pages.
|
||||||
|
</Info>
|
||||||
|
|
||||||
|
### Ask Sourcebot
|
||||||
|
|
||||||
|
[Ask Sourcebot](/docs/features/ask) gives you the ability to ask complex questions about your codebase, and have Sourcebot provide detailed answers with inline citations.
|
||||||
|
|
||||||
|
<Accordion title="Key benefits">
|
||||||
|
- **Bring your own model:** [Configure](/docs/configuration/language-model-providers) to any language model you'd like
|
||||||
|
- **Inline citations:** Every answer Sourcebot provides is grounded with inline citations directly into your codebase
|
||||||
|
- **Mutli-repo:** Ask questions about any repository you have indexed on Sourcebot
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
|
<video
|
||||||
|
autoPlay
|
||||||
|
muted
|
||||||
|
loop
|
||||||
|
playsInline
|
||||||
|
className="w-full aspect-video"
|
||||||
|
src="/images/ask_sourcebot_low_res.mp4"
|
||||||
|
></video>
|
||||||
|
|
||||||
|
### Code Search
|
||||||
|
|
||||||
|
Search across all your repos/branches across any code host platform. Blazingly fast, and supports regular expressions, repo/language search filters, boolean logic, and more.
|
||||||
|
|
||||||
|
<Accordion title="Key benefits">
|
||||||
|
- **Regex support:** Use regular expressions to find code with precision.
|
||||||
|
- **Query language:** Scope searches to specific files, repos, languages, symbol definitions and more using a rich [query language](/docs/features/search/syntax-reference).
|
||||||
|
- **Branch search:** Specify a list of branches to search across ([docs](/docs/features/search/multi-branch-indexing)).
|
||||||
|
- **Fast & scalable:** Sourcebot uses [trigram indexing](https://en.wikipedia.org/wiki/Trigram_search), allowing it to scale to massive codebases.
|
||||||
|
- **Syntax highlighting:** Syntax highlighting support for over [100+ languages](https://github.com/sourcebot-dev/sourcebot/blob/57724689303f351c279d37f45b6406f1d5d5d5ab/packages/web/src/lib/codemirrorLanguage.ts#L125).
|
||||||
|
- **Multi-repository:** Search across all of your repositories in a single search.
|
||||||
|
- **Search suggestions:** Get search suggestions as you craft your query.
|
||||||
|
- **Filter panel:** Filter results by repository or by language.
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
|
<video
|
||||||
|
autoPlay
|
||||||
|
muted
|
||||||
|
loop
|
||||||
|
playsInline
|
||||||
|
className="w-full aspect-video"
|
||||||
|
src="https://framerusercontent.com/assets/cEqHNSLiMbNeG3bk5xheQWXmKqc.mp4"
|
||||||
|
></video>
|
||||||
|
|
||||||
|
### Code Navigation
|
||||||
|
|
||||||
|
[Code navigation](/docs/features/code-navigation) helps you jump between symbol definitions and references quickly when browsing source code in Sourcebot.
|
||||||
|
|
||||||
|
<Accordion title="Key benefits">
|
||||||
|
- **Hover popover:** Hovering over a symbol reveals the symbol's definition signature in a inline preview.
|
||||||
|
- **Go to definition:** Navigate to a symbol's definition(s).
|
||||||
|
- **Find references:** Get all references to a symbol.
|
||||||
|
- **Cross-repository:** Sourcebot can resolve references and definitions across repositories.
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
|
<video
|
||||||
|
autoPlay
|
||||||
|
muted
|
||||||
|
loop
|
||||||
|
playsInline
|
||||||
|
className="w-full aspect-video"
|
||||||
|
src="https://framerusercontent.com/assets/B9ZxrlsUeO9NJyzkKyvVV2KSU4.mp4"
|
||||||
|
></video>
|
||||||
|
|
||||||
|
|
||||||
|
### Cross code-host support
|
||||||
|
|
||||||
|
Connect your code from multiple code-host platforms and search across all of them from a single interface.
|
||||||
|
|
||||||
|
<Accordion title="Key benefits">
|
||||||
|
- **Auto re-syncing:** Sourcebot will periodically sync with code hosts to pull the latest changes.
|
||||||
|
- **Flexible configuration:** Sourcebot uses an expressive [JSON schema](/docs/connections/overview) config format to specify exactly what repositories to index (and what not to index).
|
||||||
|
- **Parallel indexing:** Repositories are indexed in parallel.
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
|
<Columns cols={4}>
|
||||||
|
<Tooltip tip="GitHub.com | Enterprise Server | Enterprise Cloud">
|
||||||
|
<Card title="GitHub" img="/images/github.png" href="/docs/connections/github" />
|
||||||
|
</Tooltip>
|
||||||
|
<Tooltip tip="GitLab.com | Self Managed (CE & EE) | Dedicated">
|
||||||
|
<Card title="GitLab" img="/images/gitlab.png" href="/docs/connections/gitlab" />
|
||||||
|
</Tooltip>
|
||||||
|
<Tooltip tip="Bitbucket cloud | Bitbucket Data Center">
|
||||||
|
<Card title="BitBucket" img="/images/bitbucket.png" href="/docs/connections/bitbucket-cloud" />
|
||||||
|
</Tooltip>
|
||||||
|
<Tooltip tip="Gitea.com | Gitea Self-hosted">
|
||||||
|
<Card title="Gitea" img="/images/gitea.png" href="/docs/connections/gitea" />
|
||||||
|
</Tooltip>
|
||||||
|
<Card title="Gerrit" img="/images/gerrit.png" href="/docs/connections/gerrit" />
|
||||||
|
<Card title="Other Git Hosts" img="/images/git.png" href="/docs/connections/generic-git-host" />
|
||||||
|
<Card title="Local Git Repos" img="/images/local.png" href="/docs/connections/local-repos" />
|
||||||
|
</Columns>
|
||||||
|
|
||||||
|
|
||||||
|
### Authentication
|
||||||
|
|
||||||
|
Sourcebot comes with built-in support for authentication via [email/password](/docs/configuration/auth/overview#email-%2F-password), [email codes](/docs/configuration/auth/overview#email-codes), and various [SSO providers](/docs/configuration/auth/overview#enterprise-authentication-providers).
|
||||||
|
|
||||||
|
<Accordion title="Key benefits">
|
||||||
|
- **Configurable auth providers:** Configure the auth providers that are available to your team.
|
||||||
|
- **SSO:** Support for various SSO providers.
|
||||||
|
- **_(coming soon)_ RBAC:** Role-based access control for managing user permissions.
|
||||||
|
- **_(coming soon)_ Code host permission syncing:** Sync permissions from GitHub, Gitlab, etc. to Sourcebot.
|
||||||
|
- **_(coming soon)_ Audit logs:** Audit logs for all actions performed on Sourcebot, such as user login, search, etc.
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
|
<video
|
||||||
|
autoPlay
|
||||||
|
muted
|
||||||
|
loop
|
||||||
|
playsInline
|
||||||
|
className="w-full aspect-video"
|
||||||
|
src="https://framerusercontent.com/assets/t9Ci6NVULrcAG7u8hcBnR0Fnc.mp4"
|
||||||
|
></video>
|
||||||
|
|
||||||
|
### Self-hosted
|
||||||
|
|
||||||
|
Sourcebot is designed to be easily self-hosted, allowing you to deploy it onto your own infrastructure, keeping your code private and secure.
|
||||||
|
|
||||||
|
<Accordion title="Key benefits">
|
||||||
|
- **Easy deployment:** Sourcebot is shipped as a [single docker container](https://github.com/sourcebot-dev/sourcebot/pkgs/container/sourcebot) that can be deployed to a k8s cluster, a VM, or any other platform that supports docker.
|
||||||
|
- **Secure:** Your code **never** leaves your infrastructure.
|
||||||
|
- **No-vendor lock-in:** Avoid dependency on a third-party SaaS provider; you can modify, extend, or migrate your deployment as needed.
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
|
## Get started
|
||||||
|
---
|
||||||
|
|
||||||
|
<CardGroup cols={2}>
|
||||||
|
<Card horizontal title="Deployment guide ->" href="/docs/deployment-guide" />
|
||||||
|
<Card horizontal title="Connecting your code ->" href="/docs/connections/overview" />
|
||||||
|
<Card horizontal title="Search syntax reference ->" href="/docs/features/search/syntax-reference" />
|
||||||
|
<Card horizontal title="Code navigation overview ->" href="/docs/features/code-navigation" />
|
||||||
|
</CardGroup>
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
---
|
||||||
|
|
||||||
|
Sourcebot is shipped as a single docker container that runs a collection of services using [supervisord](https://supervisord.org/):
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
{/*TODO: outline the different services, how Sourcebot communicates with code hosts, and the different*/}
|
||||||
|
|
||||||
|
Sourcebot consists of the following components:
|
||||||
|
- **Web Server** : main Next.js web application serving the Sourcebot UI.
|
||||||
|
- **Backend Worker** : Node.js process that incrementally syncs with code hosts (e.g., GitHub, GitLab etc.) and asynchronously indexes configured repositories.
|
||||||
|
- **Zoekt** : the [open-source](https://github.com/sourcegraph/zoekt), trigram indexing code search engine that powers Sourcebot under the hood.
|
||||||
|
- **Postgres** : transactional database for storing business-logic data.
|
||||||
|
- **Redis Job Queue** : fast in-memory store. Used with [BullMQ](https://docs.bullmq.io/) for queuing asynchronous work.
|
||||||
|
- **`.sourcebot/` cache** : file-system cache where persistent data is written.
|
||||||
|
|
||||||
|
You can use managed Redis / Postgres services that run outside of the Sourcebot container by providing the `REDIS_URL` and `DATABASE_URL` environment variables, respectively. See the [environment variables](/docs/configuration/environment-variables) doc for more configuration options.
|
||||||
|
|
||||||
|
## Scalability
|
||||||
|
---
|
||||||
|
|
||||||
|
One of our design philosophies for Sourcebot is to keep our infrastructure [radically simple](https://www.radicalsimpli.city/) while balancing scalability concerns. Depending on the number of repositories you have indexed and the instance you are running Sourcebot on, you may experience slow search times or other performance degradations. Our recommendation is to vertically scale your instance by increasing the number of CPU cores and memory.
|
||||||
|
|
||||||
|
Sourcebot does not support horizontal scaling at this time, but it is on our roadmap. If this is something your team would be interested in, please contact us at [team@sourcebot.dev](mailto:team@sourcebot.dev).
|
||||||
|
|
||||||
|
## License key
|
||||||
|
---
|
||||||
|
|
||||||
|
Sourcebot's core features are available under an [MIT license](https://github.com/sourcebot-dev/sourcebot/blob/HEAD/LICENSE) without any limits. Some [additional features](/docs/license-key#feature-availability) such as SSO and code navigation require a [license key](/docs/license-key).
|
||||||
|
|
||||||
|
<CardGroup cols={2}>
|
||||||
|
<Card title="Pricing page" href="https://www.sourcebot.dev/pricing" />
|
||||||
|
<Card title="Request trial key" href="https://www.sourcebot.dev/contact" />
|
||||||
|
</CardGroup>
|
||||||
|
|
||||||
|
## Telemetry
|
||||||
|
---
|
||||||
|
|
||||||
|
By default, Sourcebot collects anonymized usage data through [PostHog](https://posthog.com/) to help us improve the performance and reliability of our tool. We don't collect or transmit <a href="https://demo.sourcebot.dev/~/search?query=captureEvent%5C(%20repo%3Asourcebot">any information related to your codebase</a>. In addition, all events are [sanitized](https://github.com/sourcebot-dev/sourcebot/blob/HEAD/packages/web/src/app/posthogProvider.tsx) to ensure that no sensitive details (ex. ip address, query info) leave your machine.
|
||||||
|
|
||||||
|
The data we collect includes general usage statistics and metadata such as query performance (e.g., search duration, error rates) to monitor the application's health and functionality. This information helps us better understand how Sourcebot is used and where improvements can be made.
|
||||||
|
|
||||||
|
If you'd like to disable all telemetry, you can do so by setting the environment variable `SOURCEBOT_TELEMETRY_DISABLED` to `true`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run \
|
||||||
|
-e SOURCEBOT_TELEMETRY_DISABLED=true \
|
||||||
|
/* additional args */ \
|
||||||
|
ghcr.io/sourcebot-dev/sourcebot:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
If you disabled telemetry correctly, you'll see the following log when starting Sourcebot:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
Disabling telemetry since SOURCEBOT_TELEMETRY_DISABLED was set.
|
||||||
|
```
|
||||||
61
docs/docs/upgrade/v3-to-v4-guide.mdx
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
---
|
||||||
|
title: V3 to V4 Guide
|
||||||
|
sidebarTitle: V3 to V4 guide
|
||||||
|
---
|
||||||
|
|
||||||
|
This guide will walk you through upgrading your Sourcebot deployment from v3 to v4.
|
||||||
|
|
||||||
|
<Warning>
|
||||||
|
Please note that the following features are no longer supported in v4:
|
||||||
|
- Multi-tenancy mode
|
||||||
|
- Unauthenticated access to a Sourcebot deployment - authentication is now built in by default. Unauthenticated access to a organization can be enabled with an unlimited seat [enterprise license](/docs/license-key)
|
||||||
|
</Warning>
|
||||||
|
|
||||||
|
### If your deployment doesn't have authentication enabled
|
||||||
|
<Steps>
|
||||||
|
<Step title="Spin down deployment">
|
||||||
|
</Step>
|
||||||
|
<Step title="Set AUTH_URL environment variable if needed">
|
||||||
|
If your Sourcebot instance is deployed behind a domain (ex. `https://sourcebot.yourcompany.com`) you **must** set the `AUTH_URL` environment variable to your deployment domain.
|
||||||
|
</Step>
|
||||||
|
<Step title="Spin up v4 deployment and create owner account">
|
||||||
|
When you visit your new deployment you'll be presented with a sign-in page. Sourcebot now requires authentication, and all users must register and sign-in to the deployment.
|
||||||
|
|
||||||
|
The first account that's registered will be made the owner. By default, you can register using basic credentials which will be stored encrypted within the postgres DB connected to Sourcebot. Check out
|
||||||
|
the [auth docs](/docs/configuration/auth/overview) to setup additional auth providers.
|
||||||
|
|
||||||
|
<img width="600" height="500" style={{ borderRadius: '0.5rem' }} src="/images/login_basic.png" />
|
||||||
|
</Step>
|
||||||
|
<Step title="(Optional) Configure transactional emails">
|
||||||
|
Emails can be sent on organization join request/approval by configuring [transactional emails](/docs/configuration/transactional-emails)
|
||||||
|
|
||||||
|
<img width="500" height="600" style={{ borderRadius: '0.5rem' }} src="/images/join_request_email.png" />
|
||||||
|
</Step>
|
||||||
|
<Step title="Approve additional users onto your deployment">
|
||||||
|
After the first account is created, all new account registrations must be approved by the owner. When new users register onto the deployment they'll be presented with the following request approval page:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The owner can view and approve join requests by navigating to **Settings -> Members**. Automatic provisioning of accounts is supported when using SSO/Oauth providers, check out the [auth docs](/docs/configuration/auth/overview#enterprise-authentication-providers) for more info
|
||||||
|
|
||||||
|
</Step>
|
||||||
|
<Step title="You're done!">
|
||||||
|
Congrats, you've successfully migrated to v4! Please let us know what you think of the new features by reaching out on our [discord](https://discord.gg/6Fhp27x7Pb) or [GitHub discussion](https://github.com/sourcebot-dev/sourcebot/discussions/categories/support)
|
||||||
|
</Step>
|
||||||
|
</Steps>
|
||||||
|
|
||||||
|
### If your deployment has authentication enabled
|
||||||
|
|
||||||
|
The only change that's required if your deployment has authentication enabled is to unset the `SOURCEBOT_AUTH_ENABLED` environment variable. New user registrations will now submit a request to join the organization which can be approved by the owner by
|
||||||
|
navigating to **Settings -> Members**. Emails can be sent on organization join request/approval by configuring [transactional emails](/docs/configuration/transactional-emails)
|
||||||
|
|
||||||
|
### If your deployment uses multi-tenancy mode
|
||||||
|
|
||||||
|
Unfortunately, multi-tenancy mode is no longer officially supported in v4. To upgrade to v4, you'll need to unset the `SOURCEBOT_TENANCY_MODE` environment variable and wipe your Sourcebot cache. You can then follow the [instructions above](/docs/upgrade/v3-to-v4-guide#if-your-deployment-doesnt-have-authentication-enabled)
|
||||||
|
to finish upgrading to v4 in single-tenant mode.
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
- If you're hitting issues with signing into your Sourcebot instance, make sure you're setting `AUTH_URL` correctly to your deployment domain (ex. `https://sourcebot.yourcompany.com`)
|
||||||
|
|
||||||
|
|
||||||
|
Having troubles migrating from v3 to v4? Reach out to us on [discord](https://discord.gg/6Fhp27x7Pb) or [GitHub discussion](https://github.com/sourcebot-dev/sourcebot/discussions/categories/support) and we'll try our best to help
|
||||||
BIN
docs/images/analytics_demo.mp4
Normal file
BIN
docs/images/api_key.png
Normal file
|
After Width: | Height: | Size: 140 KiB |
BIN
docs/images/ask_sourcebot_low_res.mp4
Normal file
BIN
docs/images/bitbucket.png
Normal file
|
After Width: | Height: | Size: 6.9 KiB |
BIN
docs/images/code_nav_chart.png
Normal file
|
After Width: | Height: | Size: 597 KiB |
BIN
docs/images/code_search_chart.png
Normal file
|
After Width: | Height: | Size: 612 KiB |
BIN
docs/images/cost_savings_chart.png
Normal file
|
After Width: | Height: | Size: 739 KiB |
BIN
docs/images/dau_chart.png
Normal file
|
After Width: | Height: | Size: 561 KiB |
BIN
docs/images/gerrit.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
docs/images/git.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
docs/images/gitea.png
Normal file
|
After Width: | Height: | Size: 8.5 KiB |
BIN
docs/images/github.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
docs/images/github_pat_scopes_fine_grained.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
docs/images/gitlab.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
docs/images/invite_link_toggle.png
Normal file
|
After Width: | Height: | Size: 174 KiB |
BIN
docs/images/join_request_email.png
Normal file
|
After Width: | Height: | Size: 149 KiB |
BIN
docs/images/local.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 137 KiB After Width: | Height: | Size: 118 KiB |
BIN
docs/images/login_basic.png
Normal file
|
After Width: | Height: | Size: 90 KiB |
BIN
docs/images/member_approval_toggle.png
Normal file
|
After Width: | Height: | Size: 251 KiB |
BIN
docs/images/pending_approval.png
Normal file
|
After Width: | Height: | Size: 78 KiB |
|
|
@ -1,59 +0,0 @@
|
||||||
---
|
|
||||||
title: Configuration
|
|
||||||
sidebarTitle: Configuration
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
## Environment Variables
|
|
||||||
|
|
||||||
Sourcebot accepts a variety of environment variables to fine tune your deployment.
|
|
||||||
|
|
||||||
| Variable | Default | Description |
|
|
||||||
| :------- | :------ | :---------- |
|
|
||||||
| `SOURCEBOT_LOG_LEVEL` | `info` | <p>The Sourcebot logging level. Valid values are `debug`, `info`, `warn`, `error`, in order of severity.</p> |
|
|
||||||
| `DATABASE_URL` | `postgresql://postgres@ localhost:5432/sourcebot` | <p>Connection string of your Postgres database. By default, a Postgres database is automatically provisioned at startup within the container.</p><p>If you'd like to use a non-default schema, you can provide it as a parameter in the database url </p> |
|
|
||||||
| `REDIS_URL` | `redis://localhost:6379` | <p>Connection string of your Redis instance. By default, a Redis database is automatically provisioned at startup within the container.</p> |
|
|
||||||
| `SOURCEBOT_ENCRYPTION_KEY` | - | <p>Used to encrypt connection secrets. Generated using `openssl rand -base64 24`. Automatically generated at startup if no value is provided.</p> |
|
|
||||||
| `AUTH_SECRET` | - | <p>Used to validate login session cookies. Generated using `openssl rand -base64 33`. Automatically generated at startup if no value is provided.</p> |
|
|
||||||
| `AUTH_URL` | - | <p>URL of your Sourcebot deployment, e.g., `https://example.com` or `http://localhost:3000`. Required when `SOURCEBOT_AUTH_ENABLED` is `true`.</p> |
|
|
||||||
| `SOURCEBOT_TENANCY_MODE` | `single` | <p>The tenancy configuration for Sourcebot. Valid values are `single` or `multi`. See [this doc](/self-hosting/more/tenancy) for more info.</p> |
|
|
||||||
| `SOURCEBOT_AUTH_ENABLED` | `false` | <p>Enables/disables authentication in Sourcebot. If set to `false`, `SOURCEBOT_TENANCY_MODE` must be `single`. See [this doc](/self-hosting/more/authentication) for more info.</p> |
|
|
||||||
| `SOURCEBOT_TELEMETRY_DISABLED` | `false` | <p>Enables/disables telemetry collection in Sourcebot. See [this doc](/self-hosting/security/telemetry) for more info.</p> |
|
|
||||||
| `DATA_DIR` | `/data` | <p>The directory within the container to store all persistent data. Typically, this directory will be volume mapped such that data is persisted across container restarts (e.g., `docker run -v $(pwd):/data`)</p> |
|
|
||||||
| `DATA_CACHE_DIR` | `$DATA_DIR/.sourcebot` | <p>The root data directory in which all data written to disk by Sourcebot will be located.</p> |
|
|
||||||
| `DATABASE_DATA_DIR` | `$DATA_CACHE_DIR/db` | <p>The data directory for the default Postgres database.</p> |
|
|
||||||
| `REDIS_DATA_DIR` | `$DATA_CACHE_DIR/redis` | <p>The data directory for the default Redis instance.</p> |
|
|
||||||
|
|
||||||
|
|
||||||
## Additional Features
|
|
||||||
|
|
||||||
There are additional features that can be enabled and configured via environment variables.
|
|
||||||
|
|
||||||
<CardGroup cols={2}>
|
|
||||||
<Card horizontal title="Authentication" icon="lock" href="/self-hosting/more/authentication" />
|
|
||||||
<Card horizontal title="Tenancy" icon="users" href="/self-hosting/more/tenancy" />
|
|
||||||
<Card horizontal title="Transactional Emails" icon="envelope" href="/self-hosting/more/transactional-emails" />
|
|
||||||
<Card horizontal title="Declarative Configs" icon="page" href="/self-hosting/more/declarative-config" />
|
|
||||||
</CardGroup>
|
|
||||||
|
|
||||||
## Health Check and Version Endpoints
|
|
||||||
|
|
||||||
Sourcebot includes a health check endpoint that indicates if the application is alive, returning `200 OK` if it is:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
curl http://localhost:3000/api/health
|
|
||||||
```
|
|
||||||
|
|
||||||
It also includes a version endpoint to check the current version of the application:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
curl http://localhost:3000/api/version
|
|
||||||
```
|
|
||||||
|
|
||||||
Sample response:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"version": "v3.0.0"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
---
|
|
||||||
title: License key
|
|
||||||
sidebarTitle: License key
|
|
||||||
---
|
|
||||||
|
|
||||||
All core Sourcebot features are available in Sourcebot OSS (MIT Licensed). Some additional features require a license key. See the [pricing page](https://www.sourcebot.dev/pricing) for more details.
|
|
||||||
|
|
||||||
|
|
||||||
## Activating a license key
|
|
||||||
|
|
||||||
After purchasing a license key, you can activate it by setting the `SOURCEBOT_EE_LICENSE_KEY` environment variable.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker run \
|
|
||||||
-e SOURCEBOT_EE_LICENSE_KEY=<your-license-key> \
|
|
||||||
/* additional args */ \
|
|
||||||
ghcr.io/sourcebot-dev/sourcebot:latest
|
|
||||||
```
|
|
||||||
|
|
||||||
## Questions?
|
|
||||||
|
|
||||||
If you have any questions regarding licensing, please [contact us](mailto:team@sourcebot.dev).
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
||||||
---
|
|
||||||
title: Authentication
|
|
||||||
sidebarTitle: Authentication
|
|
||||||
---
|
|
||||||
|
|
||||||
<Note>SSO is currently not supported. If you'd like SSO, please reach out using our [contact form](https://www.sourcebot.dev/contact)</Note>
|
|
||||||
<Warning>If you're switching from non-auth, delete the Sourcebot cache (the `.sourcebot` folder) before starting.</Warning>
|
|
||||||
|
|
||||||
Sourcebot has built-in authentication that gates access to your organization. OAuth, email codes, and email / password are supported. To enable authentication, set the `SOURCEBOT_AUTH_ENABLED` environment variable to `true`.
|
|
||||||
When authentication is enabled:
|
|
||||||
|
|
||||||
- [Connection managment](/docs/connections/overview) happens through the UI
|
|
||||||
- Members must be invited to an organization to gain access
|
|
||||||
- If you're in single-tenant mode, the first user to register will be made the owner of the default organization. Check out the [roles page](/docs/more/roles-and-permissions) for more info on the different roles and permissions
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
# Authentication Providers
|
|
||||||
|
|
||||||
<Warning>Make sure the `AUTH_URL` environment variable is [configured correctly](/self-hosting/configuration) when using Sourcebot in a deployed environment.</Warning>
|
|
||||||
|
|
||||||
To enable an authentication provider in Sourcebot, configure the required environment variables for the provider. Under the hood, Sourcebot uses Auth.js which supports [many providers](https://authjs.dev/getting-started/authentication/oauth). Submit a [feature request on GitHub](https://github.com/sourcebot-dev/sourcebot/discussions/categories/ideas) if you want us to add support for a specific provider.
|
|
||||||
|
|
||||||
|
|
||||||
## Email / Password
|
|
||||||
---
|
|
||||||
Email / password authentication is enabled by default. It can be **disabled** by setting `AUTH_CREDENTIALS_LOGIN_ENABLED` to `false`.
|
|
||||||
|
|
||||||
## Email codes
|
|
||||||
---
|
|
||||||
Email codes are 6 digit codes sent to a provided email. Email codes are enabled when transactional emails are configured using the following environment variables:
|
|
||||||
|
|
||||||
- `SMTP_CONNECTION_URL`
|
|
||||||
- `EMAIL_FROM_ADDRESS`
|
|
||||||
|
|
||||||
|
|
||||||
See [transactional emails](/self-hosting/more/transactional-emails) for more details.
|
|
||||||
|
|
||||||
## GitHub
|
|
||||||
---
|
|
||||||
|
|
||||||
[Auth.js GitHub Provider Docs](https://authjs.dev/getting-started/providers/github)
|
|
||||||
|
|
||||||
**Required environment variables:**
|
|
||||||
- `AUTH_GITHUB_CLIENT_ID`
|
|
||||||
- `AUTH_GITHUB_CLIENT_SECRET`
|
|
||||||
|
|
||||||
## Google
|
|
||||||
---
|
|
||||||
|
|
||||||
[Auth.js Google Provider Docs](https://next-auth.js.org/providers/google)
|
|
||||||
|
|
||||||
**Required environment variables:**
|
|
||||||
- `AUTH_GOOGLE_CLIENT_ID`
|
|
||||||
- `AUTH_GOOGLE_CLIENT_SECRET`
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
# Troubleshooting
|
|
||||||
|
|
||||||
- If you experience issues logging in, logging out, or accessing an organization you should have access to, try clearing your cookies & performing a full page refresh (`Cmd/Ctrl + Shift + R` on most browsers).
|
|
||||||
- Still not working? Reach out to us on our [discord](https://discord.com/invite/6Fhp27x7Pb) or [github discussions](https://github.com/sourcebot-dev/sourcebot/discussions)
|
|
||||||
|
|
@ -1,136 +0,0 @@
|
||||||
---
|
|
||||||
title: Self-host Sourcebot
|
|
||||||
sidebarTitle: Overview
|
|
||||||
---
|
|
||||||
|
|
||||||
<Note>Want a managed solution? Checkout [Sourcebot Cloud](/docs/getting-started).</Note>
|
|
||||||
|
|
||||||
Sourcebot is open source and can be self-hosted using our official [Docker image](https://github.com/sourcebot-dev/sourcebot/pkgs/container/sourcebot).
|
|
||||||
|
|
||||||
## Quick Start Guide
|
|
||||||
|
|
||||||
{/*@todo: record a self-hosting quick start guide
|
|
||||||
<iframe
|
|
||||||
width="560"
|
|
||||||
height="315"
|
|
||||||
src="https://www.youtube.com/embed/4KzFe50RQkQ"
|
|
||||||
title="YouTube video player"
|
|
||||||
frameborder="0"
|
|
||||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
|
||||||
allowfullscreen
|
|
||||||
></iframe>
|
|
||||||
*/}
|
|
||||||
|
|
||||||
<Steps>
|
|
||||||
<Step title="Create a config">
|
|
||||||
By default, Sourcebot requires a configuration file with a list of [code host connections](/docs/connections/overview) that specify what repositories should be **synced** (cloned and indexed). To get started, run the following command to create a starter `config.json`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
touch config.json
|
|
||||||
echo '{
|
|
||||||
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
|
|
||||||
"connections": {
|
|
||||||
// Comments are supported
|
|
||||||
"starter-connection": {
|
|
||||||
"type": "github",
|
|
||||||
"repos": [
|
|
||||||
"sourcebot-dev/sourcebot"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}' > config.json
|
|
||||||
```
|
|
||||||
|
|
||||||
This config creates a single GitHub connection named `starter-connection` that specifies [Sourcebot](https://github.com/sourcebot-dev/sourcebot) as a repo to sync.
|
|
||||||
</Step>
|
|
||||||
|
|
||||||
<Step title="Launch your instance">
|
|
||||||
Sourcebot is packaged as a [single Docker image](https://github.com/sourcebot-dev/sourcebot/pkgs/container/sourcebot). In the same directory as `config.json`, run the following command to start your instance:
|
|
||||||
|
|
||||||
``` bash
|
|
||||||
docker run \
|
|
||||||
-p 3000:3000 \
|
|
||||||
--pull=always \
|
|
||||||
--rm \
|
|
||||||
-v $(pwd):/data \
|
|
||||||
-e CONFIG_PATH=/data/config.json \
|
|
||||||
--name sourcebot \
|
|
||||||
ghcr.io/sourcebot-dev/sourcebot:latest
|
|
||||||
```
|
|
||||||
|
|
||||||
Navigate to `localhost:3000` to start searching the Sourcebot repo.
|
|
||||||
|
|
||||||
<Accordion title="Details">
|
|
||||||
**This command**:
|
|
||||||
- pulls the latest version of the `sourcebot` docker image.
|
|
||||||
- mounts the working directory to `/data` in the container to allow Sourcebot to persist data across restarts, and to access the `config.json`. In your local directory, you should see a `.sourcebot` folder created that contains all persistent data.
|
|
||||||
- runs any pending database migrations.
|
|
||||||
- starts up all services, including the webserver exposed on port 3000.
|
|
||||||
- reads `config.json` and starts syncing.
|
|
||||||
</Accordion>
|
|
||||||
|
|
||||||
<Warning>Hit an issue? Please let us know on [GitHub discussions](https://github.com/sourcebot-dev/sourcebot/discussions/categories/support) or by [emailing us](mailto:team@sourcebot.dev).</Warning>
|
|
||||||
</Step>
|
|
||||||
|
|
||||||
<Step title="Link your code">
|
|
||||||
Sourcebot supports indexing public & private code on the following code hosts:
|
|
||||||
|
|
||||||
<CardGroup cols={2}>
|
|
||||||
<Card horizontal title="GitHub" icon="github" href="/docs/connections/github" />
|
|
||||||
<Card horizontal title="GitLab" icon="gitlab" href="/docs/connections/gitlab" />
|
|
||||||
<Card horizontal title="Bitbucket Cloud" icon="bitbucket" href="/docs/connections/bitbucket-cloud" />
|
|
||||||
<Card horizontal title="Bitbucket Data Center" icon="bitbucket" href="/docs/connections/bitbucket-data-center" />
|
|
||||||
<Card horizontal title="Gitea" href="/docs/connections/gitea" />
|
|
||||||
<Card horizontal title="Gerrit" href="/docs/connections/gerrit" />
|
|
||||||
<Card horizontal title="Other Git hosts" icon="git-alt" href="/docs/connections/generic-git-host" />
|
|
||||||
<Card horizontal title="Local Git repos" icon="folder" href="/docs/connections/local-repos" />
|
|
||||||
</CardGroup>
|
|
||||||
|
|
||||||
<Note>Missing your code host? [Submit a feature request on GitHub](https://github.com/sourcebot-dev/sourcebot/discussions/categories/ideas).</Note>
|
|
||||||
</Step>
|
|
||||||
</Steps>
|
|
||||||
|
|
||||||
## Architecture
|
|
||||||
|
|
||||||
Sourcebot is shipped as a single docker container that runs a collection of services using [supervisord](https://supervisord.org/):
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
{/*TODO: outline the different services, how Sourcebot communicates with code hosts, and the different*/}
|
|
||||||
|
|
||||||
Sourcebot consists of the following components:
|
|
||||||
- **Web Server** : main Next.js web application serving the Sourcebot UI.
|
|
||||||
- **Backend Worker** : Node.js process that incrementally syncs with code hosts (e.g., GitHub, GitLab etc.) and asynchronously indexes configured repositories.
|
|
||||||
- **Zoekt** : the [open-source](https://github.com/sourcegraph/zoekt), trigram indexing code search engine that powers Sourcebot under the hood.
|
|
||||||
- **Postgres** : transactional database for storing business-logic data.
|
|
||||||
- **Redis Job Queue** : fast in-memory store. Used with [BullMQ](https://docs.bullmq.io/) for queuing asynchronous work.
|
|
||||||
- **`.sourcebot/` cache** : file-system cache where persistent data is written.
|
|
||||||
|
|
||||||
You can use managed Redis / Postgres services that run outside of the Sourcebot container by providing the `REDIS_URL` and `DATABASE_URL` environment variables, respectively. See the [configuration](/self-hosting/configuration) for more configuration options.
|
|
||||||
|
|
||||||
## Scalability
|
|
||||||
|
|
||||||
One of our design philosophies for Sourcebot is to keep our infrastructure [radically simple](https://www.radicalsimpli.city/) while balancing scalability concerns. Depending on the number of repositories you have indexed and the instance you are running Sourcebot on, you may experience slow search times or other performance degradations. Our recommendation is to vertically scale your instance by increasing the number of CPU cores and memory.
|
|
||||||
|
|
||||||
Sourcebot does not support horizontal scaling at this time, but it is on our roadmap. If this is something your team would be interested in, please contact us at [team@sourcebot.dev](mailto:team@sourcebot.dev).
|
|
||||||
|
|
||||||
|
|
||||||
## Telemetry
|
|
||||||
By default, Sourcebot collects anonymized usage data through [PostHog](https://posthog.com/) to help us improve the performance and reliability of our tool. We don't collect or transmit <a href="https://demo.sourcebot.dev/~/search?query=captureEvent%5C(%20repo%3Asourcebot">any information related to your codebase</a>. In addition, all events are [sanitized](https://github.com/sourcebot-dev/sourcebot/blob/HEAD/packages/web/src/app/posthogProvider.tsx) to ensure that no sensitive details (ex. ip address, query info) leave your machine.
|
|
||||||
|
|
||||||
The data we collect includes general usage statistics and metadata such as query performance (e.g., search duration, error rates) to monitor the application's health and functionality. This information helps us better understand how Sourcebot is used and where improvements can be made.
|
|
||||||
|
|
||||||
If you'd like to disable all telemetry, you can do so by setting the environment variable `SOURCEBOT_TELEMETRY_DISABLED` to `true`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker run \
|
|
||||||
-e SOURCEBOT_TELEMETRY_DISABLED=true \
|
|
||||||
/* additional args */ \
|
|
||||||
ghcr.io/sourcebot-dev/sourcebot:latest
|
|
||||||
```
|
|
||||||
|
|
||||||
If you disabled telemetry correctly, you'll see the following log when starting Sourcebot:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
Disabling telemetry since SOURCEBOT_TELEMETRY_DISABLED was set.
|
|
||||||
```
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<Tabs>
|
<Tabs>
|
||||||
<Tab title="Environment Variable">
|
<Tab title="Environment Variable">
|
||||||
<Note>Environment variables are only supported in a [declarative config](/self-hosting/more/declarative-config) and cannot be used in the web UI.</Note>
|
<Note>Environment variables are only supported in a [declarative config](/docs/configuration/declarative-config) and cannot be used in the web UI.</Note>
|
||||||
|
|
||||||
1. Add the `token` and `user` (username associated with the app password you created) properties to your connection config:
|
1. Add the `token` and `user` (username associated with the app password you created) properties to your connection config:
|
||||||
```json
|
```json
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
</Tab>
|
</Tab>
|
||||||
|
|
||||||
<Tab title="Secret">
|
<Tab title="Secret">
|
||||||
<Note>Secrets are only supported when [authentication](/self-hosting/more/authentication) is enabled.</Note>
|
<Note>Secrets are only supported when [authentication](/docs/configuration/auth/overview) is enabled.</Note>
|
||||||
|
|
||||||
1. Navigate to **Secrets** in settings and create a new secret with your access token:
|
1. Navigate to **Secrets** in settings and create a new secret with your access token:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<Tabs>
|
<Tabs>
|
||||||
<Tab title="Environment Variable">
|
<Tab title="Environment Variable">
|
||||||
<Note>Environment variables are only supported in a [declarative config](/self-hosting/more/declarative-config) and cannot be used in the web UI.</Note>
|
<Note>Environment variables are only supported in a [declarative config](/docs/configuration/declarative-config) and cannot be used in the web UI.</Note>
|
||||||
|
|
||||||
1. Add the `token` property to your connection config:
|
1. Add the `token` property to your connection config:
|
||||||
```json
|
```json
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
</Tab>
|
</Tab>
|
||||||
|
|
||||||
<Tab title="Secret">
|
<Tab title="Secret">
|
||||||
<Note>Secrets are only supported when [authentication](/self-hosting/more/authentication) is enabled.</Note>
|
<Note>Secrets are only supported when [authentication](/docs/configuration/auth/overview) is enabled.</Note>
|
||||||
|
|
||||||
1. Navigate to **Secrets** in settings and create a new secret with your PAT:
|
1. Navigate to **Secrets** in settings and create a new secret with your PAT:
|
||||||
|
|
||||||
|
|
|
||||||
4
docs/snippets/license-key-required.mdx
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
|
||||||
|
<Note>
|
||||||
|
This feature is only available with an active Enterprise license. Please add your [license key](/docs/license-key) to activate it.
|
||||||
|
</Note>
|
||||||
10
docs/snippets/platform-support.mdx
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
<CardGroup cols={2}>
|
||||||
|
<Card horizontal title="GitHub" icon="github" href="/docs/connections/github" />
|
||||||
|
<Card horizontal title="GitLab" icon="gitlab" href="/docs/connections/gitlab" />
|
||||||
|
<Card horizontal title="Bitbucket Cloud" icon="bitbucket" href="/docs/connections/bitbucket-cloud" />
|
||||||
|
<Card horizontal title="Bitbucket Data Center" icon="bitbucket" href="/docs/connections/bitbucket-data-center" />
|
||||||
|
<Card horizontal title="Gitea" icon="mug-tea" href="/docs/connections/gitea" />
|
||||||
|
<Card horizontal title="Gerrit" icon="crow" href="/docs/connections/gerrit" />
|
||||||
|
<Card horizontal title="Other Git hosts" icon="git-alt" href="/docs/connections/generic-git-host" />
|
||||||
|
<Card horizontal title="Local Git repos" icon="folder" href="/docs/connections/local-repos" />
|
||||||
|
</CardGroup>
|
||||||
|
|
@ -685,7 +685,7 @@
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"pattern": ".+"
|
"pattern": ".+"
|
||||||
},
|
},
|
||||||
"description": "List of paths relative to the provided `path` to exclude from the index. .git, .hg, and .svn are always exluded.",
|
"description": "List of paths relative to the provided `path` to exclude from the index. .git, .hg, and .svn are always excluded.",
|
||||||
"default": [],
|
"default": [],
|
||||||
"examples": [
|
"examples": [
|
||||||
[
|
[
|
||||||
|
|
@ -1387,7 +1387,7 @@
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"pattern": ".+"
|
"pattern": ".+"
|
||||||
},
|
},
|
||||||
"description": "List of paths relative to the provided `path` to exclude from the index. .git, .hg, and .svn are always exluded.",
|
"description": "List of paths relative to the provided `path` to exclude from the index. .git, .hg, and .svn are always excluded.",
|
||||||
"default": [],
|
"default": [],
|
||||||
"examples": [
|
"examples": [
|
||||||
[
|
[
|
||||||
|
|
@ -2171,7 +2171,7 @@
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"pattern": ".+"
|
"pattern": ".+"
|
||||||
},
|
},
|
||||||
"description": "List of paths relative to the provided `path` to exclude from the index. .git, .hg, and .svn are always exluded.",
|
"description": "List of paths relative to the provided `path` to exclude from the index. .git, .hg, and .svn are always excluded.",
|
||||||
"default": [],
|
"default": [],
|
||||||
"examples": [
|
"examples": [
|
||||||
[
|
[
|
||||||
|
|
|
||||||
1493
docs/snippets/schemas/v3/languageModel.schema.mdx
Normal file
|
|
@ -16,15 +16,13 @@
|
||||||
"dev:prisma:migrate:dev": "yarn with-env yarn workspace @sourcebot/db prisma:migrate:dev",
|
"dev:prisma:migrate:dev": "yarn with-env yarn workspace @sourcebot/db prisma:migrate:dev",
|
||||||
"dev:prisma:studio": "yarn with-env yarn workspace @sourcebot/db prisma:studio",
|
"dev:prisma:studio": "yarn with-env yarn workspace @sourcebot/db prisma:studio",
|
||||||
"dev:prisma:migrate:reset": "yarn with-env yarn workspace @sourcebot/db prisma:migrate:reset",
|
"dev:prisma:migrate:reset": "yarn with-env yarn workspace @sourcebot/db prisma:migrate:reset",
|
||||||
"build:deps": "yarn workspaces foreach -R --from '{@sourcebot/schemas,@sourcebot/error,@sourcebot/crypto,@sourcebot/db}' run build"
|
"dev:prisma:db:push": "yarn with-env yarn workspace @sourcebot/db prisma:db:push",
|
||||||
|
"build:deps": "yarn workspaces foreach -R --from '{@sourcebot/schemas,@sourcebot/error,@sourcebot/crypto,@sourcebot/db,@sourcebot/shared}' run build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"dotenv-cli": "^8.0.0",
|
"dotenv-cli": "^8.0.0",
|
||||||
"npm-run-all": "^4.1.5"
|
"npm-run-all": "^4.1.5"
|
||||||
},
|
},
|
||||||
"packageManager": "yarn@4.7.0",
|
"packageManager": "yarn@4.7.0"
|
||||||
"dependencies": {
|
|
||||||
"@coderabbitai/bitbucket": "^1.1.3"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,8 @@
|
||||||
"vitest": "^2.1.9"
|
"vitest": "^2.1.9"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@coderabbitai/bitbucket": "^1.1.3",
|
||||||
"@gitbeaker/rest": "^40.5.1",
|
"@gitbeaker/rest": "^40.5.1",
|
||||||
"@logtail/node": "^0.5.2",
|
|
||||||
"@logtail/winston": "^0.5.2",
|
|
||||||
"@octokit/rest": "^21.0.2",
|
"@octokit/rest": "^21.0.2",
|
||||||
"@sentry/cli": "^2.42.2",
|
"@sentry/cli": "^2.42.2",
|
||||||
"@sentry/node": "^9.3.0",
|
"@sentry/node": "^9.3.0",
|
||||||
|
|
@ -32,10 +31,11 @@
|
||||||
"@sourcebot/crypto": "workspace:*",
|
"@sourcebot/crypto": "workspace:*",
|
||||||
"@sourcebot/db": "workspace:*",
|
"@sourcebot/db": "workspace:*",
|
||||||
"@sourcebot/error": "workspace:*",
|
"@sourcebot/error": "workspace:*",
|
||||||
|
"@sourcebot/logger": "workspace:*",
|
||||||
"@sourcebot/schemas": "workspace:*",
|
"@sourcebot/schemas": "workspace:*",
|
||||||
|
"@sourcebot/shared": "workspace:*",
|
||||||
"@t3-oss/env-core": "^0.12.0",
|
"@t3-oss/env-core": "^0.12.0",
|
||||||
"@types/express": "^5.0.0",
|
"@types/express": "^5.0.0",
|
||||||
"ajv": "^8.17.1",
|
|
||||||
"argparse": "^2.0.1",
|
"argparse": "^2.0.1",
|
||||||
"bullmq": "^5.34.10",
|
"bullmq": "^5.34.10",
|
||||||
"cross-fetch": "^4.0.0",
|
"cross-fetch": "^4.0.0",
|
||||||
|
|
@ -50,8 +50,6 @@
|
||||||
"posthog-node": "^4.2.1",
|
"posthog-node": "^4.2.1",
|
||||||
"prom-client": "^15.1.3",
|
"prom-client": "^15.1.3",
|
||||||
"simple-git": "^3.27.0",
|
"simple-git": "^3.27.0",
|
||||||
"strip-json-comments": "^5.0.1",
|
|
||||||
"winston": "^3.15.0",
|
|
||||||
"zod": "^3.24.3"
|
"zod": "^3.24.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { createBitbucketCloudClient } from "@coderabbitai/bitbucket/cloud";
|
||||||
import { createBitbucketServerClient } from "@coderabbitai/bitbucket/server";
|
import { createBitbucketServerClient } from "@coderabbitai/bitbucket/server";
|
||||||
import { BitbucketConnectionConfig } from "@sourcebot/schemas/v3/bitbucket.type";
|
import { BitbucketConnectionConfig } from "@sourcebot/schemas/v3/bitbucket.type";
|
||||||
import type { ClientOptions, ClientPathsWithMethod } from "openapi-fetch";
|
import type { ClientOptions, ClientPathsWithMethod } from "openapi-fetch";
|
||||||
import { createLogger } from "./logger.js";
|
import { createLogger } from "@sourcebot/logger";
|
||||||
import { PrismaClient } from "@sourcebot/db";
|
import { PrismaClient } from "@sourcebot/db";
|
||||||
import { getTokenFromConfig, measure, fetchWithRetry } from "./utils.js";
|
import { getTokenFromConfig, measure, fetchWithRetry } from "./utils.js";
|
||||||
import * as Sentry from "@sentry/node";
|
import * as Sentry from "@sentry/node";
|
||||||
|
|
@ -13,7 +13,7 @@ import { SchemaRestRepository as ServerRepository } from "@coderabbitai/bitbucke
|
||||||
import { processPromiseResults } from "./connectionUtils.js";
|
import { processPromiseResults } from "./connectionUtils.js";
|
||||||
import { throwIfAnyFailed } from "./connectionUtils.js";
|
import { throwIfAnyFailed } from "./connectionUtils.js";
|
||||||
|
|
||||||
const logger = createLogger("Bitbucket");
|
const logger = createLogger('bitbucket');
|
||||||
const BITBUCKET_CLOUD_GIT = 'https://bitbucket.org';
|
const BITBUCKET_CLOUD_GIT = 'https://bitbucket.org';
|
||||||
const BITBUCKET_CLOUD_API = 'https://api.bitbucket.org/2.0';
|
const BITBUCKET_CLOUD_API = 'https://api.bitbucket.org/2.0';
|
||||||
const BITBUCKET_CLOUD = "cloud";
|
const BITBUCKET_CLOUD = "cloud";
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,14 @@ import { Connection, ConnectionSyncStatus, PrismaClient, Prisma } from "@sourceb
|
||||||
import { Job, Queue, Worker } from 'bullmq';
|
import { Job, Queue, Worker } from 'bullmq';
|
||||||
import { Settings } from "./types.js";
|
import { Settings } from "./types.js";
|
||||||
import { ConnectionConfig } from "@sourcebot/schemas/v3/connection.type";
|
import { ConnectionConfig } from "@sourcebot/schemas/v3/connection.type";
|
||||||
import { createLogger } from "./logger.js";
|
import { createLogger } from "@sourcebot/logger";
|
||||||
import { Redis } from 'ioredis';
|
import { Redis } from 'ioredis';
|
||||||
import { RepoData, compileGithubConfig, compileGitlabConfig, compileGiteaConfig, compileGerritConfig, compileBitbucketConfig, compileGenericGitHostConfig } from "./repoCompileUtils.js";
|
import { RepoData, compileGithubConfig, compileGitlabConfig, compileGiteaConfig, compileGerritConfig, compileBitbucketConfig, compileGenericGitHostConfig } from "./repoCompileUtils.js";
|
||||||
import { BackendError, BackendException } from "@sourcebot/error";
|
import { BackendError, BackendException } from "@sourcebot/error";
|
||||||
import { captureEvent } from "./posthog.js";
|
import { captureEvent } from "./posthog.js";
|
||||||
import { env } from "./env.js";
|
import { env } from "./env.js";
|
||||||
import * as Sentry from "@sentry/node";
|
import * as Sentry from "@sentry/node";
|
||||||
|
import { loadConfig, syncSearchContexts } from "@sourcebot/shared";
|
||||||
|
|
||||||
interface IConnectionManager {
|
interface IConnectionManager {
|
||||||
scheduleConnectionSync: (connection: Connection) => Promise<void>;
|
scheduleConnectionSync: (connection: Connection) => Promise<void>;
|
||||||
|
|
@ -32,7 +33,7 @@ type JobResult = {
|
||||||
export class ConnectionManager implements IConnectionManager {
|
export class ConnectionManager implements IConnectionManager {
|
||||||
private worker: Worker;
|
private worker: Worker;
|
||||||
private queue: Queue<JobPayload>;
|
private queue: Queue<JobPayload>;
|
||||||
private logger = createLogger('ConnectionManager');
|
private logger = createLogger('connection-manager');
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private db: PrismaClient,
|
private db: PrismaClient,
|
||||||
|
|
@ -64,6 +65,9 @@ export class ConnectionManager implements IConnectionManager {
|
||||||
connectionName: connection.name,
|
connectionName: connection.name,
|
||||||
orgId: connection.orgId,
|
orgId: connection.orgId,
|
||||||
config: connectionConfig,
|
config: connectionConfig,
|
||||||
|
}, {
|
||||||
|
removeOnComplete: env.REDIS_REMOVE_ON_COMPLETE,
|
||||||
|
removeOnFail: env.REDIS_REMOVE_ON_FAIL,
|
||||||
});
|
});
|
||||||
this.logger.info(`Added job to queue for connection ${connection.name} (id: ${connection.id})`);
|
this.logger.info(`Added job to queue for connection ${connection.name} (id: ${connection.id})`);
|
||||||
}).catch((err: unknown) => {
|
}).catch((err: unknown) => {
|
||||||
|
|
@ -261,7 +265,7 @@ export class ConnectionManager implements IConnectionManager {
|
||||||
|
|
||||||
private async onSyncJobCompleted(job: Job<JobPayload>, result: JobResult) {
|
private async onSyncJobCompleted(job: Job<JobPayload>, result: JobResult) {
|
||||||
this.logger.info(`Connection sync job for connection ${job.data.connectionName} (id: ${job.data.connectionId}, jobId: ${job.id}) completed`);
|
this.logger.info(`Connection sync job for connection ${job.data.connectionName} (id: ${job.data.connectionId}, jobId: ${job.id}) completed`);
|
||||||
const { connectionId } = job.data;
|
const { connectionId, orgId } = job.data;
|
||||||
|
|
||||||
let syncStatusMetadata: Record<string, unknown> = (await this.db.connection.findUnique({
|
let syncStatusMetadata: Record<string, unknown> = (await this.db.connection.findUnique({
|
||||||
where: { id: connectionId },
|
where: { id: connectionId },
|
||||||
|
|
@ -286,7 +290,25 @@ export class ConnectionManager implements IConnectionManager {
|
||||||
notFound.repos.length > 0 ? ConnectionSyncStatus.SYNCED_WITH_WARNINGS : ConnectionSyncStatus.SYNCED,
|
notFound.repos.length > 0 ? ConnectionSyncStatus.SYNCED_WITH_WARNINGS : ConnectionSyncStatus.SYNCED,
|
||||||
syncedAt: new Date()
|
syncedAt: new Date()
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
|
// After a connection has synced, we need to re-sync the org's search contexts as
|
||||||
|
// there may be new repos that match the search context's include/exclude patterns.
|
||||||
|
if (env.CONFIG_PATH) {
|
||||||
|
try {
|
||||||
|
const config = await loadConfig(env.CONFIG_PATH);
|
||||||
|
|
||||||
|
await syncSearchContexts({
|
||||||
|
db: this.db,
|
||||||
|
orgId,
|
||||||
|
contexts: config.contexts,
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
this.logger.error(`Failed to sync search contexts for connection ${connectionId}: ${err}`);
|
||||||
|
Sentry.captureException(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
captureEvent('backend_connection_sync_job_completed', {
|
captureEvent('backend_connection_sync_job_completed', {
|
||||||
connectionId: connectionId,
|
connectionId: connectionId,
|
||||||
|
|
|
||||||
|
|
@ -15,4 +15,5 @@ export const DEFAULT_SETTINGS: Settings = {
|
||||||
maxRepoGarbageCollectionJobConcurrency: 8,
|
maxRepoGarbageCollectionJobConcurrency: 8,
|
||||||
repoGarbageCollectionGracePeriodMs: 10 * 1000, // 10 seconds
|
repoGarbageCollectionGracePeriodMs: 10 * 1000, // 10 seconds
|
||||||
repoIndexTimeoutMs: 1000 * 60 * 60 * 2, // 2 hours
|
repoIndexTimeoutMs: 1000 * 60 * 60 * 2, // 2 hours
|
||||||
|
enablePublicAccess: false // deprected, use FORCE_ENABLE_ANONYMOUS_ACCESS instead
|
||||||
}
|
}
|
||||||
|
|
@ -22,7 +22,6 @@ dotenv.config({
|
||||||
export const env = createEnv({
|
export const env = createEnv({
|
||||||
server: {
|
server: {
|
||||||
SOURCEBOT_ENCRYPTION_KEY: z.string(),
|
SOURCEBOT_ENCRYPTION_KEY: z.string(),
|
||||||
SOURCEBOT_LOG_LEVEL: z.enum(["info", "debug", "warn", "error"]).default("info"),
|
|
||||||
SOURCEBOT_TELEMETRY_DISABLED: booleanSchema.default("false"),
|
SOURCEBOT_TELEMETRY_DISABLED: booleanSchema.default("false"),
|
||||||
SOURCEBOT_INSTALL_ID: z.string().default("unknown"),
|
SOURCEBOT_INSTALL_ID: z.string().default("unknown"),
|
||||||
NEXT_PUBLIC_SOURCEBOT_VERSION: z.string().default("unknown"),
|
NEXT_PUBLIC_SOURCEBOT_VERSION: z.string().default("unknown"),
|
||||||
|
|
@ -36,6 +35,8 @@ export const env = createEnv({
|
||||||
FALLBACK_GITEA_CLOUD_TOKEN: z.string().optional(),
|
FALLBACK_GITEA_CLOUD_TOKEN: z.string().optional(),
|
||||||
|
|
||||||
REDIS_URL: z.string().url().default("redis://localhost:6379"),
|
REDIS_URL: z.string().url().default("redis://localhost:6379"),
|
||||||
|
REDIS_REMOVE_ON_COMPLETE: numberSchema.default(0),
|
||||||
|
REDIS_REMOVE_ON_FAIL: numberSchema.default(100),
|
||||||
|
|
||||||
NEXT_PUBLIC_SENTRY_BACKEND_DSN: z.string().optional(),
|
NEXT_PUBLIC_SENTRY_BACKEND_DSN: z.string().optional(),
|
||||||
NEXT_PUBLIC_SENTRY_ENVIRONMENT: z.string().optional(),
|
NEXT_PUBLIC_SENTRY_ENVIRONMENT: z.string().optional(),
|
||||||
|
|
@ -47,6 +48,9 @@ export const env = createEnv({
|
||||||
CONFIG_PATH: z.string().optional(),
|
CONFIG_PATH: z.string().optional(),
|
||||||
|
|
||||||
CONNECTION_MANAGER_UPSERT_TIMEOUT_MS: numberSchema.default(300000),
|
CONNECTION_MANAGER_UPSERT_TIMEOUT_MS: numberSchema.default(300000),
|
||||||
|
REPO_SYNC_RETRY_BASE_SLEEP_SECONDS: numberSchema.default(60),
|
||||||
|
|
||||||
|
GITLAB_CLIENT_QUERY_TIMEOUT_SECONDS: numberSchema.default(60 * 10),
|
||||||
},
|
},
|
||||||
runtimeEnv: process.env,
|
runtimeEnv: process.env,
|
||||||
emptyStringAsUndefined: true,
|
emptyStringAsUndefined: true,
|
||||||
|
|
|
||||||