diff --git a/Dockerfile b/Dockerfile
index ddfb2925f..41c677121 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -240,6 +240,8 @@ RUN mkdir -p /run/postgresql && \
# Make app directory accessible to both root and sourcebot user
RUN chown -R sourcebot:sourcebot /app
+# Make data directory accessible to both root and sourcebot user
+RUN chown -R sourcebot:sourcebot /data
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY prefix-output.sh ./prefix-output.sh
diff --git a/README.md b/README.md
index 0fc70f2e1..86375cb39 100644
--- a/README.md
+++ b/README.md
@@ -72,15 +72,22 @@ https://github.com/user-attachments/assets/31ec0669-707d-4e03-b511-1bc33d44197a
# Deploy Sourcebot
-Sourcebot can be deployed in seconds using our official docker image. Visit our [docs](https://docs.sourcebot.dev/docs/deployment-guide) for more information.
+Sourcebot can be deployed in seconds using Docker Compose. Visit our [docs](https://docs.sourcebot.dev/docs/deployment/docker-compose) for more information.
-1. Create a config
+1. Download the docker-compose.yml file
+```sh
+curl -o docker-compose.yml https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/docker-compose.yml
+```
+
+2. In the same directory as the `docker-compose.yml` file, create a [configuration file](https://docs.sourcebot.dev/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.
```sh
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": {
- // Comments are supported
"starter-connection": {
"type": "github",
"repos": [
@@ -91,30 +98,12 @@ echo '{
}' > config.json
```
-2. Run the docker container
+3. Update the secrets in the `docker-compose.yml` and then run Sourcebot using:
```sh
-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
+docker compose up
```
-
-What does this command do?
-
-- Pull and run the Sourcebot docker image from [ghcr.io/sourcebot-dev/sourcebot:latest](https://github.com/sourcebot-dev/sourcebot/pkgs/container/sourcebot).
-- Mount the current directory (`-v $(pwd):/data`) to allow Sourcebot to persist the `.sourcebot` cache.
-- Clones sourcebot at `HEAD` into `.sourcebot/github/sourcebot-dev/sourcebot`.
-- Indexes sourcebot into a .zoekt index file in `.sourcebot/index/`.
-- Map port 3000 between your machine and the docker image.
-- Starts the web server on port 3000.
-
-
-3. Visit `http://localhost:3000` to start using Sourcebot
+4. Visit `http://localhost:3000` to start using Sourcebot
To configure Sourcebot (index your own repos, connect your LLMs, etc), check out our [docs](https://docs.sourcebot.dev/docs/configuration/config-file).
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 000000000..a229a2caa
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,66 @@
+services:
+ sourcebot:
+ image: ghcr.io/sourcebot-dev/sourcebot:latest
+ user: sourcebot
+ restart: always
+ container_name: sourcebot
+ depends_on:
+ postgres:
+ condition: service_healthy
+ redis:
+ condition: service_healthy
+ ports:
+ - "3000:3000"
+ volumes:
+ - ./config.json:/data/config.json
+ - sourcebot_data:/data
+ 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:-}
+ - SOURCEBOT_TELEMETRY_DISABLED=${SOURCEBOT_TELEMETRY_DISABLED:-false}
+
+ # For the full list of environment variables see:
+ # https://docs.sourcebot.dev/docs/configuration/environment-variables
+
+ postgres:
+ image: docker.io/postgres:${POSTGRES_VERSION:-latest}
+ restart: always
+ healthcheck:
+ test: ["CMD-SHELL", "pg_isready -U postgres"]
+ interval: 3s
+ timeout: 3s
+ retries: 10
+ environment:
+ POSTGRES_USER: postgres
+ POSTGRES_PASSWORD: postgres # CHANGEME
+ POSTGRES_DB: postgres
+ ports:
+ - 127.0.0.1:5432:5432
+ volumes:
+ - sourcebot_postgres_data:/var/lib/postgresql/data
+
+ redis:
+ image: docker.io/redis:${REDIS_VERSION:-latest}
+ restart: always
+ ports:
+ - 127.0.0.1:6379:6379
+ healthcheck:
+ test: ["CMD", "redis-cli", "ping"]
+ interval: 3s
+ timeout: 10s
+ retries: 10
+ volumes:
+ - sourcebot_redis_data:/data
+
+volumes:
+ sourcebot_data:
+ driver: local
+ sourcebot_postgres_data:
+ driver: local
+ sourcebot_redis_data:
+ driver: local
diff --git a/docs/docs.json b/docs/docs.json
index 521e72924..fccfe7f1b 100644
--- a/docs/docs.json
+++ b/docs/docs.json
@@ -21,7 +21,13 @@
"group": "Getting Started",
"pages": [
"docs/overview",
- "docs/deployment-guide"
+ {
+ "group": "Deployment",
+ "pages": [
+ "docs/deployment/docker-compose",
+ "docs/deployment/k8s"
+ ]
+ }
]
},
{
diff --git a/docs/docs/configuration/environment-variables.mdx b/docs/docs/configuration/environment-variables.mdx
index 1fc78e2f5..fcf90eb4d 100644
--- a/docs/docs/configuration/environment-variables.mdx
+++ b/docs/docs/configuration/environment-variables.mdx
@@ -3,7 +3,7 @@ title: Environment variables
sidebarTitle: Environment variables
---
-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.
+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 guides](/docs/deployment/docker-compose) instead.
### Core Environment Variables
The following environment variables allow you to configure your Sourcebot deployment.
diff --git a/docs/docs/deployment-guide.mdx b/docs/docs/deployment-guide.mdx
deleted file mode 100644
index 7a9725e7b..000000000
--- a/docs/docs/deployment-guide.mdx
+++ /dev/null
@@ -1,88 +0,0 @@
----
-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.
-
-
-Hit an issue? Please let us know on [GitHub](https://github.com/sourcebot-dev/sourcebot/issues/new/choose) or by [emailing us](mailto:team@sourcebot.dev).
-
-
-
- - Docker -> use [Docker Desktop](https://www.docker.com/products/docker-desktop/) on Mac or Windows.
-
-
- 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/configuration/config-file).
-
-
-
- If you're deploying Sourcebot behind a domain, you must set the [AUTH_URL](/docs/configuration/environment-variables) environment variable.
-
-
- 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
- ```
-
-
- **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.
-
-
-
-
-
- Navigate to `http://localhost:3000` and complete the onboarding flow.
-
-
-
- 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).
-
-
-
-## Next steps
----
-
-
-
- Learn how to index your code using Sourcebot
-
-
- Learn how to configure language model providers to start using [Ask Sourcebot](/docs/features/ask/overview)
-
-
- Learn more about how to setup SSO, email codes, and other authentication providers.
-
-
\ No newline at end of file
diff --git a/docs/docs/deployment/docker-compose.mdx b/docs/docs/deployment/docker-compose.mdx
new file mode 100644
index 000000000..b3ff92d48
--- /dev/null
+++ b/docs/docs/deployment/docker-compose.mdx
@@ -0,0 +1,61 @@
+---
+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. 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
+
+
+
+ - docker & docker compose. Use [Docker Desktop](https://www.docker.com/products/docker-desktop/) on Mac or Windows.
+
+
+ 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
+ ```
+
+
+
+
+ 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
+ ```
+
+
+
+ Update the secrets in the `docker-compose.yml` and then run Sourcebot using:
+
+ ```bash wrap icon="terminal"
+ docker compose up
+ ```
+
+
+
+ You're all set! Navigate to [http://localhost:3000](http://localhost:3000) to access your Sourcebot instance.
+
+
+
+## Next steps
+
+
diff --git a/docs/docs/deployment/k8s.mdx b/docs/docs/deployment/k8s.mdx
new file mode 100644
index 000000000..e943c0223
--- /dev/null
+++ b/docs/docs/deployment/k8s.mdx
@@ -0,0 +1,4 @@
+---
+title: "Kubernetes (Helm)"
+url: https://github.com/sourcebot-dev/sourcebot-helm-chart
+---
\ No newline at end of file
diff --git a/docs/docs/features/agents/review-agent.mdx b/docs/docs/features/agents/review-agent.mdx
index 49e1834d5..41416f759 100644
--- a/docs/docs/features/agents/review-agent.mdx
+++ b/docs/docs/features/agents/review-agent.mdx
@@ -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.
-The AI Code Review Agent is [fair 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)
+The AI Code Review Agent is [fair 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/docker-compose)
and then follow the configuration instructions below.

diff --git a/docs/docs/features/ask/overview.mdx b/docs/docs/features/ask/overview.mdx
index cd48b8c9a..9e877089e 100644
--- a/docs/docs/features/ask/overview.mdx
+++ b/docs/docs/features/ask/overview.mdx
@@ -14,7 +14,7 @@ follow code nav references, and provide an answer that’s rich with inline cita
Learn how to index your repos so you can ask questions about them
-
+
Learn how to self-host Sourcebot in a few simple steps.
diff --git a/docs/docs/features/mcp-server.mdx b/docs/docs/features/mcp-server.mdx
index adfb98ce1..973512963 100644
--- a/docs/docs/features/mcp-server.mdx
+++ b/docs/docs/features/mcp-server.mdx
@@ -9,7 +9,7 @@ The [Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP)
- 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.
+ Follow the [deployment guides](/docs/deployment/docker-compose) 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).
diff --git a/docs/docs/features/search/overview.mdx b/docs/docs/features/search/overview.mdx
index 5f703a3ca..f5372ba45 100644
--- a/docs/docs/features/search/overview.mdx
+++ b/docs/docs/features/search/overview.mdx
@@ -22,7 +22,7 @@ Search across all your repos/branches across any code host platform. Blazingly f
Learn how to index and search through your branches
-
+
Learn how to self-host Sourcebot in a few simple steps.
diff --git a/docs/docs/overview.mdx b/docs/docs/overview.mdx
index 15a42dcb6..3b2b96ff3 100644
--- a/docs/docs/overview.mdx
+++ b/docs/docs/overview.mdx
@@ -9,7 +9,7 @@ title: "Overview"
- [MCP](/docs/features/mcp-server): Enrich agent context windows with code across your organization
-
+
Learn how to self-host Sourcebot in a few simple steps.
@@ -162,7 +162,7 @@ Sourcebot is designed to be easily self-hosted, allowing you to deploy it onto y
---
-
+