使用 Discourse Docker 实例启用 prometheus-exporter 插件

您好,

我有一个 Discourse 实例在 Docker 容器中运行,并安装了 prometheus-exporter。我们使用 bundle exec rails server -b 0.0.0.0 来启动 rails 服务器(使用 /bin/unicorn/ 会出现相同的错误),并指定了端口映射 9045:9045 并暴露了端口 9045。
Puma 错误日志显示以下错误:

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)>

Discourse 通常会使用 puma 做一些特殊处理,以确保 prometheus-exporter 可以打开端口 9405 上的 TCP 连接吗?

如果您按照官方安装指南安装 Discourse,它将不使用 Puma,而是使用 Unicorn。我们所有的插件和主题都假定安装是按照官方安装进行的。