使用乘客运行 Rails 3.0 和 Rails 3.1 应用程序(使用不同的 rvm gemset)
我只是按照这些说明安装新的rvm gemset并安装rails-3.1.0.rc2我的本地机器。起初我收到一个 Passenger 错误,说无法加载 rake-0.9.2 gem,但我发现 this 提醒我运行“$passenger-install-apache2-module”。它安装得很好,提示我将以下内容添加到我的 Apache 配置文件(/etc/apache2/httpd.conf)中:
LoadModule passenger_module /Users/robs/.rvm/gems/[email protected]/gems/passenger-3.0.7/ext/apache2/mod_passenger.so
PassengerRoot /Users/robs/.rvm/gems/[email protected]/gems/passenger-3.0.7
PassengerRuby /Users/robs/.rvm/wrappers/[email protected]/ruby
但是,已经有来自不同 gemset 的三行:
LoadModule passenger_module /Users/robs/.rvm/gems/[email protected]/gems/passenger-3.0.7/ext/apache2/mod_passenger.so
PassengerRoot /Users/robs/.rvm/gems/[email protected]/gems/passenger-3.0.7
PassengerRuby /Users/robs/.rvm/wrappers/[email protected]/ruby
如果我将两组行都保留为未注释(@ Rails-3.1 gemset 是最后一个),然后重新启动 Apache,我的 Rails 3.0 应用程序将无法启动。我发现自己必须注释掉 Rails 3.1 gemset 行,重新启动 Apache,然后运行 "$ rvm use [电子邮件受保护]"。如果我想运行 Rails 3.1 应用程序,我必须执行相反的操作。
有没有办法让两者能够同时运行而无需这些额外的步骤?
I just followed these directions for installing a new rvm gemset and installing rails-3.1.0.rc2 on my local machine. At first I was getting a Passenger error saying the rake-0.9.2 gem could not be loaded, but I found this reminding me to run "$ passenger-install-apache2-module". It installed fine prompted me to add the following to my Apache config file (/etc/apache2/httpd.conf):
LoadModule passenger_module /Users/robs/.rvm/gems/[email protected]/gems/passenger-3.0.7/ext/apache2/mod_passenger.so
PassengerRoot /Users/robs/.rvm/gems/[email protected]/gems/passenger-3.0.7
PassengerRuby /Users/robs/.rvm/wrappers/[email protected]/ruby
However, there are already three lines there from a different gemset:
LoadModule passenger_module /Users/robs/.rvm/gems/[email protected]/gems/passenger-3.0.7/ext/apache2/mod_passenger.so
PassengerRoot /Users/robs/.rvm/gems/[email protected]/gems/passenger-3.0.7
PassengerRuby /Users/robs/.rvm/wrappers/[email protected]/ruby
If I leave both sets of lines there uncommented (the @rails-3.1 gemset's is last), and restart Apache, my Rails 3.0 app won't start. I find myself having to comment out the rails 3.1 gemset lines, restart Apache, and then run "$ rvm use [email protected]". If I want to run the Rails 3.1 app, I have to do the opposite.
Is there a way to have both be able to run at the same time without these extra steps?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以告诉 Passenger 在没有 gemset 的情况下使用 ruby 1.9.2,然后在每个应用程序中运行 rvm 使用 ruby-1.9.2-p180 并捆绑安装。这意味着您的基础 ruby-1.9.2-p180 将拥有两个应用程序的 gem,并且捆绑器应该处理限制您的应用程序可用的 gem。
最终结果:
You could tell Passenger to use ruby 1.9.2 without a gemset, then in each of your apps run rvm use ruby-1.9.2-p180 and bundle install. This means your base ruby-1.9.2-p180 will have the gems for both applications, and bundler should handle limiting the gems available to your application.
End result: