4

I have a Vagrantfile that does 2 important things; firstly pulls and runs dockerfile/rabbitmq, then builds from a custom Dockerfile that runs an application which assumes a vhost on the rabbitmq server, let's say "/foo".

The problem is the vhost is not there.

The container with rabbitmq is running successfully, the app is linked to it using --link as the built image is run. Using the environment variables docker sets I can hit the server. But somewhere in the middle of these operations I need to create the vhost as my connection is refused, i assume because "/foo" is not there.

How can I get the vhost onto the rabbit server?

Thanks

note - using the webadmin is not an option, this has to be done programatically.

noisyboiler
  • 221
  • 1
  • 3
  • 10

3 Answers3

6

You can put default_vhost in /etc/rabbitmq/rabbitmq.config: http://www.rabbitmq.com/configure.html

It will then be created on the first run. (Stop and delete the mnesia directory if has been started already)

Carl Hörberg
  • 5,973
  • 5
  • 41
  • 47
4

There are few ways to get desired configuration:

or

or

pinepain
  • 12,453
  • 3
  • 60
  • 65
  • 1
    Thanks Zaq. I've had difficulties with these options. Even installing the management plugin on linux! It feels like i should just be able to use `rabbitmqctl` and add the vhost passing a host option, but maybe i've got the syntax wrong. However, having my vhosts in config also sounds like a good option. Can you give some examples? – noisyboiler Sep 13 '14 at 10:57
  • There are example on the `rabbitmqctl` manual page (i fixed the link in the answer). As to `rabbitmqadmin`, the idea is to manually configure rabbitmq server and then export it configuration to reuse later. There are also cli examples on the `rabbitmqadmin` link (at the bottom of the page). – pinepain Sep 13 '14 at 11:47
0

BTW according to docs in here: https://www.rabbitmq.com/vhosts.html You can du this via curl by using:

curl -u userename:pa$sw0rD -X PUT http://rabbitmq.local:15672/api/vhosts/vh1

So probably it doesnt matter you are doing this remotely or not..

user3765649
  • 304
  • 4
  • 11