> ## Documentation Index
> Fetch the complete documentation index at: https://gproxy.leenhawk.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Docker, Render, and Heroku

> Run the GPROXY container image, or deploy to Render or Heroku with PostgreSQL.

The deployments on this page use the same Docker image, which runs the ordinary `gproxy` CLI. On a host you manage yourself, the SQLite database is kept in a volume. Render and Heroku do not keep the local disk across restarts, so their templates run the same image with PostgreSQL.

## Docker

The same images are published to four registries for amd64, arm64 and riscv64. Use whichever is closest to you:

| Registry | Image |
| - | - |
| Docker Hub | `gproxy2/gproxy` |
| GitHub | `ghcr.io/leenhawk/gproxy` |
| GitLab | `registry.gitlab.com/leenhawk1/gproxy` |
| CNB | `docker.cnb.cool/leenhawk/gproxy` |

Stable releases are tagged `vX.Y.Z`, the beta channel is `staging`, and development snapshots are `nightly`. Append `-musl` to any tag for the musl build. Images with v3 tags run v3, not v4.

Start a container with a named volume for the data directory and your master key in the environment:

```sh theme={null}
export GPROXY_IMAGE='gproxy2/gproxy:<tag>'
# Set GPROXY_MASTER_KEY to your saved 32-byte key (64 hex digits or base64).
docker run -d --name gproxy --restart unless-stopped \
  -p 127.0.0.1:8787:8787 \
  -v gproxy-data:/app/data \
  -e GPROXY_MASTER_KEY \
  "$GPROXY_IMAGE"
docker logs gproxy
```

On the first start, GPROXY creates an administrator and an API key and prints the generated credentials to the log. Save them, then open `http://127.0.0.1:8787/console/`. The log is the only place they appear, so protect it.

The image listens on port 8787, keeps its SQLite database in `/app/data`, and runs as user `65532:65532`. If you bind-mount a host directory instead of using a named volume, that user must be able to write to it.

To move to a new version, stop and remove the container and start a new one from the new tag with the same volume and the same `GPROXY_MASTER_KEY`. The database is in the volume, so removing the container does not touch it.

## Render

[![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)][render-deploy]

The Render template is the `render.yaml` Blueprint in the repository root. It creates one web service on the free plan and no database: you supply an external PostgreSQL database.

1. Use the button above and review the Blueprint.
2. Set `GPROXY_DATABASE_URL` to your PostgreSQL connection URL and deploy. The database must accept connections from Render; keep any SSL parameters your provider requires in the URL.
3. Render generates `GPROXY_ADMIN_PASSWORD` and `GPROXY_MASTER_KEY`. Open the service's **Environment** settings and save a copy of both.
4. Open the service URL followed by `/console/` and sign in as `admin`.

The service's health check is `/healthz` on port `8787`. Free web services sleep when idle, so the first request after a pause is slow while the service wakes up. Pricing and limits of the external database are your provider's.

## Heroku

[![Deploy to Heroku](https://www.herokucdn.com/deploy/button.svg)][heroku-deploy]

The Heroku template is `app.json` and `heroku.yml` in the repository root. It creates one Basic web dyno and a `heroku-postgresql:essential-0` add-on. Both are paid; review the plans before you deploy.

1. Generate a master key with `openssl rand -hex 32` and save it.
2. Use the button above, choose an app name and region, and enter the key as `GPROXY_MASTER_KEY`. You can leave it empty, in which case upstream credentials are stored unencrypted in the database.
3. Review the dyno and the add-on, then deploy. Heroku generates `GPROXY_ADMIN_PASSWORD`.
4. Read the password under **Settings → Reveal Config Vars**, then sign in as `admin` at `/console/`.

The image is built from `deploy/container/Dockerfile.heroku`, which only refers to the release image and sets a few environment variables. The program listens on the `PORT` Heroku assigns and reads the add-on's `DATABASE_URL`. A dyno's local files are temporary, and everything that has to be kept (configuration, credentials, usage) is stored in PostgreSQL.

## Running the Render and Heroku templates

Both templates run the release image `ghcr.io/leenhawk/gproxy:latest`, the latest stable release. Nothing is compiled at deployment. The templates set `GPROXY_PLATFORM_ENV=1` and `GPROXY_PERSISTENCE=postgres`.

### Database

With `GPROXY_PLATFORM_ENV=1`, the program reads `GPROXY_DATABASE_URL` when `GPROXY_DSN` is unset, and the platform's `DATABASE_URL` when that is unset too; it reads `PORT` when `GPROXY_PORT` is unset. Keep the database and `GPROXY_MASTER_KEY` across updates and back up both.

### Updates

Redeploy to pull the latest stable release. To stay on one version, change the image tag from `latest` to `vX.Y.Z`: for Render in the image URL in `render.yaml`, for Heroku in the `FROM` line of `deploy/container/Dockerfile.heroku`.

### Instances

The templates start one application instance. The cache is kept in process memory and is empty after a restart. To run more than one instance you must set `GPROXY_REDIS_URL`.

### Public address

Set `GPROXY_PUBLIC_BASE_URL` to the service's public HTTPS origin if you use OAuth or published file links. The templates do not configure file storage, and files on the local disk are lost on restart.

### Client addresses

The client IP is taken from the TCP peer, which may be the platform's router. Forwarded client-IP headers are not trusted by default; to use them, set `GPROXY_TRUSTED_PROXIES` to the addresses of the platform's router.

### Connections

The program serves HTTP, SSE and WebSocket. The platform's router timeouts, idle limits and restarts still apply.

[render-deploy]: https://render.com/deploy?repo=https%3A%2F%2Fgithub.com%2FLeenHawk%2Fgproxy%2Ftree%2Fdev

[heroku-deploy]: https://heroku.com/deploy?template=https%3A%2F%2Fgithub.com%2FLeenHawk%2Fgproxy%2Ftree%2Fdev


## Related topics

- [Adding a Channel](https://gproxy.leenhawk.com/development/adding-a-channel.md)
- [GET /portal/api/oauth/device](https://gproxy.leenhawk.com/api-reference/portal/get-portalapioauthdevice.md)
- [Embedding the SDK](https://gproxy.leenhawk.com/development/embedding.md)
- [GET /admin/api/update/announcements](https://gproxy.leenhawk.com/api-reference/management/get-adminapiupdateannouncements.md)
- [Providers & Credentials](https://gproxy.leenhawk.com/guides/providers.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.