diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..5c31f8a1 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,62 @@ +services: + sourcebot: + image: ghcr.io/sourcebot-dev/sourcebot:latest + pull_policy: always + container_name: sourcebot + ports: + - "3000:3000" + volumes: + - ./config.json:/data/config.json + - sourcebot_data:/data + environment: + - CONFIG_PATH=/data/config.json + - DATABASE_URL=${DATABASE_URL:-postgresql://postgres@localhost:5432/sourcebot} + - REDIS_URL=${REDIS_URL:-redis://localhost:6379} + - AUTH_URL=${AUTH_URL:-http://localhost:3000} + - AUTH_SECRET=${AUTH_SECRET:-} + - AUTH_CREDENTIALS_LOGIN_ENABLED=${AUTH_CREDENTIALS_LOGIN_ENABLED:-true} + - AUTH_EMAIL_CODE_LOGIN_ENABLED=${AUTH_EMAIL_CODE_LOGIN_ENABLED:-false} + - SMTP_CONNECTION_URL=${SMTP_CONNECTION_URL:-} + - EMAIL_FROM_ADDRESS=${EMAIL_FROM_ADDRESS:-} + - SOURCEBOT_EE_LICENSE_KEY=${SOURCEBOT_EE_LICENSE_KEY:-} + - SOURCEBOT_ENCRYPTION_KEY=${SOURCEBOT_ENCRYPTION_KEY:-} + - SOURCEBOT_TELEMETRY_DISABLED=${SOURCEBOT_TELEMETRY_DISABLED:-false} + - ZOEKT_WEBSERVER_URL=${ZOEKT_WEBSERVER_URL:-http://localhost:6070} + - SHARD_MAX_MATCH_COUNT=${SHARD_MAX_MATCH_COUNT:-} + - TOTAL_MAX_MATCH_COUNT=${TOTAL_MAX_MATCH_COUNT:-} + - ZOEKT_MAX_WALL_TIME_MS=${ZOEKT_MAX_WALL_TIME_MS:-} + + # AWS + - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-} + - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-} + - AWS_SESSION_TOKEN=${AWS_SESSION_TOKEN:-} + - AWS_REGION=${AWS_REGION:-} + # OpenAI + - OPENAI_API_KEY=${OPENAI_API_KEY:-} + # Anthropic + - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:-} + # Azure + - AZURE_API_KEY=${AZURE_API_KEY:-} + - AZURE_RESOURCE_NAME=${AZURE_RESOURCE_NAME:-} + # DeepSeek + - DEEPSEEK_API_KEY=${DEEPSEEK_API_KEY:-} + # Google gen ai + - GOOGLE_GENERATIVE_AI_API_KEY=${GOOGLE_GENERATIVE_AI_API_KEY:-} + # Google vertex + - GOOGLE_VERTEX_PROJECT=${GOOGLE_VERTEX_PROJECT:-} + - GOOGLE_VERTEX_REGION=${GOOGLE_VERTEX_REGION:-} + - GOOGLE_APPLICATION_CREDENTIALS=${GOOGLE_APPLICATION_CREDENTIALS:-} + - GOOGLE_VERTEX_THINKING_BUDGET_TOKENS=${GOOGLE_VERTEX_THINKING_BUDGET_TOKENS:-} + - GOOGLE_VERTEX_INCLUDE_THOUGHTS=${GOOGLE_VERTEX_INCLUDE_THOUGHTS:-} + # XAI + - XAI_API_KEY=${XAI_API_KEY:-} + # Mistral + - MISTRAL_API_KEY=${MISTRAL_API_KEY:-} + # Openrouter + - OPENROUTER_API_KEY=${OPENROUTER_API_KEY:-} + + restart: unless-stopped + +volumes: + sourcebot_data: + driver: local diff --git a/docs/docs/deployment-guide.mdx b/docs/docs/deployment-guide.mdx index 7a9725e7..3a783907 100644 --- a/docs/docs/deployment-guide.mdx +++ b/docs/docs/deployment-guide.mdx @@ -4,14 +4,24 @@ 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. +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. The following guide will walk you through the steps to deploy Sourcebot locally using [Docker compose](https://docs.docker.com/compose). -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). +Hit an issue? Please let us know on [GitHub](https://github.com/sourcebot-dev/sourcebot/issues/new) or by [emailing us](mailto:team@sourcebot.dev). + +## Walkthrough +--- - - Docker -> 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. + + + 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` file that tells Sourcebot which repositories to sync and index: @@ -38,33 +48,15 @@ The following guide will walk you through the steps to deploy Sourcebot on your If you're deploying Sourcebot behind a domain, you must set the [AUTH_URL](/docs/configuration/environment-variables) environment variable. + 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 ``` - - - **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. + Navigate to [http://localhost:3000](http://localhost:3000) and complete the onboarding flow. @@ -72,6 +64,8 @@ The following guide will walk you through the steps to deploy Sourcebot on your +Checkout the [configuration docs](/docs/configuration/environment-variables) to learn more about how to configure your deployment. + ## Next steps ---