Enable and configure RabbitMQ
Enable and configure RabbitMQ
RabbitMQ provides AMQP queues for local development of workers, event-driven applications, and message retry flows.
How it works
Devilbox keeps optional integrations as override snippets in the compose/
directory. To enable RabbitMQ, copy its snippet into the project root as
docker-compose.override.yml, then start the stack.
Enable
cp compose/docker-compose.override.yml-rabbitmq docker-compose.override.yml./dvl.sh upConfiguration
The snippet defines service rabbit with image
rabbitmq:${RABBIT_SERVER:-management}, hostname rabbit, IP
172.16.238.210, volume devilbox-rabbit:/var/lib/rabbitmq, AMQP port
${HOST_PORT_RABBIT:-5672}:5672, and management port
${HOST_PORT_RABBIT_MGMT:-15672}:15672.
| Variable | Default | Purpose |
|---|---|---|
RABBIT_SERVER | management | RabbitMQ image tag. |
RABBIT_DEFAULT_VHOST | my_vhost | Initial virtual host. |
RABBIT_DEFAULT_USER | guest | Initial user. |
RABBIT_DEFAULT_PASS | guest | Initial password. |
HOST_PORT_RABBIT | 5672 | Host AMQP port. |
HOST_PORT_RABBIT_MGMT | 15672 | Host management UI port. |
Usage
Open the management UI:
open http://localhost:15672Use AMQP from another Devilbox container with this DSN shape:
amqp://guest:guest@rabbit:5672/my_vhostPublish and consume a test message with the management API:
curl -u guest:guest -H 'content-type:application/json' \ -X PUT http://localhost:15672/api/queues/my_vhost/devilbox-testcurl -u guest:guest -H 'content-type:application/json' \ -X POST http://localhost:15672/api/exchanges/my_vhost/amq.default/publish \ --data '{"routing_key":"devilbox-test","payload":"hello","payload_encoding":"string"}'Disable
./dvl.sh downrm docker-compose.override.yml./dvl.sh upRemove the data volume if you also want to delete queues and messages:
docker volume rm devilbox-rabbitTroubleshooting
- If login fails, confirm the configured default user and password in
.env. - If AMQP clients cannot connect from containers, use hostname
rabbit, notlocalhost. - If ports are busy, set
HOST_PORT_RABBITorHOST_PORT_RABBIT_MGMTto free host ports.