Ok I have a confession to make - I still run a massive FCGI setup (just alot of servers configured). I am trying to adapt it to rvm. In the fcgi settings I can specify the commandline command to execute for running my application (Sinatra, Rack, Bundler, the whole thing), and this is what I'd do without rvm
"bin-path" => "bundle exec rackup",
"bin-environment" => (
"RACK_ENV" => "development"
),
assuming my rackup file is just config.ru. Now, on my Mac this works:
"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"
),
but not on the server. When the dispatchers are started they get a stripped-down env where RVM shell trickery no longer works. I guess I should use the wrapper option to make some sort of wrapper but I don't really understand how that would alleviate my problem and which arguments to use. Does anyone have experience with enforcing a specific ruby and gem binaries without having RVM shell env loaded?
P.S. To prevent off-topic answers, no thanks I don't need Ruby 1.8.7, Passenger or nginx.
You should be able to use 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.
If the rvm
executable is on the $PATH
for your webserver's user, you can do:
"bin-path" => "rvm 1.9.2-p180 exec bundle exec rackup"