A while back, I was playing around with a series of tools to test RabbitMQ in various related configurations. Now, one thing that these tools had in common, was that the users they were running as only had enough permissions to publish or consume messages, but not to configure the queues/exchange/bindings. This isn’t a common setup for most development situations for RabbitMQ, but for more production situations, it’s a good idea, as your running app shouldn’t need to reconfigure the resources it’s using. Doing this repeatedly manually as I changed settings and switched between two different machines (long story) however got to be a bit annoying, and so I built Coney.
Coney is an idempotent RabbitMQ config tool. Given a configuration file describing a series of resources (users, permissions, queues, exchanges, bindings), it checks if a given RabbitMQ instance has those items configured, and if not, makes/edits them. If any other resources are present, it leaves them alone, and if all the requested items are present, it does nothing.
rabbitmqadmin export <some-config-name>
- Remove any resources you don’t want to create (e.g. the “guest” user probably)
- In the “users” block, remove the “password_hash” key and add a “password” key with the password for each user
coney <some-config-name> --host <new-host> --username <new-host-login> --password <new-host-password>
(The example EDN config actually has an alternate form with all the VHost-specific items under a “vhosts” entry, v.s. the standard export form which has a “vhost” key for every item, but you can use either form in either EDN or JSON form)