加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

如果没有shell环境,如何使用RVM从特定的Ruby版本运行“bundle ex

发布时间:2020-12-15 21:03:40 所属栏目:安全 来源:网络整理
导读:好吧,我有一个忏悔 – 我仍然运行大规模的FCGI设置(只配置了很多服务器).我试图让它适应rvm.在fcgi设置中,我可以指定执行命令行命令来运行我的应用程序(Sinatra,Rack,Bundler,整个事情),这就是我没有rvm的情况 "bin-path" = "bundle exec rackup","bin-envir
好吧,我有一个忏悔 – 我仍然运行大规模的FCGI设置(只配置了很多服务器).我试图让它适应rvm.在fcgi设置中,我可以指定执行命令行命令来运行我的应用程序(Sinatra,Rack,Bundler,整个事情),这就是我没有rvm的情况

"bin-path" => "bundle exec rackup","bin-environment" => (
    "RACK_ENV" => "development"
),

假设我的机架文件只是config.ru.现在,在我的Mac上,这有效:

"bin-path" => env.HOME + "/.rvm/gems/ruby-1.9.2-p180/bin/bundle exec rackup " + CWD  + "/config.ru","bin-environment" => (
    "BUNDLE_GEMFILE" => CWD + "/Gemfile","RACK_ENV" => "development"
),

但不是在服务器上.当调度程序启动时,它们会得到一个精简的环境,其中RVM shell欺骗不再起作用.我想我应该使用包装器选项来制作某种包装,但我真的不明白这将如何缓解我的问题以及使用哪些参数.有没有人有没有加载RVM shell env强制执行特定ruby和gem二进制文件的经验?

附:为了防止偏离主题的答案,不,谢谢我不需要Ruby 1.8.7,Passenger或nginx.

解决方法

你应该可以使用 rvm exec

Like most of the rvm set operations,exec lets your perform commands against all installed rubies. Unlike the others,there is a key distinction – exec lets you run any command (versus just ruby / gem and the like) and if it is only run against a single ruby,it performs the equivalent of exec (e.g. no error message) after setting up the environment.

如果rvm可执行文件位于您的Web服务器用户的$PATH上,您可以执行以下操作:

"bin-path" => "rvm 1.9.2-p180 exec bundle exec rackup"

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读