Deploy Valkey
Valkey 9.1.3: Redis-compatible cache and queue, password, AOF on a volume
Just deployed
/data
Deploy and Host Valkey on Railway
Valkey is an open-source, BSD-licensed key-value database from the Linux Foundation, forked from Redis 7.2.4 and kept compatible with Redis clients and commands. It holds data in memory for caching, sessions, queues, rate limits and pub/sub, and can persist it to disk. This template runs Valkey 9.1.3.
About Hosting Valkey
Hosting Valkey means running one server process, protecting it with a password, keeping its data on persistent storage and giving your apps a stable address. This template builds the official valkey/valkey:9.1.3-alpine image (pinned by digest) from a public GitHub repo, generates a 32-character password, and refuses to start without one. Data goes to a Railway volume at /data with an append-only file (fsync every second) plus RDB snapshots, so keys survive restarts and redeploys. Your apps reach Valkey on the private network at valkey.railway.internal:6379. A TCP proxy gives access from outside Railway, and an HTTP health check on /health confirms each deploy before traffic moves.
Common Use Cases
- Cache and session store for a web app you already run on Railway (Rails, Django, Laravel, Node.js, Next.js)
- Job queue backend for BullMQ, Sidekiq, Celery, RQ or n8n queue mode
- Rate limiting, pub/sub, leaderboards and other realtime counters
Dependencies for Valkey Hosting
- None: Valkey is a single self-contained service with its own volume
- A Redis client in your app (any Redis client works with Valkey)
Deployment Dependencies
- Valkey: https://valkey.io and https://github.com/valkey-io/valkey
- Release notes for 9.1.3: https://github.com/valkey-io/valkey/releases/tag/9.1.3
- Official image: https://hub.docker.com/r/valkey/valkey
- Template repo (Dockerfile, start script, changelog): https://github.com/aalfath/valkey-railway-template
Implementation Details
Add Valkey to the project your app runs in, then point the app at it with a reference variable:
REDIS_URL=${{Valkey.REDIS_URL}}
REDIS_URL (and VALKEY_URL) is redis://default:PASSWORD@valkey.railway.internal:6379 on the private network. The template also exposes REDISHOST, REDISPORT, REDISUSER and REDISPASSWORD, named like Railway's Redis plugin, so apps already wired to Redis can switch by renaming the referenced service. Use REDIS_PUBLIC_URL only from outside Railway (it goes through the TCP proxy); remove the proxy in the service settings if you don't need it. Valkey listens on IPv4 and IPv6, so Alpine/musl clients work too.
For a pure cache, add a variable VALKEY_EXTRA_FLAGS with --maxmemory 256mb --maxmemory-policy allkeys-lru (any valkey-server flags work). Updates arrive as Railway "update available" notices when the pinned version changes in the repo; read the repo's CHANGELOG.md before you apply one.
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
