在heroku上使用RinRuby.new(来自RinRuby gem)在ruby on rails应用程序内创建与R的连接

时间:2019-01-26 09:46:55

标签: ruby-on-rails r ruby heroku devops

我制作了一个使用R(例如this)的ruby on rails应用程序,该应用程序在本地工作。

要修复rake任务错误消息,我在gemfile中将gem 'rinruby'替换为较新的分支gem 'rootapp-rinruby',如this答案中所述。

但是当我尝试使用常规的ruby buildpack将应用程序部署到heroku时,我得到You must use Bundler 2 or greater with this lockfile.,因此我按照推荐的here删除了ruby buildpack并添加了https://github.com/bundler/heroku-buildpack-bundler2 < / p>

此时,该应用程序已成功部署到heroku。但是,如果我进入Rails控制台并运行

require 'rinruby'
# => true

RinRuby.new
#Traceback (most recent call last):
#        2: from (irb):3
#        1: from (irb):3:in `new'
#Errno::ENOENT (No such file or directory - R)

它应该像在本地一样创建到R的连接。相反,它会出错,并且我无法找到解决此错误的方法(我认为Rails应用不是“找到” R吗?)

为解决该问题,我尝试添加使用here的R buildpack(但已弃用),因此我添加了https://github.com/virtualstaticvoid/heroku-buildpack-r.git#heroku-16,该示例在this中使用。

现在,当我使用两个buildpack进行部署时,我得到:

    -----> Ruby app detected
    -----> Compiling Ruby/Rails
    -----> Using Ruby version: ruby-2.5.1
    -----> Installing dependencies using bundler 2.0.1
           Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
           The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
           Using rake 12.3.2
           Using concurrent-ruby 1.1.4
           Using i18n 1.5.3

etc etc
           Using turbolinks-source 5.2.0
           Using turbolinks 5.2.0
           Using uglifier 4.1.20
           Bundle complete! 19 Gemfile dependencies, 62 gems now installed.
           Gems in the groups development and test were not installed.
           Bundled gems are installed into `./vendor/bundle`
           Bundle completed (0.42s)
           Cleaning up the bundler cache.
    -----> Installing node-v8.10.0-linux-x64
           Detected manifest file, assuming assets were compiled locally
    -----> Detecting rails configuration
    -----> Detecting rake tasks
    ###### WARNING:
           You set your `config.active_storage.service` to :local in production.
           If you are uploading files to this app, they will not persist after the app
           is restarted, on one-off dynos, or if the app has multiple dynos.
           Heroku applications have an ephemeral file system. To
           persist uploaded files, please use a service such as S3 and update your Rails
           configuration.

           For more information can be found in this article:
             https://devcenter.heroku.com/articles/active-storage-on-heroku

    ###### WARNING:
           We detected that some binary dependencies required to
           use all the preview features of Active Storage are not
           present on this system.

           For more information please see:
             https://devcenter.heroku.com/articles/active-storage-on-heroku

    ###### WARNING:
           No Procfile detected, using the default web server.
           We recommend explicitly declaring how to boot your server process via a Procfile.
           https://devcenter.heroku.com/articles/ruby-default-web-server
    -----> App not compatible with buildpack: https://github.com/virtualstaticvoid/heroku-buildpack-r.git#heroku-16
           More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
     !     Push failed

到目前为止,很多试验和错误已经解决了这个问题,但是我对于下一步该怎么做感到有些困惑

作为参考,我使用的是ruby 2.5.1和rails 5.2.2

0 个答案:

没有答案