Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ services:
volumes:
- ./config.json:/data/config.json
- sourcebot_data:/data
env_file:
- path: .env
required: false
environment:
- CONFIG_PATH=/data/config.json
- AUTH_URL=${AUTH_URL:-http://localhost:3000}
- AUTH_SECRET=${AUTH_SECRET:-000000000000000000000000000000000} # CHANGEME: generate via `openssl rand -base64 33`
- SOURCEBOT_ENCRYPTION_KEY=${SOURCEBOT_ENCRYPTION_KEY:-000000000000000000000000000000000} # CHANGEME: generate via `openssl rand -base64 24`
- DATABASE_URL=${DATABASE_URL:-postgresql://postgres:postgres@postgres:5432/postgres} # CHANGEME
- REDIS_URL=${REDIS_URL:-redis://redis:6379} # CHANGEME
- SOURCEBOT_EE_LICENSE_KEY=${SOURCEBOT_EE_LICENSE_KEY:-}

# For the full list of environment variables see:
# https://docs.sourcebot.dev/docs/configuration/environment-variables
Expand Down
109 changes: 59 additions & 50 deletions docs/docs/deployment/docker-compose.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,68 @@
title: "Docker Compose"
---

This guide will walk you through deploying Sourcebot locally or on a VM using Docker Compose. We will use the [docker-compose.yml](https://github.com/sourcebot-dev/sourcebot/blob/main/docker-compose.yml) file from the [Sourcebot repository](https://github.com/sourcebot-dev/sourcebot). This is the simplest way to get started with Sourcebot.
This guide will walk you through deploying Sourcebot locally or on a VM using [Docker Compose](https://github.com/sourcebot-dev/sourcebot/blob/main/docker-compose.yml). This is the simplest way to get started with Sourcebot.

If you are looking to deploy onto Kubernetes, see the [Kubernetes (Helm)](/docs/deployment/k8s) guide.

## Get started

<Steps>
<Step title="Requirements">
- docker & docker compose. Use [Docker Desktop](https://www.docker.com/products/docker-desktop/) on Mac or Windows.
</Step>
<Step title="Obtain the Docker Compose file">
Download the [docker-compose.yml](https://github.com/sourcebot-dev/sourcebot/blob/main/docker-compose.yml) file from the Sourcebot repository.

```bash wrap icon="terminal"
curl -o docker-compose.yml https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/docker-compose.yml
```
</Step>

<Step title="Create a config.json">

In the same directory as the `docker-compose.yml` file, create a [configuration file](/docs/configuration/config-file). The configuration file is a JSON file that configures Sourcebot's behaviour, including what repositories to index, language model providers, auth providers, and more.

```bash wrap icon="terminal" Create example config
touch config.json
echo '{
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
// Comments are supported.
// This config creates a single connection to GitHub.com that
// indexes the Sourcebot repository
"connections": {
"starter-connection": {
"type": "github",
"repos": [
"sourcebot-dev/sourcebot"
]
}
}
}' > config.json
```
</Step>

<Step title="Launch your instance">
Update the secrets in the `docker-compose.yml` and then run Sourcebot using:

```bash wrap icon="terminal"
docker compose up
```
</Step>

<Step title="Done">
You're all set! Navigate to [http://localhost:3000](http://localhost:3000) to access your Sourcebot instance.
</Step>
</Steps>
## System requirements
- RAM: Ensure your environment has at least 4GB of RAM. Insufficient memory can cause processes to crash.
- Docker & Docker Compose: Make sure both are installed and up-to-date.
- Node.js 18+: Required for the setup CLI

## Option 1: Setup CLI

The setup CLI will guide you through configuring your Sourcebot instance to connect to your code hosts and LLM providers. From a empty folder, run the following command:

```
npx setup-sourcebot
```

<Frame>
<img src="/images/setup_sourcebot_splash.png" alt="npx setup-sourcebot" />
</Frame>

## Option 2: Manual steps

### Obtain the Docker Compose file

Download the [docker-compose.yml](https://github.com/sourcebot-dev/sourcebot/blob/main/docker-compose.yml) file from the Sourcebot repository.

```bash wrap icon="terminal"
curl -o docker-compose.yml https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/docker-compose.yml
```

### Create a config.json

In the same directory as the `docker-compose.yml` file, create a [configuration file](/docs/configuration/config-file). The configuration file is a JSON file that configures Sourcebot's behaviour, including what repositories to index, language model providers, auth providers, and more.

```bash wrap icon="terminal" Create example config
touch config.json
echo '{
"$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
// Comments are supported.
// This config creates a single connection to GitHub.com that
// indexes the Sourcebot repository
"connections": {
"starter-connection": {
"type": "github",
"repos": [
"sourcebot-dev/sourcebot"
]
}
}
}' > config.json
```

### Launch your instance

Update the secrets in the `docker-compose.yml` and then run Sourcebot using:

```bash wrap icon="terminal"
docker compose up
```

Navigate to [http://localhost:3000](http://localhost:3000) to access your Sourcebot instance.

## Next steps

Expand Down
Binary file added docs/images/setup_sourcebot_splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions packages/setupWizard/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# setup-sourcebot

Interactive CLI wizard for setting up a self-hosted [Sourcebot](https://sourcebot.dev) instance.

## Usage

Run from an empty directory:

```bash
npx setup-sourcebot
```

The wizard walks you through:

- **Code hosts** — GitHub, GitLab, Bitbucket (Cloud or Data Center), Azure DevOps (Cloud or Server), Gitea, Gerrit, a local folder of cloned repos, or any other git URL.
- **AI providers** (optional) — Anthropic, OpenAI, Google Gemini, Google Vertex, DeepSeek, Mistral, xAI, OpenRouter, OpenAI-compatible endpoints, Amazon Bedrock, or Azure OpenAI. Powers [Ask](https://docs.sourcebot.dev/docs/features/ask/overview).

## Requirements

- Node.js 18+
- Docker and Docker Compose

## Docs

Full deployment guide: [docs.sourcebot.dev/docs/deployment/docker-compose](https://docs.sourcebot.dev/docs/deployment/docker-compose)
32 changes: 32 additions & 0 deletions packages/setupWizard/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "setup-sourcebot",
"version": "0.1.1",
"description": "CLI wizard for creating a Sourcebot configuration.",
"type": "module",
"bin": "./dist/index.js",
"scripts": {
"build": "tsc",
"watch": "tsc --watch",
"dev": "tsx src/index.ts",
"prepublishOnly": "yarn build"
},
"dependencies": {
"@inquirer/prompts": "^8.4.3",
"chalk": "^5.6.2",
"inquirer-select-pro": "^1.0.0-alpha.9",
"ora": "^9.4.0"
},
"devDependencies": {
"@sourcebot/schemas": "workspace:^",
"@types/node": "^22.7.5",
"tsx": "^4.21.0",
"typescript": "^5.6.2"
},
"engines": {
"node": ">=18"
},
"files": [
"dist",
"README.md"
]
}
99 changes: 99 additions & 0 deletions packages/setupWizard/src/azuredevops.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import { checkbox, confirm, input, password, select } from '@inquirer/prompts';
import type { AzureDevOpsConnectionConfig } from '@sourcebot/schemas/v3/azuredevops.type';
import type { CollectResult, EnvVars } from './utils.js';
import { multiInput, note, toEnvKey } from './utils.js';

export async function collectAzureDevOpsConfig(connectionName: string): Promise<CollectResult> {
const env: EnvVars = {};

const deploymentType = await select<'cloud' | 'server'>({
message: 'Which Azure DevOps deployment?',
choices: [
{ value: 'cloud', name: 'Azure DevOps Cloud', description: 'dev.azure.com' },
{ value: 'server', name: 'Azure DevOps Server', description: 'self-hosted' },
],
});

const config: AzureDevOpsConnectionConfig = {
type: 'azuredevops',
deploymentType,
token: { env: '' },
};

if (deploymentType === 'server') {
const url = await input({
message: 'Azure DevOps Server URL (e.g. https://ado.example.com)',
validate: (v) => {
if (!v?.trim()) {
return 'URL is required';
}
if (!/^https?:\/\//.test(v)) {
return 'Must start with http:// or https://';
}
return true;
},
});
config.url = url;

Comment thread
brendan-kellam marked this conversation as resolved.
const useTfsPath = await confirm({
message: 'Use legacy TFS path format (/tfs in API URLs)?',
default: false,
});
if (useTfsPath) {
config.useTfsPath = true;
}
}

note(
[
'Create a Personal Access Token at:',
deploymentType === 'cloud'
? ' https://dev.azure.com/<your-org>/_usersSettings/tokens'
: ' <your-server-url>/_usersSettings/tokens',
'Grant `Code (Read)` scope so Sourcebot can find and clone your repos.',
].join('\n'),
'Azure DevOps Personal Access Token',
);

const envKey = toEnvKey(connectionName, 'TOKEN');
const token = await password({
message: `Azure DevOps Personal Access Token (stored as ${envKey})`,
mask: true,
validate: (v) => !v?.trim() ? 'Token is required' : true,
});
env[envKey] = token;
config.token = { env: envKey };

const orgLabel = deploymentType === 'cloud' ? 'organization' : 'collection';
const orgLabelPlural = deploymentType === 'cloud' ? 'Organizations' : 'Collections';

const targets = await checkbox<string>({
message: 'What do you want to index?',
choices: [
{ value: 'orgs', name: orgLabelPlural, description: `all projects in a ${orgLabel}` },
{ value: 'projects', name: 'Specific projects', description: `${orgLabel}/project format` },
{ value: 'repos', name: 'Specific repositories', description: `${orgLabel}/project/repo format` },
],
required: true,
});

if (targets.includes('orgs')) {
config.orgs = await multiInput({
message: `${orgLabelPlural} to index`,
});
}

if (targets.includes('projects')) {
config.projects = await multiInput({
message: `Projects to index (${orgLabel}/project)`,
});
}

if (targets.includes('repos')) {
config.repos = await multiInput({
message: `Repositories to index (${orgLabel}/project/repo)`,
});
}

return { connections: [{ config }], env };
}
Loading
Loading