Using R with Rails on Heroku

I am working on making our Rails application talk to R using the rserve server and rserve-simpler gem.

Everything works fine locally when I load my application, but in Heroku my rails application cannot connect to rserve, although the worker successfully started the deployment.

app[web.1]: Rserve::Connection::RserveNotStartedError (Can't start Rserve):

The following are details of my configuration.

.buildpacks

https://github.com/heroku/heroku-buildpack-ruby.git
http://github.com/virtualstaticvoid/heroku-buildpack-r.git#cedar-14

PROCFILE

web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
rserve: R -f rserve.r --gui-none --no-save

rserve.r

require('Rserve')

# get the port allowed
port <- Sys.getenv('PORT')

# run Rserve in process
run.Rserve(debug = TRUE, port, args = NULL, config.file = "./rserve.conf")

rserve.conf

remote enable

As you can see, the rails work on one speaker, and rserver works on another dyno in heroku.

I suspect that since rserve is running on a different dyno, the rails cannot talk using the default connection settings, but I'm not sure how and even if I could fix it. Any help would be greatly appreciated.

Edit: Heroku Dynos:

, .

, .

?

+4

Source: https://habr.com/ru/post/1568408/


All Articles