# Self-host Coder

> A self-hosted platform for cloud development environments, backed by Postgres. This runs the Coder server only, with no Docker socket, so add workspace templates that use remote infrastructure. Create the first admin on first open.

- Page: https://levelrail.com/templates/coder/
- JSON: https://levelrail.com/templates/coder.json
- Category: Developer Tools
- Licence: AGPL-3.0-or-later (Network copyleft (AGPL) license)
- Source: https://github.com/coder/coder
- Upstream docs: https://coder.com/docs

## Requirements
- Memory: about 768 MiB
- amd64: unknown, arm64: unknown
- Needs configuration before start: no
- Pinned image tag: v2.39.1

## Services

| Service | Image | Tag | Ports | Volumes |
| --- | --- | --- | --- | --- |
| coder | ghcr.io/coder/coder | v2.39.1 | 7080 | none |
| db | postgres | 17.11-alpine | none | pgdata -> /var/lib/postgresql/data |

## Environment

| Service | Variable | Kind |
| --- | --- | --- |
| coder | CODER_ACCESS_URL | preset |
| coder | CODER_HTTP_ADDRESS | preset |
| coder | CODER_PG_CONNECTION_URL | generated |
| db | POSTGRES_DB | preset |
| db | POSTGRES_PASSWORD | generated |
| db | POSTGRES_USER | preset |

## Deploy

### CLI

```bash
levelrail-cli templates install coder --name my-coder
```

Add --domain SERVICE=HOST to serve a service on your own domain, for example --domain coder=app.example.com.

### API

```bash
curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  https://levelrail.example.com/api/v1/service-templates/coder/install \
  -d '{
    "name": "my-coder"
  }'
```

Create a token in the dashboard first. Name, env and domains are the request fields.

## First run
1. Open the page and create the first admin user.

## Questions

### Can I deploy Coder on Dokploy or Dokku?

The services and pinned images on this page can be run on any Docker host. The public Dokploy templates list has an entry with the id coder for this app, so check that entry as well. Dokku deploys container images with its own commands, so the pinned image ghcr.io/coder/coder:v2.39.1, postgres:17.11-alpine is what you deploy there.

Self-host Coder, Coder docker compose file, deploy Coder on a VPS: this page lists the pinned image, ports, volumes and the commands for each.
