将支持水管工的 R 应用程序部署到 Bluemix / Cloud Foundry

Deploying plumber enabled R application to Bluemix / Cloud Foundry

将 plumber 启用的 R 应用程序部署到 Bluemix/Cloud Foundry

我正在尝试使用 https://github.com/beibeiyang/cf-buildpack-r.git build pack

将支持 plumber 的 R 应用程序部署到 Bluemix / Cloud Foundry

应用程序很简单 (app.R):

library(plumber)

api <- plumb("api.R")

PORT <- as.numeric( Sys.getenv('PORT') )
message (PORT)

api$run(port=PORT)

在我的 Procfile 我有

web: Rscript app.R

在日志文件中,我看到安装(包括依赖项)已成功完成并打印了我的消息。

问题是我无法访问已部署的应用程序。如果我使用

health-check-type: port

然后应用程序未通过健康检查,根本无法访问。如果我使用

health-check-type: process 

应用程序启动但尝试访问其 URL 导致 502 错误网关。

看起来默认情况下,管道工绑定到错误的主机,以下工作:

api$run(host="0.0.0.0", port=PORT)