SourceAnt

Self-hosting

Run the SourceAnt review API on your own server using the published Docker image. This deployment is API only. You provide the database, model credentials and GitHub App.

To explore code and knowledge, manage skills and review changes on your machine, follow Local setup.

Prepare your server

You need Docker, a PostgreSQL database reachable from the containers, and an HTTPS address for GitHub deliveries. Keep the API and workers on the same image version and database configuration.

Create a .env file with your database connection, model and provider key, GitHub App credentials, webhook secret and JWT secret. Use the environment template as a reference and replace its placeholder values.

Start the API

The published image is ghcr.io/sourceant/sourceant. These commands use latest; pin a published image tag for a repeatable production deployment. Run them from the directory containing your .env and GitHub App private key.

docker pull ghcr.io/sourceant/sourceant:latest

docker run -d --name sourceant-api \
  --env-file .env \
  -e QUEUE_MODE=database \
  -e GITHUB_APP_PRIVATE_KEY_PATH=/app/private-key.pem \
  -v "$PWD/private-key.pem:/app/private-key.pem:ro" \
  -p 127.0.0.1:8000:8000 \
  ghcr.io/sourceant/sourceant:latest

The image applies database migrations before starting the API on port 8000. Make sure the container user can read the mounted private key.

docker logs sourceant-api
curl http://127.0.0.1:8000/

Check that the API responds before starting workers. Put your HTTPS reverse proxy in front of port 8000. The API reference is available at /docs.

Start the review worker

With the SQL queue, run a worker using the same database and credentials:

docker run -d --name sourceant-worker \
  --env-file .env \
  -e QUEUE_MODE=database \
  -e GITHUB_APP_PRIVATE_KEY_PATH=/app/private-key.pem \
  -v "$PWD/private-key.pem:/app/private-key.pem:ro" \
  --entrypoint sourceant \
  ghcr.io/sourceant/sourceant:latest work --lane interactive

Run workers for the batch and background lanes as needed for other queued work. See the deployment reference for configuration and worker options.

Connect your GitHub App

  1. Create a GitHub App for this server.
  2. Set its webhook URL to https://your-domain.com/api/prs/github-webhook and its webhook secret to the value of GITHUB_SECRET.
  3. Grant Contents: Read-only and Pull requests: Read & write, and subscribe to Pull request events.
  4. Set GITHUB_APP_ID and GITHUB_APP_CLIENT_ID in your environment file, and mount the App's private key in both containers.
  5. Install the App on the repositories you want reviewed.

Apply the App configuration before starting the containers. Open a pull request to check delivery and processing, using the App's delivery history and worker logs. See GitHub App setup for the full configuration.