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".
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?
Perhaps somewhere in Phusion's Passenger?
who manages these gemsets? are they shared?
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[ ...]]]
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
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
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With