Enabling prometheus-exporter plugin with Discourse Docker instance

Hello,

I have an instance of Discourse running in a Docker container with the prometheus-exporter installed. We are using bundle exec rails server -b 0.0.0.0 to start the rails server (using /bin/unicorn/ gives the same error) and have specified the port mapping 9045:9045 and exposed port 9045.

The puma error logs show the following errors:

Prometheus Exporter, failed to send message Cannot assign requested address - connect(2) for "localhost" port 9405
2022-08-09 22:48:25 +0000 Rack app ("GET /metrics" - (172.22.0.1)): #<Errno::EADDRNOTAVAIL: Failed to open TCP connection to localhost:9405 (Cannot assign requested address - connect(2) for "localhost" port 9405)>

Is there something special Discourse normally does with puma to ensure that the prometheus-exporter can open a TCP connection on port 9405?

If you install Discourse following the official install guide it won’t use Puma, but Unicorn. All our plugins and themes assume an install that follows the official install.