
Deploy Valkey | (Just Updated) Redis Alternative, Crash-Safe Data, Memory Capped
Valkey Redis fork. Password on, AOF every second, memory capped, data kept
Just deployed
/data
Deploy and Host Valkey on Railway
Valkey is the Linux Foundation's open-source fork of Redis. It speaks the Redis protocol, so existing clients, queues, rate limiters and caches connect to it unchanged, and it keeps the dataset in memory for sub-millisecond reads.
This template runs Valkey 9.1 as a single service from a digest-pinned official image: the Redis port on a Railway TCP proxy, and a Railway volume holding an append-only file that is flushed every second.
About Hosting Valkey
- A crash does not erase your data. A stock Valkey container saves a snapshot only every hour (and only after a change), so a hard kill, such as an out-of-memory kill or a node failure, loses everything written since. This template turns on the append-only file with a one-second flush, so a hard kill loses at most the last second.
- A password is required from the first connection. It is generated per deploy; anonymous
clients are rejected with
NOAUTH. - Memory and threads follow your plan. The start command reads the container's memory and CPU
limits and sets
maxmemoryto 70% of the memory limit, leaving headroom for rewrites, with thenoevictionpolicy, so a full instance refuses writes instead of being killed. It also sets the I/O thread count from the container's cores, not the host's. - Two ways in. Services in the same project use the private URL; clients elsewhere use the TCP proxy URL.
Common Use Cases
- A drop-in replacement for Redis as a cache or session store
- Job queues (BullMQ, Sidekiq, Celery) and rate limiters on the Redis protocol
- Leaderboards, counters and real-time state shared between services
- Pub/sub and streams between your Railway services
Dependencies for Valkey Hosting
- One Railway volume for the append-only file and snapshots (created by the template)
Deployment Dependencies
- Valkey documentation: https://valkey.io/docs/
- Official image: https://hub.docker.com/r/valkey/valkey
Implementation Details
| Variable | Purpose |
|---|---|
VALKEY_PASSWORD | Password for connections, generated per deploy. |
VALKEY_PRIVATE_URL | redis:// URL on the private network, for services in the same project. |
VALKEY_PUBLIC_URL | redis:// URL on the TCP proxy, for clients outside Railway. |
Python:
import redis
r = redis.from_url("")
r.set("hello", "world")
Why Deploy Valkey 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 Valkey 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.
Template Content