I need to host different Ruby applications on a single server. The apps each have their own mutually incompatible ruby versions and gems. Is there a way to install RVM in system-wide mode and have gemsets which are also system-wide, and not tied to a specific user and his $HOME directory? Or is there a better approach altogether for hosting different Ruby apps on the same machine?
使用RVM的混合模式安装基本上可以得到系统安装,并且每个应该运行自己的gemset的用户都可以使用:
rvm user gemsets
Because of numerous problems with RVM in system-wide mode (rvmsudo not working, directories being created in filesystem root by RVM, etc.) I've decided to go down the vendor/bundle
route.
I installed ruby 1.9.3 w/ latest patches using my distro's package manager and then ran gem install bundler --no-user-install
which installed bundler gem system wide.
I then ran in each app's directory bundle install --path vendor/bundle --without development test
which installed required production gems in app's vendor/bundle
directory. If there were any rake tasks or plain ruby files to run as part of app's setup then those were prefixed with bundle exec ...
(which uses the gem environment from vendor/bundle when running the command).
In the end all apps were directly runnable without any prior environment setup or RVM magic, and each have separate gems.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.