Hi,
I am trying to setup a rabbitmq cluster (for a demo) inside Nomad, and am using the Consul peer discovery mechanism to do so.
I have a working rabbitmq container, which when used manually (e.g. on one host, start a consul container, 3 rmq containers) works fine, but when I try it as a job inside Nomad, the cluster won't form.
As far as I can work out, it is becase the EPMD port (4369) gets mapped from the container to some arbitrary port on the host, and this doesn't seem to get broadcast in the Consul registrations.
Setting the CONSUL_SVC_PORT
environment variable fixes the service in Consul to have the right (generated) port mapping, but I can't find any kind of setting to do something similar for the EPMD port, and setting ERL_EPMD_PORT seemed to have no discernable effect on it either.
I might of course be completely wrong on this assumption, but any help would be great.
Thanks.
My entire rabbit.nomad file is as follows:
job "rabbit" {
datacenters = ["dc1"]
type = "service"
group "cluster" {
count = 3
task "rabbit" {
driver = "docker"
config {
image = "piomin/rabbitmq:1.0"
hostname = "rabbit${NOMAD_ALLOC_INDEX}"
port_map {
amqp = 5672
ui = 15672
clustering = 4369
}
}
env {
RABBITMQ_ERLANG_COOKIE = "rabbitmq"
CONSUL_HOST = "${attr.unique.network.ip-address}"
CONSUL_SVC_PORT = "${NOMAD_HOST_PORT_amqp}"
}
resources {
network {
port "amqp" {}
port "ui" {}
port "clustering" {}
}
}
}
}
}