# Self-hosting

> Run VisualCI on your own machines. The server, CLI and renderers are open source under Apache-2.0; you need Postgres, an S3-compatible bucket and a machine for the renderers.

Source: https://visualci.com/docs/self-hosting/
All of VisualCI's documentation: https://visualci.com/llms.txt

VisualCI is open source under Apache-2.0, in one repository: [github.com/DocSpring/visualci](https://github.com/DocSpring/visualci). The server, the CLI, the fingerprint library and the renderers are all there, and self-hosting is free.

## What it needs

- **Postgres** for builds, snapshots, baselines and the job queue.
- **An S3-compatible bucket** for uploaded files, rendered pages and diff images: S3, R2, MinIO and RustFS all work.
- **The server**, `docker/server.Dockerfile`. It serves the API, the MCP server and the web app, and runs the comparison workers.
- **A machine for the renderers**, `docker/renderer.Dockerfile`. They draw PDFs into page images. They handle untrusted files, so run them on a machine of their own, sandboxed (we use gVisor), with no network access beyond the server.

## The server

Set these environment variables:

| Variable | What it is |
| --- | --- |
| `DATABASE_URL` | The Postgres URL. Migrations run when the server starts. |
| `S3_ENDPOINT`, `S3_BUCKET`, `S3_ACCESS_KEY_ID`, `S3_SECRET_ACCESS_KEY` | The bucket. |
| `JWT_SECRET` | Signs sign-in sessions. |
| `RENDERER_TOKEN` | A secret the renderers send with every request. |
| `RENDERER_VERSION` | The renderer image's version (`docker/renderer.version`). It's part of every render cache key. |
| `PUBLIC_URL` | The server's address, such as `https://visualci.example.com`. |
| `GITHUB_CLIENT_ID`, `GITHUB_CLIENT_SECRET` | Sign-in with GitHub. |
| `GITHUB_APP_ID` | Optional: a GitHub App of your own, for checks on pull requests. |

## The renderers

Each renderer asks the server for work, draws the PDF and uploads the pages:

| Variable | What it is |
| --- | --- |
| `VISUALCI_API_URL` | The server's address. |
| `VISUALCI_RENDERER_TOKEN` | The server's `RENDERER_TOKEN`. |
| `VISUALCI_RENDERER_VERSION` | Set by the image. |

Run as many as you need: they share the queue.

## Pointing the CLI at it

Set `VISUALCI_API_URL` to your server's address wherever the CLI runs, and use project tokens from your server. Everything else in these docs works the same.
