Railway

Deploy RabbitMQ — Self-Hosted Message Broker with AMQP

Self-host RabbitMQ: message broker for queues & background jobs. AMQP/MQTT.

Deploy RabbitMQ — Self-Hosted Message Broker with AMQP

Just deployed

/var/lib/rabbitmq

Deploy and Host RabbitMQ on Railway

RabbitMQ message broker management UI

RabbitMQ is the most widely deployed open-source message broker — the reliable backbone for decoupling services, background jobs, and event-driven architectures. Producers publish messages, RabbitMQ routes and queues them, and consumers process them at their own pace, so a slow or failed service never takes down the rest. The 4.x line brings a modernized management UI, quorum queues (35% less memory than 3.x), native AMQP 1.0, MQTT 5.0 for IoT, and streams for replay and fan-out.

This template deploys RabbitMQ with the management plugin and a persistent volume, pre-wired on Railway. Speak AMQP, MQTT, or STOMP from any language, watch queues and message rates in the web UI, and pay flat compute — ~$5–15/month — instead of Amazon MQ's per-broker-hour billing.


What This Template Deploys

ServicePurpose
RabbitMQ (with Management)The broker plus web management UI — AMQP on 5672, management UI on 15672, over Railway's network
Persistent VolumeMounted at /var/lib/rabbitmq — durable queues, messages, users, and definitions survive every redeploy

Single service, built on Erlang/OTP for reliability. The management plugin gives you a visual view of exchanges, queues, bindings, and message rates. Connect app services over Railway's private network on port 5672; the management UI is available on 15672.


About Hosting RabbitMQ

Any app that outgrows synchronous request-response needs a message broker: to run background jobs, smooth out traffic spikes, decouple microservices, or fan events out to multiple consumers. RabbitMQ is the default choice — battle-tested, protocol-rich (AMQP, MQTT, STOMP), and far lighter to operate than Kafka for small-to-medium scale.

Running it means a persistent Erlang service, a volume for durable messages, and network access for your producers and consumers. Railway runs RabbitMQ as a managed container with automatic HTTPS on the management UI and a persistent volume, so durable queues and messages survive restarts. Set the admin credentials, connect your services, and you have a production broker.

Typical cost: ~$5–15/month on Railway depending on throughput and RAM. Amazon MQ for RabbitMQ bills per broker-instance-hour plus storage; CloudAMQP's paid plans start around $20/month. Self- hosting on Railway is flat compute with full control over configuration and no per-broker fees.


Deploy in Under 3 Minutes

  1. Click Deploy on Railway — RabbitMQ builds automatically (~1–2 minutes)
  2. Add a persistent volume at /var/lib/rabbitmq so durable queues and messages persist
  3. Set RABBITMQ_DEFAULT_USER and RABBITMQ_DEFAULT_PASS to strong values
  4. Open the management UI on port 15672 and log in to view queues and message rates
  5. Connect your app: point your AMQP client at the private hostname on port 5672

No Erlang setup. No cluster configuration. No reverse proxy.


Common Use Cases

  • Background job queue — offload email sending, image processing, and report generation from your web requests to workers that consume from RabbitMQ, keeping your app responsive
  • Microservice decoupling — let services communicate asynchronously through queues so one service being slow or down doesn't cascade into failures across the system
  • Event-driven architecture — fan events out to multiple consumers with exchanges and routing keys, so new subscribers can be added without changing publishers
  • Backend for Celery, Sidekiq, or BullMQ — RabbitMQ is a first-class broker for Python Celery, Ruby Sidekiq, and other task-queue frameworks
  • Traffic spike smoothing — buffer bursts of incoming work in durable queues and let consumers drain them at a sustainable rate instead of overwhelming downstream systems
  • IoT and pub/sub messaging — MQTT 5.0 support makes RabbitMQ a broker for IoT device telemetry and lightweight publish/subscribe alongside your AMQP workloads

Configuration

VariableRequiredDescription
RABBITMQ_DEFAULT_USER✅ RequiredAdmin username for the broker and management UI
RABBITMQ_DEFAULT_PASS✅ RequiredAdmin password — set a strong value before exposing
RABBITMQ_DEFAULT_VHOSTOptionalDefault virtual host — defaults to /
RABBITMQ_ERLANG_COOKIEOptionalShared secret for clustering — set if running multiple nodes
AMQP portPre-set5672 — the main AMQP messaging port
Management UI portPre-set15672 — the web management interface
MQTT portOptional1883 — enable the MQTT plugin for IoT/pub-sub

