Skip to main content
Deploy Compiler to Heroku using container-based deployment. This guide covers dynos with ephemeral storage, where repositories are fetched on demand. For Kubernetes, ECS or another platform, see Other platforms.

Prerequisites

  • A Heroku account with container registry access
  • The Heroku CLI installed

How it works

Heroku dynos have ephemeral filesystems: any files written to disk are lost when the dyno restarts. This deployment configures Compiler to:
  1. Store repository metadata in Heroku Postgres (persistent)
  2. Clone repositories on demand to /tmp/repos (ephemeral)
  3. Re-clone missing repositories automatically when someone asks a question

Setup

1

Create a wrapper repository

Create a new repository with the following heroku.yml:
heroku.yml
And a Dockerfile that pulls the Compiler image:
Dockerfile
2

Create the Heroku app

3

Add Heroku Postgres

This sets the DATABASE_URL environment variable automatically. Heroku Postgres requires SSL, so enable it:
4

Add Heroku Key-Value Store

Compiler needs Redis 7 or later, which Heroku provides as Key-Value Store. The app refuses to start without REDIS_URL. It holds resumable stream state so a client can reconnect to an in-progress response.
5

Configure environment variables

Set PUBLIC_URL to the app’s web URL, which heroku info -a your-app-name shows, or to your custom domain. The MCP server, Slack and links to conversations need it.
Back up TOKEN_ENCRYPTION_KEY. If it is lost, every stored credential (GitHub App key, GitLab access token, AI provider keys, storage keys, Slack app secrets, connector tokens) has to be entered again, and Slack has to be reconnected.
6

Deploy

7

Finish setup

Open https://your-app-name-1234.herokuapp.com/setup, fill in the Set up your instance form to create the owner account, and click Save. Setup then walks you through:
  1. Connecting your code, through a GitHub App or a GitLab access token
  2. Choosing an AI provider, either the Anthropic API or AWS Bedrock
  3. Creating your first project

Environment variables

The AI provider (Anthropic API or AWS Bedrock), the GitHub App, the GitLab connection, file storage and Slack are configured in the app after first login, not through environment variables. See Environment variables for the optional ones. Compiler checks for new releases when it starts, including when an eco dyno wakes, and once a day while it runs. It sends instances.usecompiler.com only its version and an anonymous instance ID, which is derived from TOKEN_ENCRYPTION_KEY and reveals nothing about it. No names, emails, code, conversations or the address your instance is served on are sent. As with any web request, the IP address it comes from reaches our servers and may appear in their logs, but it isn’t saved with the check. Admins then see when a newer release is out at the bottom of Settings. To turn it off, run heroku config:set CHECK_FOR_UPDATES=false -a your-app-name.

Behavior on dyno restart

When a Heroku dyno restarts:
  1. All cloned repositories in /tmp/repos are lost
  2. Repository metadata remains in Heroku Postgres
  3. The server starts immediately
  4. When someone asks a question, Compiler first fetches the project’s repositories and re-clones any that are missing
  5. The answer starts once the repositories are ready, so the first question after a restart takes longer

Performance considerations

On eco dynos, the app sleeps after 30 minutes of inactivity. Waking up triggers a full restart, so repositories are re-cloned on the first question after it wakes.

Updating

If the upstream Dockerfile changed, pull it first, then push:
Or rebuild with the latest base image: