# Self-host CockroachDB

> A distributed SQL database that speaks the Postgres wire protocol, run as one insecure node for development and small workloads. The SQL port is private, the admin console is the web page. Source available license.

- Page: https://levelrail.com/templates/cockroachdb/
- JSON: https://levelrail.com/templates/cockroachdb.json
- Category: Database Tools
- Licence: LicenseRef-CockroachDB-Software-License (Source available)
- Source: https://github.com/cockroachdb/cockroach
- Upstream docs: https://www.cockroachlabs.com/docs/

## Requirements
- Memory: about 1 GiB
- amd64: unknown, arm64: unknown
- Needs configuration before start: no
- Pinned image tag: v24.3.1

## Services

| Service | Image | Tag | Ports | Volumes |
| --- | --- | --- | --- | --- |
| cockroachdb | cockroachdb/cockroach | v24.3.1 | 8080, 26257 | cockroach_data -> /cockroach/cockroach-data |

## Deploy

### CLI

```bash
levelrail-cli templates deploy cockroachdb --name my-cockroachdb
```

### API

```bash
curl -X POST -H "Authorization: Bearer $TOKEN" \
  https://levelrail.example.com/api/v1/service-templates/cockroachdb/deploy
```

Create a token in the dashboard first. This one-click route deploys it as a trial app you can keep or remove.

## First run
1. Open the admin console, and connect clients from this project to cockroachdb:26257 as root with no password.

## Questions

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

The services and pinned images on this page can be run on any Docker host. The public Dokploy templates list we compared does not have an entry with the same id for CockroachDB, so on Dokploy you would use a Docker Compose application with the file from this page. Dokku deploys container images with its own commands, so the pinned image cockroachdb/cockroach:v24.3.1 is what you deploy there.

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