Translating a docker run command with ports to a Fly deployment

Hi,

I have a dockerfile that creates a RabbitMQ server for me with the following command docker run -dp 127.0.0.1:3000:3000 -p 5672:5672 -p 15672:15672 keycloak-rabbit-local

How do I translate this to a fly deployment?

previously, I’ve tried using the following fly.toml

# fly.toml app configuration file generated for keycloak-rabbit on 2023-10-23T14:22:39+01:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = "keycloak-rabbit"
primary_region = "lhr"

[build]
  dockerfile = "Dockerfile"

# rabbitmq main
[[services]]
  http_checks = []
  internal_port = 5672
  protocol = "tcp"
  script_checks = []

  [[services.tcp_checks]]
    grace_period = "1s"
    interval = "15s"
    restart_limit = 0
    timeout = "60s"


# rabbitmq admin
[[services]]
  http_checks = []
  internal_port = 15672
  protocol = "tcp"
  script_checks = []

  [[services.ports]]
    handlers = ["http", "tls"]
    port = "15672"

  [[services.tcp_checks]]
    grace_period = "1s"
    interval = "15s"
    restart_limit = 0
    timeout = "60s"

my dockerfile and prod.conf

FROM rabbitmq:3-management-alpine
COPY ./prod.conf /etc/rabbitmq/rabbitmq.conf
RUN rabbitmq-plugins enable rabbitmq_management
# rabbitmq config file
listeners.tcp.default = 5672
default_user = username
default_pass = password
default_vhost = host
log.file.level = warning
log.console.level = warning

But when I go to access myflyurl:15672, I get ERR_CONNECTION_RESET, which I think I expect, because then I fly proxy 15672, but I get the same message.

With this dockerfile, I found that using -p 5672:5672 -p 15672:15672 was crucial to getting the management interface to appear on 15672, so I need that for the fly deployment, however I thought the set up in the fly.toml would be enough but I’ve clearly missed something.

Cheers

Hello! There’s some good discussion about this here: RabbitMQ on Fly not working?. I was able to get this working with your config except for having changed the order of the handlers, as below. I also made sure to have an IP allocated (v6, so free).

The summary is:

  • Handlers are executed in order, so you want handlers = ["tls", "http"] to first terminate TLS then handle HTTP.
  • Adding management.tcp.ip = :: to your prod.conf should enable you to do fly proxy 15672 and then visit http://localhost:15672 to reach the management console. Note: http, not https. This step isn’t necessary if you only want to be able to connect using the fly.dev URL.

Thank you so much.

I’ve looked at that thread! And another thread where I got my fly.toml from in the first place, I’m so annoyed at myself for missing that last little bit, however the tls http ordering thing I would of had no idea about haha.

Cheers!