EDIT: Turns out Jacob was right, sorry for the downvote. I've decided to expand on this solution a bit.
I could as it turns out use the rvm binary now, but since it's user-installed it is not on the $PATH on my laptop
bigbuk:~ julik$ which rvm
bigbuk:~ julik$
but it is on the server.
[julik@serveur ~]$ which rvm
/usr/local/rvm/bin/rvm
[julik@serveur ~]$
This is what confused me. Only it needs to be called with an absolute path (since FCGI runs without proper PATH being set). Se then the binary path should be configured accordingly, AND
rvm will of course properly set GEM_HOME and GEM_PATH for us as well. The only thing that really needs to be set is the BUNDLE_GEMFILE one since Bundler cannot autodetect
it from the rackup file and the cwd of the FCGI process is garbage.
"bin-path" => "/usr/local/rvm/bin/rvm 1.9.2-p180 exec bundle exec rackup /home/user/websites/behandelaar-web/current/web-root/",
"bin-environment" => (
"BUNDLE_GEMFILE" => "/home/user/websites/behandelaar-web/current/Gemfile",
"RACK_ENV" => "production",
),
That said, having a specific wrapper script written in Ruby does have some merit since both rackup AND bundle are very bad at bubbling exceptions, and if say there are problems
with the FCGI gem itself (which was what I had - it had 1.8-specific string-bytes handling) it's exceptions will not bubble up properly through this layered stack of wrappers and the
most insightful thing you will see in terms of error reports will be a status-500 page from your webserver.