Skip to content

Conversation

brendan-kellam
Copy link
Contributor

@brendan-kellam brendan-kellam commented Aug 26, 2025

Adds a basic docker-compose file to simplify the local deployment story of Sourcebot. Also updates the deployment docs to use the docker-compose file.

Summary by CodeRabbit

  • New Features

    • Added a Docker Compose service for running the app locally with a single command.
    • Exposes the web UI on port 3000, supports persistent storage, auto-restart, and configuration via environment variables.
  • Documentation

    • Rewrote the deployment guide to a Docker Compose–based workflow with a step-by-step walkthrough.
    • Added a curl command to fetch the compose file and updated requirements.
    • Replaced docker run instructions with docker compose up -d.
    • Improved onboarding link and added references to configuration docs and support.

Copy link

coderabbitai bot commented Aug 26, 2025

Walkthrough

Adds a docker-compose service for running Sourcebot with persistent volume, host-mounted config, ports, environment variables, and restart policy. Updates the deployment guide to use Docker Compose instead of docker run, including steps to fetch the compose file and launch the service, plus links to configuration docs.

Changes

Cohort / File(s) Summary of Changes
Container orchestration
docker-compose.yml
Introduces a sourcebot service using ghcr.io/sourcebot-dev/sourcebot:latest, pull_policy: always, port 3000:3000, host config bind ./config.json:/data/config.json, named volume sourcebot_data:/data, extensive env vars, and restart: unless-stopped. Declares sourcebot_data volume.
Documentation
docs/docs/deployment-guide.mdx
Rewrites deployment to a Docker Compose workflow: adds step to obtain the compose file, replaces docker run with docker compose up -d, updates requirements wording, adjusts onboarding link, removes old accordion details, and references env-vars configuration docs.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as Developer
  participant DC as Docker Compose
  participant C as Sourcebot Container
  participant V as Named Volume (sourcebot_data)
  participant CFG as Host Config (./config.json)

  Dev->>DC: docker compose up -d
  DC->>C: Create & start container (image: ghcr.io/.../sourcebot:latest)
  Note over C: Env vars injected<br/>Port 3000 exposed
  DC-->>V: Attach /data volume
  DC-->>C: Bind ./config.json -> /data/config.json
  C->>CFG: Read configuration
  C->>V: Persist runtime data under /data
  C-->>Dev: Service listening on http://localhost:3000
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I stacked my dreams in YAML rows,
A burrow of services, up it goes!
Compose hums softly, ports align—
Configs nibble, volumes dine.
With a twitch and docker’s cheer,
Sourcebot hops to life right here.
Bun-believable, the app is near! 🐇🚀

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bkellam/docker-compose-single

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@brendan-kellam your pull request is missing a changelog!

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (9)
docker-compose.yml (5)

3-4: Avoid the “latest” tag; pin to a version or digest

latest makes builds non-reproducible and can break users unexpectedly. Pin to a semver tag (e.g., 0.15.2) or a digest; keep pull_policy if you want freshness.

-    image: ghcr.io/sourcebot-dev/sourcebot:latest
+    image: ghcr.io/sourcebot-dev/sourcebot:0.15.2

Alternatively:

-    image: ghcr.io/sourcebot-dev/sourcebot:latest
+    image: ghcr.io/sourcebot-dev/sourcebot@sha256:<digest>

11-57: Use env_file to keep secrets out of the compose and simplify overrides

Listing dozens of envs inline encourages committing secrets. Compose supports env_file: .env, which plays well with your defaults. Recommend adding env_file and trimming the inline list to only required keys with sane defaults.

   sourcebot:
+    env_file:
+      - .env

Docs should include a sample .env and .gitignore guidance. I can add that if you want.


48-49: If GOOGLE_APPLICATION_CREDENTIALS is set, mount the credentials file

Users setting GOOGLE_APPLICATION_CREDENTIALS will need to bind-mount the referenced path. Provide a commented example to prevent 404 path errors.

     volumes:
       - sourcebot_data:/data
       - ./config.json:/config/config.json
