
RabbitMQ is a lightweight message broker that enables applications to communicate asynchronously by sending messages through queues instead of interacting directly. This architecture improves reliability, scalability, and performance across distributed systems.
This article explains how to deploy RabbitMQ using Docker Compose, configure persistent storage for queue data, and secure the RabbitMQ Management UI using Traefik with HTTPS routing.
Before you begin, ensure you have:
sudo privileges.rabbitmq.example.com).In this section, you create a project directory for RabbitMQ and define environment variables in a .env file that Docker Compose loads automatically.
Create the project directory.
Navigate in to the project directory.
Create a .env file to store the environment variables.
Add the following variables:
Replace:
rabbitmq.example.com with your domain.admin@example.com with your email.STRONG_PASSWORD with a secure alphanumeric password.Save and close the file.
In this section, you create the Docker Compose manifest that deploys RabbitMQ and Traefik. Docker Compose uses the .env file to inject variables for domain routing, certificate generation, and default RabbitMQ credentials.
Create the Docker Compose manifest.
Add the following content:
Save and close the file.
In this manifest:
80 and 443 on the host so Traefik can receive and route all incoming traffic.5672, the primary AMQP messaging port, to the host.15672 (RabbitMQ Management UI) to Traefik internally without exposing it directly to the host machine.rabbitmq-lib stores RabbitMQ’s persistent message/queue data.rabbitmq-log stores RabbitMQ log files.letsencrypt stores TLS certificates generated by Traefik./var/run/docker.sock allows Traefik to detect running Docker services automatically.15672) Traefik should forward requests to.Start the services.
Verify that both services are running.
Output:
The above output confirms that both services are running successfully.
View the logs for the services.
For more information on managing a Docker Compose stack, see the How To Use Docker Compose article.
In this section, you open the RabbitMQ Management UI using the domain you configured and verify that the dashboard loads correctly.
Open the RabbitMQ Management Dashboard in your browser.
Log in using the credentials you configured in your .env file.
After successful authentication, the RabbitMQ Management Dashboard appears.
You have successfully deployed RabbitMQ with the Management UI using Docker Compose and Traefik. Traefik handled HTTPS and routing for the management dashboard, and RabbitMQ stored data and logs on persistent host volumes. You can now create admin users, manage queues via the dashboard, and connect applications to RabbitMQ on port 5672.
0 Comments
Be the first to comment and share your perspective with the community.