Deploying a RabbitMQ App
Introduction
RabbitMQ is a popular open-source message broker supporting AMQP, MQTT, and STOMP. Deploying RabbitMQ with a Dockerfile on Klutch.sh provides reproducible builds, managed secrets, and persistent storage—all configured from klutch.sh/app. Because Klutch.sh routes one port per app, this guide uses two apps: one for the HTTP management UI and another for AMQP over TCP.
Prerequisites
- A Klutch.sh account (sign up)
- A GitHub repository containing your RabbitMQ Dockerfile (GitHub is the only supported git source)
- Credentials for a RabbitMQ admin user
For onboarding, see the Quick Start.
Architecture and ports
- Klutch.sh allows one port per app. Use two apps (same repo/image):
- Management UI/API: HTTP on internal port
15672; choose HTTP traffic and set the internal port to15672. - AMQP TCP: TCP on internal port
5672; choose TCP traffic and set the internal port to5672. Clients connect toexample-app.klutch.sh:8000externally (Klutch TCP) mapped to internal5672.
- Management UI/API: HTTP on internal port
- MQTT/STOMP ports are not exposed in this layout; focus on AMQP over TCP.
Repository layout
rabbitmq/├── Dockerfile # Must be at repo root for auto-detection└── README.mdKeep secrets out of Git; store them in Klutch.sh environment variables.
Installation (local) and starter commands
Build and run locally:
docker build -t rabbitmq-local .docker run -p 5672:5672 -p 15672:15672 \ -e RABBITMQ_DEFAULT_USER=admin \ -e RABBITMQ_DEFAULT_PASS=changeme \ rabbitmq-localDockerfile for RabbitMQ (production-ready)
Place this at the repo root; Klutch.sh auto-detects Dockerfiles.
FROM rabbitmq:3-management
ENV RABBITMQ_DEFAULT_USER=adminENV RABBITMQ_DEFAULT_PASS=changeme
EXPOSE 5672 15672CMD ["rabbitmq-server"]Notes:
- Pin to a specific tag (e.g.,
rabbitmq:3.12-management) for stability. - The image exposes AMQP on 5672 and management UI on 15672; align with your Klutch.sh apps.
Environment variables (Klutch.sh)
Set these before deploying:
RABBITMQ_DEFAULT_USER=<admin-user>RABBITMQ_DEFAULT_PASS=<admin-password>- Optional:
RABBITMQ_VM_MEMORY_HIGH_WATERMARK=0.6,RABBITMQ_DISK_FREE_LIMIT=2GB
If deploying without the Dockerfile and relying on Nixpacks:
NIXPACKS_START_CMD=rabbitmq-server
Attach persistent volumes
Add storage in Klutch.sh (path and size only):
/var/lib/rabbitmq— queues, exchanges, and message data.
Ensure the path is writable inside the container.
Deploy RabbitMQ on Klutch.sh (split-port workflow)
- Push your repository—with the Dockerfile at the root—to GitHub.
- Create the management app: choose HTTP traffic, set the internal port to
15672, add admin credentials, and attach a volume at/var/lib/rabbitmq. - Deploy the management app and note its URL (e.g.,
https://example-app.klutch.sh); log in with your admin credentials. - Create the AMQP app: choose TCP traffic, set the internal port to
5672, reuse the same repo/env, and attach the same storage path/size. - Deploy the AMQP app. Connect AMQP clients to
example-app.klutch.shon external port8000with your credentials.
Sample API usage (management HTTP)
List queues:
curl -u admin:changeme https://example-app.klutch.sh/api/queuesCreate a queue:
curl -u admin:changeme -X PUT \ https://example-app.klutch.sh/api/queues/%2F/demo-queue \ -H "Content-Type: application/json" \ -d '{"durable":true}'Health checks and production tips
- Use an HTTP readiness probe on
/api/overviewfor the management app. - Keep admin credentials in Klutch.sh secrets; rotate regularly.
- Monitor
/var/lib/rabbitmqvolume usage; resize before hitting limits. - Pin image versions and test upgrades in staging; back up definitions using
rabbitmqctl export_definitionsfrom a controlled environment.
RabbitMQ on Klutch.sh provides a reproducible Docker workflow, split management and AMQP endpoints for single-port routing, managed secrets, and persistent storage—without extra YAML or CI steps. Configure ports, credentials, and volumes, then start exchanging messages.