Coney: RabbitMQ config tool

May 27, 2015

Tools Clojure RabbitMQ 

Originally posted at

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.

The source repository has a couple of example configs (in EDN and JSON form), but the easiest way to reproduce an existing manual config is as follows:

  1. Run
    rabbitmqadmin export <some-config-name>
  2. Remove any resources you don’t want to create (e.g. the “guest” user probably)
  3. In the “users” block, remove the “password_hash” key and add a “password” key with the password for each user
  4. 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)

Previously: Telepresence Dalek: Part 1 – Remote control Next: Telepresence Dalek: Part 2 – Video