Skip to content

Instantly share code, notes, and snippets.

@GGontijo
Last active October 31, 2024 14:00
Show Gist options
  • Save GGontijo/3fc0154c665c71ef918d13a50631cd1d to your computer and use it in GitHub Desktop.
Save GGontijo/3fc0154c665c71ef918d13a50631cd1d to your computer and use it in GitHub Desktop.
RabbitMq docker-compose file with automatic default user guest creation and mqtt
version: "3.8"
services:
rabbitmq:
image: rabbitmq:4.0.3-management
container_name: rabbitmq_rpa
hostname: rmq
restart: always
command: >
bash -c '
rabbitmq-server &
sleep 10 &&
if ! rabbitmqctl list_users | grep -q guest; then
rabbitmqctl add_user guest guest &&
rabbitmqctl set_user_tags guest monitoring;
fi &&
rabbitmq-plugins enable rabbitmq_web_mqtt &&
wait
'
ports:
- 5672:5672
- 1883:1883 # mqtt
- 15672:15672 # web interface
volumes:
- ./data/:/var/lib/rabbitmq/
- ./log/:/var/log/rabbitmq
environment:
RABBITMQ_DEFAULT_USER: ${rmq_rpa_user}
RABBITMQ_DEFAULT_PASS: ${rmq_rpa_password}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment