RVM 如何在没有用户登录的情况下在生产中工作? [英] How does RVM work in production with no users logged in?

查看:59
本文介绍了RVM 如何在没有用户登录的情况下在生产中工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑在新机器上将 RVM 投入生产(轻型).但是我没有想象如果用户没有登录它会如何工作.RVM 已经安装到 /usr/local/rvm/bin/rvm 中,所以它对每个人"都可用.

Considering putting RVM into production (light duty) on a new machine. But I'm not visualizing how it will work if a user isn't logged in. RVM has been installed into /usr/local/rvm/bin/rvm so it is available to "everyone".

如果服务器重新启动并处于登录屏幕并且后台守护进程正在为 apache/rails 等服务,并且没有 .bashrc 等加载...我们如何/在哪里指定哪些 RVM红宝石加载?

If server restarts and is at login screen and background daemons are serving apache/rails, etc. and no .bashrc, etc. have loaded...how/where do we specify which of RVM's Rubies to load?

也许在 Phusion 的乘客中的某个地方?

Perhaps somewhere in Phusion's Passenger?

谁管理这些宝石?它们是共享的吗?

who manages these gemsets? are they shared?

推荐答案

您可以使用 RVM 的 wrapper 命令生成脚本,在执行必要的二进制文件之前加载正确的 RVM 环境.格式为:

You can use RVM's wrapper command to generate scripts that load up the correct RVM environment before executing the necessary binaries. The format is:

rvm wrapper [ruby_string] [wrapper_prefix] [binary[ binary[ ...]]]

例如,要创建一个名为 system_unicorn 的二进制文件,它加载 ruby-1.9.2-p180 然后执行 unicorn,请使用以下命令:

For example, to create a binary named system_unicorn that loads ruby-1.9.2-p180 and then executes unicorn, use the following:

rvm wrapper ruby-1.9.2-p180 system unicorn

您可以传递多个二进制文件来为其创建包装器.例如,要为 unicorngod 创建包装器,请运行

You can pass multiple binaries to create wrappers for. For example, to create wrappers for both unicorn and god, run

rvm wrapper ruby-1.9.2-p180 system unicorn god

ruby_string 可以是任何你可以传递给 rvm use 的东西,因此也可以包含 gemset;例如,要为 gemset my_app_gemset 创建 myapp_unicorn,请使用:

ruby_string can be anything you can pass to rvm use, and thus can contain gemsets as well; for example, to create myapp_unicorn for the gemset my_app_gemset, use:

rvm wrapper ruby-1.9.2-p180@my_app_gemset myapp unicorn

当您最近安装 Passenger 时,它会自动为其 ruby(很确定它称之为 passenger_ruby)创建一个包装器,用于加载正确版本的 Ruby(安装时使用的一个).您可以使用 config/setup_load_paths.rb 来指定 gemset--请参阅 此堆栈溢出答案.

When you install Passenger these days, it automatically creates a wrapper for it's ruby (pretty sure it calls it passenger_ruby) that loads up the correct version of Ruby (the one you're using when you install it). You can use config/setup_load_paths.rb to specify a gemset--see this Stack Overflow answer.

这篇关于RVM 如何在没有用户登录的情况下在生产中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