🏠 Self-Host

Self-Hosting Sweep via Docker

This is a guide for self-hosting Sweep. If you are interested in our hosted version please visit https://github.com/apps/sweep-ai (opens in a new tab).

Sweep GitHub App is a locally running version of Sweep which serves many repositories at once.
To try out Sweep on a few example GitHub issues, see Sweep CLI.

Setting up the Sweep GitHub App involves:

  1. Creating the GitHub App.
  2. Hosting the Sweep backend on a cloud provider like DigitalOcean.

For help please contact us at team@sweep.dev.

Create GitHub App

Video Walkthrough:


Create a GitHub App here (opens in a new tab) (3 minutes). This tool will guide you through the process of creating a GitHub App and provide you with the necessary .env file.

It will be named .env.txt and you will need to rename it to .env (browser security reasons). It should look something like this.

.env
APP_ID=123456
PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----\n"
WEBHOOK_SECRET=213921898f9as8f92139128989f
GITHUB_CLIENT_ID=Iv1.123218f182131
GITHUB_CLIENT_SECRET=6g626312b212142132121321412

If the process fails, please follow the manual instructions instead.


OpenAI API key

Create an OpenAI API key (opens in a new tab) and add it to your .env:

.env
...
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Hosting Sweep

To host Sweep you need to run the Sweep webhook on a publicly accessible server. We recommend using a cloud provider(DigitalOcean, AWS, or Azure) but you can also run it locally and use a reverse proxy like Ngrok.

If you encounter issues please reach out to us through Email, Discord or open a GitHub issue (opens in a new tab). We are online, please ping us @kevin, @william, and @martin.

We recommend deploying on cloud for most users as the networking setup is easier. For this guide, we will use DigitalOcean.

1. Create Instance

Recommended specs:

  • OS: Ubuntu
  • RAM: 32 GB
  • CPU: 4 vCPUs
  • Storage: 100 GB
If you do not have Docker/Docker Compose setup
terminal
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository -y "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update -y
sudo apt install docker-ce -y
sudo systemctl enable docker
sudo systemctl start docker
sudo usermod -aG docker ${USER}

Start the docker client if you are on Mac/Windows.

2. Configure .env and pull Sweep
terminal
git clone https://github.com/sweepai/sweep
cd sweep
vim .env

Copy the following from your local .env to your remote .env:

.env
# Step 1
APP_ID=123456
PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----\n"
WEBHOOK_SECRET=213921898f9as8f92139128989f
GITHUB_CLIENT_ID=Iv1.123218f182131
GITHUB_CLIENT_SECRET=6g626312b212142132121321412
GITHUB_BOT_USERNAME=sweep-example-name
WHITELISTED_USERS=your-username,other-username
# Step 2
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
3. Deploy the Sweep backend
terminal
docker compose up --build hosted
# To run in background, docker compose up --build -d hosted
4. Update the GitHub Webhook URL

Get the IP address of your instance and add the port Sweep is deployed to (in this case, 8080):

http://YOUR_IP:8080

Navigating to this link should look like this:

Go to your GitHub app and update Webhook URL to the link above.

For user accounts:

https://github.com/settings/apps/GITHUB_BOT_USERNAME

For organizations:

https://github.com/YOUR_ORGANIZATION/sweepai/settings/apps/GITHUB_BOT_USERNAME

You have successfully deployed Sweep!

For enterprise support such as fine-tuning (20% performance gain), search index caching, usage tracking, and progress dashboards please contact team@sweep.dev.

Creating a Pull Request with Sweep

Use Sweep by creating a new issue on the repository with a title prefixed with Sweep: like Sweep: add type hints to BaseIndex.tsx. For more details see how to use Sweep (opens in a new tab).