Set strong RABBITMQ_DEFAULT_USER and RABBITMQ_DEFAULT_PASS before exposing the instance — the default guest/guest account only works on localhost and shouldn't be relied on. Mount the /var/lib/rabbitmq volume, or durable queues and messages are lost on redeploy. Connect app services over the private network to keep the broker off the public internet.


RabbitMQ vs. Messaging Alternatives

RabbitMQ (Railway)Amazon MQKafkaRedis (as queue)
Pricing~$5–15/mo flatPer broker-hourSelf-host, JVM-heavySelf-host
Self-hosted / own data✅ Yes❌ AWS-managed✅ Yes✅ Yes
Protocols✅ AMQP, MQTT, STOMP✅ AMQP⚠️ Kafka protocol⚠️ Redis protocol
Routing flexibility✅ Rich (exchanges)✅ Rich⚠️ Topic-based⚠️ Basic
Management UI✅ Built-in✅ Console⚠️ Third-party⚠️ Third-party
Resource footprint✅ ModestN/A❌ JVM-heavy✅ Light
Best forTask queues, routingManaged AMQPHigh-throughput streamsSimple queues
Open source✅ MPL❌ No✅ Apache-2.0✅ BSD

Dependencies for RabbitMQ Hosting

  • Railway account — Hobby plan (~$5–15/month) sized to your throughput
  • A persistent volume at /var/lib/rabbitmq for durable queues and messages
  • An AMQP (or MQTT/STOMP) client library — available for every major language

Deployment Dependencies

Implementation Details

This template deploys the official rabbitmq:management image (RabbitMQ 4.x with the management plugin enabled) and a persistent volume at /var/lib/rabbitmq for durable queues, messages, users, and definitions. Built on Erlang/OTP, RabbitMQ is reliable and modest on resources — no JVM overhead like Kafka. The AMQP endpoint is on 5672 and the web management UI on 15672.

RabbitMQ 4.x uses quorum queues (Raft-based, ~35% less memory than 3.x mirrored queues) as the modern durable queue type, and adds native AMQP 1.0, MQTT 5.0, and streams for replay/fan-out. Connect app services over Railway's private network using the internal hostname on 5672. Set admin credentials and mount the volume before production use; durable queues survive redeploys.


Frequently Asked Questions

What is RabbitMQ used for? RabbitMQ is a message broker that sits between the parts of your system. Producers send messages; RabbitMQ routes and queues them; consumers process them independently. This decouples services, enables background jobs, smooths traffic spikes, and powers event-driven architectures — so a slow or failed component doesn't take down the rest.

How does the cost compare to Amazon MQ or CloudAMQP? Amazon MQ bills per broker-instance-hour plus storage; CloudAMQP paid plans start around $20/month. Self-hosted RabbitMQ on Railway is ~$5–15/month flat with full config control and no per-broker fees. For most small-to-medium workloads, self-hosting is cheaper and more flexible.

Do I lose my queued messages if Railway redeploys? Durable queues and persistent messages survive redeploys as long as you've mounted the /var/lib/rabbitmq volume. Note that only messages explicitly published as persistent to durable queues are retained — transient messages are not, by design.

RabbitMQ or Kafka — which should I use? Use RabbitMQ for task queues, complex routing, and small-to-medium throughput where operational simplicity matters — it's far lighter than Kafka (no JVM). Use Kafka for very high-throughput event streaming and long-term log retention. For most application queues and job systems, RabbitMQ is the simpler, cheaper fit.

Can I use it with Celery, Sidekiq, or BullMQ? Yes. RabbitMQ is a first-class broker for Python Celery, Ruby Sidekiq, and other task-queue frameworks. Point the framework's broker URL at your Railway RabbitMQ instance on port 5672 with your credentials.

How do I monitor my queues? The management plugin (enabled in this template) provides a web UI on port 15672 showing exchanges, queues, bindings, message rates, and consumer activity. RabbitMQ also exposes Prometheus metrics for integration with Grafana dashboards.


Why Deploy and Host RabbitMQ 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 RabbitMQ on Railway, you get the most-deployed open-source message broker — AMQP, MQTT, and STOMP, a visual management UI, and durable quorum queues — on a single service with persistent storage at ~$5–15/month flat, connectable privately to the rest of your Railway stack.


Template Content

More templates in this category

View Template
smoothmq
A drop-in replacement for AWS SQS

poundifdef
7
View Template
Hatchet Lite
Hatchet Lite with postgres

prncd
1
View Template
Maildev
Ephemeral SMTP server for development purposes.

Six
27