---
title: "Deploy RethinkDB | (Just Updated) Realtime Database, Password On From Boot"
description: "RethinkDB realtime DB. Password on from boot, data kept, TCP proxy ready"
category: "Storage"
url: https://railway.com/deploy/rethinkdb-or-just-updated-realtime-datab
---

# Deploy RethinkDB | (Just Updated) Realtime Database, Password On From Boot

RethinkDB realtime DB. Password on from boot, data kept, TCP proxy ready

**[Deploy RethinkDB | (Just Updated) Realtime Database, Password On From Boot on Railway](https://railway.com/template/rethinkdb-or-just-updated-realtime-datab)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/rethinkdb-or-just-updated-realtime-datab/manifest.json

- **Creator:** SuperSlowSloth
- **Category:** Storage

## Template content

### rethinkdb

- **Image:** rethinkdb:2.4.4@sha256:3a767c147d234096995415fdcfd50622d70715de1132fa7c26e444f0d263567e
- **Start command:** `/bin/sh -c 'set -e; M=$(cat /sys/fs/cgroup/memory.max 2>/dev/null || echo max); Q=$(cut -d" " -f1 /sys/fs/cgroup/cpu.max 2>/dev/null || echo max); if [ "$M" != max ]; then CACHE=$((M / 2097152)); else CACHE=1024; fi; if [ "$Q" != max ]; then CORES=$(( (Q + 99999) / 100000 )); else CORES=$(nproc); fi; D=/data/rethinkdb_data; echo "[railway] cache-size=${CACHE}MB cores=${CORES} directory=$D owner=$(stat -c %u:%g /data)"; exec rethinkdb --bind all --directory "$D" --cache-size "$CACHE" --cores "$CORES" --initial-password "$RETHINKDB_PASSWORD"'`

## Documentation

# Deploy and Host RethinkDB on Railway

RethinkDB is the open-source realtime document database: JSON documents, joins, and changefeeds
that push every change to your app the moment it happens. It backs live dashboards, collaborative
apps, multiplayer state and anything that would otherwise poll.

This template runs RethinkDB 2.4 as a single service from a digest-pinned official image: the
client driver port on a Railway TCP proxy, the admin web UI kept off the public internet, and all
data on a Railway volume.

## About Hosting RethinkDB

RethinkDB runs on Railway only after a few things are handled for you:

- **The admin account has a password from the first boot.** A stock `rethinkdb` container starts
  with the `admin` user and an empty password, so anyone who can reach the driver port can read and
  write everything. Here a password is generated per deploy and anonymous connections are rejected.
- **The web UI is not published.** The admin console has no login of its own, so it is not given a
  public domain. It listens on the private network only; use the driver over the TCP proxy, or
  reach the console from another service in the same project.
- **Data survives redeploys.** The data directory is a subfolder of the volume, so the volume's
  `lost+found` never reaches RethinkDB (it refuses to start on a directory it did not create).
  Tables, users and the password live on the attached volume.
- **The cache and thread count follow your plan.** RethinkDB sizes its cache from the machine and
  its threads from the CPU count, and Railway containers report the host's. The start command reads
  the container's memory and CPU limits and passes `--cache-size` (half the memory limit) and
  `--cores`.

## Common Use Cases

- Realtime dashboards and live feeds using changefeeds
- Collaborative and multiplayer apps that need pushed updates instead of polling
- IoT and event data with flexible JSON documents
- A drop-in server for existing RethinkDB applications and the official drivers

## Dependencies for RethinkDB Hosting

- One Railway volume for the data directory (created by the template)

### Deployment Dependencies

- RethinkDB documentation: https://rethinkdb.com/docs
- Official image: https://hub.docker.com/_/rethinkdb

### Implementation Details

| Variable | Purpose |
| --- | --- |
| `RETHINKDB_PASSWORD` | Password of the `admin` user, generated per deploy. |
| `RETHINKDB_PRIVATE_HOST` / `RETHINKDB_PRIVATE_PORT` | Driver address on the private network, for services in the same project. |
| `RETHINKDB_PUBLIC_HOST` / `RETHINKDB_PUBLIC_PORT` | Driver address on the TCP proxy, for clients outside Railway. |

Connect with any official driver as user `admin` and `RETHINKDB_PASSWORD`. Python:

```python
from rethinkdb import RethinkDB
r = RethinkDB()
conn = r.connect(host="", port=,
                 user="admin", password="")
```

The password is applied when the data directory is first created. To change it later, use
`r.db("rethinkdb").table("users").get("admin").update({"password": "new"})`.

## Why Deploy RethinkDB on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your
infrastructure so you don't have to deal with configuration, while allowing you to vertically and
horizontally scale it.

By deploying RethinkDB on Railway, you are one step closer to supporting a complete full-stack
application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


## Similar templates

- [Garage S3 Storage](https://railway.com/deploy/garage-s3-storage) — Ultra-light S3 server: fast, open-source, plug-and-play.
- [Redis](https://railway.com/deploy/redis-1) — Self Host Latest Redis with Railway
- [EasyImg](https://railway.com/deploy/easyimg) — Simple self-hostable Nuxt.js personal image hosting system.

Open this page in a browser: https://railway.com/deploy/rethinkdb-or-just-updated-realtime-datab
