# Self-host SurrealDB

> A multi-model database for documents, graphs and relations with a SQL-like query language, using the RocksDB engine on a named volume. The root password is generated at install. Source available under the BSL.

- Page: https://levelrail.com/templates/surrealdb/
- JSON: https://levelrail.com/templates/surrealdb.json
- Category: Database Tools
- Licence: LicenseRef-BUSL-1.1 (Source available)
- Source: https://github.com/surrealdb/surrealdb
- Upstream docs: https://surrealdb.com/docs

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

## Services

| Service | Image | Tag | Ports | Volumes |
| --- | --- | --- | --- | --- |
| surrealdb | surrealdb/surrealdb | v2.1.2 | 8000 | surreal_data -> /data |

## Environment

| Service | Variable | Kind |
| --- | --- | --- |
| surrealdb | SURREAL_PASS | generated |
| surrealdb | SURREAL_USER | preset |

## Deploy

### CLI

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

### API

```bash
curl -X POST -H "Authorization: Bearer $TOKEN" \
  https://levelrail.example.com/api/v1/service-templates/surrealdb/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. Read the generated root password from the app secrets, then connect over HTTP or WebSocket on port 8000 as user root.

## Questions

### Can I deploy SurrealDB 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 surrealdb for this app, so check that entry as well. Dokku deploys container images with its own commands, so the pinned image surrealdb/surrealdb:v2.1.2 is what you deploy there.

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