
Deploy Dragonfly | (Just Updated) Redis Replacement, Snapshots Every 5 Min
Dragonfly Redis replacement. Password on, snapshots every 5 min, data kept
dragonfly
Just deployed
/data
Deploy and Host Dragonfly on Railway
Dragonfly is a multi-threaded, Redis-compatible in-memory datastore. It speaks the Redis protocol, so existing clients, queues, rate limiters and caches connect to it unchanged, and it keeps a whole dataset in memory across every core of the container.
This template runs Dragonfly 2.0 as a single service from a digest-pinned official image: the Redis port on a Railway TCP proxy, and a Railway volume holding snapshots that are rewritten every five minutes.
About Hosting Dragonfly
- A crash does not erase your data. A stock Dragonfly container saves only on a clean shutdown; after a hard kill (an out-of-memory kill, a node failure) it restarts empty. This template saves a snapshot to the volume every five minutes under a fixed file name, so a hard kill loses at most the last five minutes and the snapshots never pile up on the volume.
- A password is required from the first connection. It is generated per deploy; anonymous clients are rejected.
- Memory and threads follow your plan. The start command reads the container's memory limit and
passes
maxmemory(70% of it, leaving headroom for snapshots) and the thread count. - Two ways in. Services in the same project use the private URL; clients elsewhere use the TCP proxy URL.
Common Use Cases
- A faster 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
- Large in-memory datasets that need to use every core
Dependencies for Dragonfly Hosting
- One Railway volume for snapshots (created by the template)
Deployment Dependencies
- Dragonfly documentation: https://www.dragonflydb.io/docs
- Official image: https://github.com/dragonflydb/dragonfly/pkgs/container/dragonfly
Implementation Details
| Variable | Purpose |
|---|---|
DRAGONFLY_PASSWORD | Password for connections, generated per deploy. |
DRAGONFLY_PRIVATE_URL | redis:// URL on the private network, for services in the same project. |
DRAGONFLY_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 Dragonfly 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 Dragonfly 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
dragonfly
ghcr.io/dragonflydb/dragonfly:v2.0.0