+      # Example: mount GCP service account JSON if using Vertex/GenAI
+      # - ./gcp-sa.json:/gcp/sa.json

And in env:

-      - GOOGLE_APPLICATION_CREDENTIALS=${GOOGLE_APPLICATION_CREDENTIALS:-}
+      - GOOGLE_APPLICATION_CREDENTIALS=${GOOGLE_APPLICATION_CREDENTIALS:-/gcp/sa.json}

Also applies to: 8-10


5-5: container_name can hinder scaling and “docker compose up --scale”

Not a blocker here, but consider dropping container_name for more flexibility in multi-replica or side-by-side runs.


58-58: Optional: add a basic healthcheck for better UX and orchestration

A healthcheck enables “healthy” status and plays nicely with depends_on conditions. If your app exposes one, wire it in.

   sourcebot:
@@
     restart: unless-stopped
+    healthcheck:
+      test: ["CMD-SHELL", "curl -fsS http://localhost:3000/health || exit 1"]
+      interval: 10s
+      timeout: 3s
+      retries: 10

If the health endpoint differs, please replace accordingly.

docs/docs/deployment-guide.mdx (4)

7-7: Capitalize “Docker Compose” consistently

Minor copy tweak for brand consistency.

-The following guide will walk you through the steps to deploy Sourcebot locally using [Docker compose](https://docs.docker.com/compose).
+The following guide will walk you through the steps to deploy Sourcebot locally using [Docker Compose](https://docs.docker.com/compose).

20-24: Pin the curl URL to a released tag/commit for reproducibility

Pulling docker-compose.yml from main can drift and break the walkthrough. Suggest pinning to a release tag (or commit SHA) and optionally mentioning how to grab “latest.”

-Download the [docker-compose.yml](https://github.com/sourcebot-dev/sourcebot/blob/main/docker-compose.yml) file from the Sourcebot repository.
+Download the [docker-compose.yml](https://github.com/sourcebot-dev/sourcebot/blob/v0.15.2/docker-compose.yml) file from the Sourcebot repository.
@@
-curl -o docker-compose.yml https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/docker-compose.yml
+curl -o docker-compose.yml https://raw.githubusercontent.com/sourcebot-dev/sourcebot/v0.15.2/docker-compose.yml
+# Or, to fetch the latest from main (may change without notice):
+# curl -o docker-compose.yml https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/docker-compose.yml

35-36: Confirm JSON-with-comments support or remove the inline comment

The sample uses // comments inside JSON. If config.json is strict JSON, this will break copying/pasting. If JSONC is supported, add a brief note and link to the parser support; otherwise, remove the comment from the sample.

-                // comments are supported 
+                // Comments are supported in config.json (JSONC). See the docs for details.

Or drop the line entirely if not supported.

Also applies to: 45-46


17-19: Add a .env step to manage secrets cleanly

Since the compose relies heavily on environment variables, add a step to create a .env file and reference security hygiene (.gitignore).

     <Step title="Requirements">
-        - docker & docker compose -> use [Docker Desktop](https://www.docker.com/products/docker-desktop/) on Mac or Windows.
+        - docker & docker compose -> use [Docker Desktop](https://www.docker.com/products/docker-desktop/) on Mac or Windows.
+        - a text editor to create config.json and a .env file (don’t commit .env)
     </Step>
+    <Step title="Create a .env file (recommended)">
+        Create a `.env` file with your environment variables (database, redis, auth, provider keys). The compose will auto-load it.
+
+        ```bash wrap icon="terminal"
+        cat > .env << 'EOF'
+        AUTH_URL=http://localhost:3000
+        DATABASE_URL=postgresql://postgres:postgres@postgres:5432/sourcebot
+        REDIS_URL=redis://redis:6379
+        # OPENAI_API_KEY=...
+        EOF
+        ```
+    </Step>
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ca9069e and a538453.

📒 Files selected for processing (2)
  • docker-compose.yml (1 hunks)
  • docs/docs/deployment-guide.mdx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*

📄 CodeRabbit inference engine (.cursor/rules/style.mdc)

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.

Files:

  • docker-compose.yml
  • docs/docs/deployment-guide.mdx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (2)
docker-compose.yml (1)

60-62: LGTM on volume declaration

Named volume for app data is appropriate for local persistence.

docs/docs/deployment-guide.mdx (1)

67-67: Nice cross-link to env var docs

Good addition for discoverability.

Comment on lines +8 to +10
volumes:
- ./config.json:/data/config.json
- sourcebot_data:/data
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix overlapping mounts: config bind is shadowed by the /data volume

You’re bind-mounting a file inside a directory that’s also mounted as a named volume. The /data volume will mask the file bind to /data/config.json at runtime, so CONFIG_PATH will not resolve to the host’s config.json.

Refactor to mount the config at a separate path and update CONFIG_PATH accordingly.

 services:
   sourcebot:
@@
-    volumes:
-      - ./config.json:/data/config.json
-      - sourcebot_data:/data
+    volumes:
+      - sourcebot_data:/data
+      - ./config.json:/config/config.json
@@
-      - CONFIG_PATH=/data/config.json
+      - CONFIG_PATH=/config/config.json

Also applies to: 12-12

🤖 Prompt for AI Agents
In docker-compose.yml around lines 8-10 (and also line 12), the bind-mount of
./config.json to /data/config.json is being shadowed by the named volume mounted
at /data; move the host config bind to a separate non-overlapping path (for
example /config/config.json or /app/config.json) and update the service's
CONFIG_PATH environment variable to point to that new path, leaving the named
volume mounted at /data unchanged so the file bind is not masked at runtime.

Comment on lines +13 to +15
- DATABASE_URL=${DATABASE_URL:-postgresql://postgres@localhost:5432/sourcebot}
- REDIS_URL=${REDIS_URL:-redis://localhost:6379}
- AUTH_URL=${AUTH_URL:-http://localhost:3000}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Default DATABASE_URL/REDIS_URL point to “localhost” inside the container; app won’t boot without external services

As written, the service will try to reach Postgres and Redis on 127.0.0.1 inside the container, where nothing is listening. For a “basic local deployment,” users will hit connection failures unless they override envs to managed services or you provision DB/cache within the same compose file.

Two workable options (pick one):

  • Provide Postgres and Redis services in this compose and point URLs to service DNS names.
  • Keep a single-service compose, but default DATABASE_URL/REDIS_URL to host.docker.internal for Mac/Windows and call this out in docs, with a Linux note.

I recommend bundling Postgres/Redis for a turnkey local flow. Example patch:

 services:
   sourcebot:
@@
-      - DATABASE_URL=${DATABASE_URL:-postgresql://postgres@localhost:5432/sourcebot}
-      - REDIS_URL=${REDIS_URL:-redis://localhost:6379}
+      - DATABASE_URL=${DATABASE_URL:-postgresql://postgres:postgres@postgres:5432/sourcebot}
+      - REDIS_URL=${REDIS_URL:-redis://redis:6379}
+    depends_on:
+      postgres:
+        condition: service_healthy
+      redis:
+        condition: service_healthy
@@
+  postgres:
+    image: postgres:16-alpine
+    environment:
+      - POSTGRES_DB=sourcebot
+      - POSTGRES_USER=postgres
+      - POSTGRES_PASSWORD=postgres
+    volumes:
+      - sourcebot_pg:/var/lib/postgresql/data
+    healthcheck:
+      test: ["CMD-SHELL", "pg_isready -U postgres -d sourcebot"]
+      interval: 5s
+      timeout: 3s
+      retries: 30
+
+  redis:
+    image: redis:7-alpine
+    command: ["redis-server", "--appendonly", "yes"]
+    healthcheck:
+      test: ["CMD", "redis-cli", "ping"]
+      interval: 5s
+      timeout: 3s
+      retries: 30
@@
 volumes:
   sourcebot_data:
     driver: local
+  sourcebot_pg:

If you prefer keeping the single-service compose, consider:

-      - DATABASE_URL=${DATABASE_URL:-postgresql://postgres@localhost:5432/sourcebot}
-      - REDIS_URL=${REDIS_URL:-redis://localhost:6379}
+      - DATABASE_URL=${DATABASE_URL:-postgresql://postgres@host.docker.internal:5432/sourcebot}
+      - REDIS_URL=${REDIS_URL:-redis://host.docker.internal:6379}

…and document Linux alternatives. I can open a follow-up PR with either approach.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- DATABASE_URL=${DATABASE_URL:-postgresql://postgres@localhost:5432/sourcebot}
- REDIS_URL=${REDIS_URL:-redis://localhost:6379}
- AUTH_URL=${AUTH_URL:-http://localhost:3000}
services:
sourcebot:
environment:
- DATABASE_URL=${DATABASE_URL:-postgresql://postgres:postgres@postgres:5432/sourcebot}
- REDIS_URL=${REDIS_URL:-redis://redis:6379}
- AUTH_URL=${AUTH_URL:-http://localhost:3000}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
postgres:
image: postgres:16-alpine
environment:
- POSTGRES_DB=sourcebot
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
volumes:
- sourcebot_pg:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d sourcebot"]
interval: 5s
timeout: 3s
retries: 30
redis:
image: redis:7-alpine
command: ["redis-server", "--appendonly", "yes"]
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 30
volumes:
sourcebot_data:
driver: local
sourcebot_pg:
🤖 Prompt for AI Agents
In docker-compose.yml around lines 13-15, the DATABASE_URL/REDIS_URL default to
localhost which points inside the container and breaks startup; instead add
Postgres and Redis services to this compose and change the defaults to use the
service hostnames (e.g. DATABASE_URL to
postgresql://postgres@postgres:5432/sourcebot and REDIS_URL to
redis://redis:6379), and ensure the new services have basic configuration
(image, volumes for persistence, environment for Postgres user/db, and ports as
needed) so the app can connect to them by service DNS; alternatively, if you
prefer a single-service compose, change the defaults to use host.docker.internal
and document Linux caveats, but the preferred fix is bundling Postgres and Redis
and pointing the env defaults to those service names.

Comment on lines 48 to 55
<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>

Launch your Sourcebot instance:

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
```bash wrap icon="terminal"
docker compose up -d
```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Launching will fail without Postgres/Redis; add guidance or include them in compose

Given the compose currently runs only Sourcebot, the defaults point to localhost inside the container and the app will fail to connect. Either:

  • Add Postgres/Redis services to docker-compose.yml (preferred), or
  • Instruct users to set DATABASE_URL/REDIS_URL to reachable endpoints (e.g., host.docker.internal for Mac/Windows) before running docker compose up -d, with a Linux note.

Suggest adding one of the following snippets here for a turnkey experience.

Option A (recommended): direct users to a compose file that includes Postgres/Redis.

curl -o docker-compose.yml https://raw.githubusercontent.com/sourcebot-dev/sourcebot/v0.15.2/examples/docker-compose.with-db.yml
docker compose up -d

Option B: configure external services via .env.

cat > .env << 'EOF'
DATABASE_URL=postgresql://postgres:postgres@host.docker.internal:5432/sourcebot
REDIS_URL=redis://host.docker.internal:6379
AUTH_URL=http://localhost:3000
EOF

docker compose up -d

I can contribute the examples/docker-compose.with-db.yml variant if helpful.

🤖 Prompt for AI Agents
In docs/docs/deployment-guide.mdx around lines 48-55, the guide currently only
runs Sourcebot and will fail because Postgres/Redis are not available inside the
container; update this section to either (A) point readers to a docker-compose
that includes Postgres and Redis (preferred) by showing the curl command to
fetch examples/docker-compose.with-db.yml and then docker compose up -d, or (B)
provide an alternative .env snippet and instructions to set DATABASE_URL and
REDIS_URL to reachable endpoints (e.g., host.docker.internal on Mac/Windows,
note Linux differences) before running docker compose up -d; include both
options concisely so users can choose turnkey compose or external service
configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants