---
title: "Deploy Garnet"
description: "Microsoft Garnet 2.1 Redis-compatible cache with auth and durable storage."
category: "Queues"
url: https://railway.com/deploy/garnet
---

# Deploy Garnet

Microsoft Garnet 2.1 Redis-compatible cache with auth and durable storage.

**[Deploy Garnet on Railway](https://railway.com/template/garnet)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/garnet/manifest.json

- **Creator:** Agaz Self-Host
- **Category:** Queues

## Template content

### garnet https://api.nuget.org/v3-flatcontainer/microsoft.garnet/1.0.89/icon

- **Image:** ghcr.io/microsoft/garnet:2.1.8
- **Start command:** `sh -c 'exec /app/GarnetServer --port 6379 --auth Password --password "$GARNET_PASSWORD" --memory "$GARNET_MEMORY" --index "$GARNET_INDEX" --aof --aof-commit-freq 1000 --checkpointdir /data --recover --device-type RandomAccess'`

## Documentation

# Deploy and Host Garnet on Railway

Garnet is a high-performance cache-store from Microsoft Research that speaks the Redis RESP protocol. Existing Redis clients and libraries connect unchanged, while Garnet adds multi-threaded scaling, low tail latency and durable storage. It supports strings, hashes, lists, sets, sorted sets, streams, Lua scripts, transactions and pub/sub.

## About Hosting Garnet

This template deploys Garnet v2.1.8 from the official image as a single service with password authentication. Writes go to an append-only log and checkpoints on a Railway volume at `/data`, and Garnet recovers them on every start, so data survives redeploys. Memory is capped at 512 MB for the store and 64 MB for the index, which suits the Hobby plan; raise both variables for larger datasets. Services connect over the private network on port 6379, and external clients use the Railway TCP proxy. Garnet uses its portable storage device, because Railway does not offer native async I/O.

## Common Use Cases

- A drop-in Redis replacement for caching, sessions and rate limiting
- Queues and pub/sub for background jobs with Redis-based libraries such as BullMQ or Sidekiq
- Leaderboards and counters with sorted sets and atomic increments

## Dependencies for Garnet Hosting

- `ghcr.io/microsoft/garnet:2.1.8` (official image)
- A Railway volume at `/data` for the append-only log and checkpoints
- A Railway TCP proxy for external clients

### Deployment Dependencies

- [Garnet documentation](https://microsoft.github.io/garnet/docs)
- [Garnet v2.1.8 release](https://github.com/microsoft/garnet/releases/tag/v2.1.8)
- [Redis API compatibility](https://microsoft.github.io/garnet/docs/commands/api-compatibility)
- [Railway TCP proxy](https://docs.railway.com/reference/tcp-proxy)

### Implementation Details

| Service | Image | Networking | Storage |
| --- | --- | --- | --- |
| garnet | `ghcr.io/microsoft/garnet:2.1.8` | private 6379; TCP proxy to 6379 | volume at `/data` |

```env
REDIS_URL=${{garnet.REDIS_URL}}               # inside Railway
REDIS_PUBLIC_URL=${{garnet.REDIS_PUBLIC_URL}} # external, via TCP proxy
```

```bash
redis-cli -u "$REDIS_PUBLIC_URL" SET greeting hello
```

| Variable | Default | Purpose |
| --- | --- | --- |
| `GARNET_PASSWORD` | generated | Password for the `default` user |
| `GARNET_MEMORY` / `GARNET_INDEX` | `512m` / `64m` | Store memory and hash index size |

Notes:

- The start command runs Garnet with `--aof --recover --device-type RandomAccess`; keep it when editing the service.
- The TCP proxy carries traffic without TLS; use the private network for production apps where possible.

This is a community-maintained deployment package and does not imply affiliation with or endorsement by the Garnet project or its maintainers.

## Why Deploy Garnet 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 Garnet 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

- [Redpanda](https://railway.com/deploy/redpanda-1) — Redpanda 26.2: Kafka-compatible streaming, single node, with Kafbat UI.
- [smoothmq](https://railway.com/deploy/AJv-64) — A drop-in replacement for AWS SQS
- [Kafka UI](https://railway.com/deploy/kafka-ui) — Kafbat UI — Open-source web UI to monitor and manage Apache Kafka clusters

Open this page in a browser: https://railway.com/deploy/garnet
