乘客错过了生产环境中的发展宝石

乘客错过了生产环境中的发展宝石

本文介绍了乘客错过了生产环境中的发展宝石的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的生产服务器上有一个奇怪的行为:我通过Capistrano将我的Rails 3应用程序部署到生产服务器。 Capistrano脚本在部署结束后重新启动乘客。当我打开应用程序时,我看到一个乘客错误消息:

 无法在任何一个中找到autotest-fsevent-0.2.4来源
(Bundler :: GemNotFound)

当然autotest-fsevent没有安装在我的生产环境(甚至不能在Ubuntu上安装......)

环境设置在apache的虚拟主机中:

 < VirtualHost *> 
PassengerMinInstances 1

ServerName test.myapp.de
DocumentRoot / var / www / myapp / current / public
$ b RailsEnv制作
RackEnv生产

< Directory / var / www / myapp / current / public />
选项-Indexes
AllowOverride无
排序拒绝,允许
拒绝无
允许所有
AddOutputFilterbyType DEFLATE text / html
FileEtag无
< / Directory>

LogLevel警告
ErrorLog /var/www/myapp/shared/log/error.log
CustomLog /var/www/myapp/shared/log/access.log combined

< / VirtualHost>

这是我的Gemfile:



<$ p $ source'http://rubygems.org'

gem'rails','3.0.6'
gem'jquery-rails'

gem'mysql'
gem'simple-navigation'
gem'geokit'
gem'geokit-rails3',:git => git://github.com/loosecubes/geokit-rails3.git
gem'validates_timeliness','〜> 3.0.2'
gem'delocalize'
gem'prawn'

group:development do
gem'rspec-rails','2.5.0'
gem'faker','0.3.1'
#gem'ruby-debug19'
gem'ruby-debug'
gem'autotest','4.4.6'
gem'autotest-rails-pure','4.1.2'
gem'autotest-fsevent','0.2.4'
gem'autotest-growl','0.2.9'
结束

group:test do
gem'rspec','2.5.0'
gem'rcov'
gem'webrat','0.7.1'
gem'factory_girl_rails','1.0'
end

为什么乘客或者捆绑销售商)认为它需要所有的宝石,而不仅仅是生产环境的宝石?



感谢您的帮助!

解决方案

您是否在使用捆绑器capistrano食谱?

确保这在您的 config / deploy中。 rb

  require'bundler / capistrano'

基本上它会使用调用bundle - 没有开发测试选项,它应该只安装生产宝石。如果您只是做一个普通的 bundle ,它会安装尝试为所有环境安装gem。


I've got a strange behaviour on my production server: I deploy my Rails 3 application via Capistrano to the production server. The Capistrano script restarts passenger at the end of deployment. When I open the application I see a passenger error message:

Could not find autotest-fsevent-0.2.4 in any of the sources
(Bundler::GemNotFound)

Of course autotest-fsevent is not installed in my production environment (and even can't be installed on Ubuntu...)

The environment is set in apache's virtualhost:

<VirtualHost *>
  PassengerMinInstances 1

  ServerName test.myapp.de
  DocumentRoot /var/www/myapp/current/public

  RailsEnv production
  RackEnv production

  <Directory /var/www/myapp/current/public/>
    Options -Indexes
    AllowOverride None
    Order deny,allow
    Deny from none
    Allow from all
    AddOutputFilterbyType DEFLATE text/html
    FileEtag none
  </Directory>

  LogLevel warn
  ErrorLog /var/www/myapp/shared/log/error.log
  CustomLog /var/www/myapp/shared/log/access.log combined

</VirtualHost>

Here is my Gemfile:

source 'http://rubygems.org'

gem 'rails', '3.0.6'
gem 'jquery-rails'

gem 'mysql'
gem 'simple-navigation'
gem 'geokit'
gem 'geokit-rails3', :git => "git://github.com/loosecubes/geokit-rails3.git"
gem 'validates_timeliness', '~> 3.0.2'
gem 'delocalize'
gem 'prawn'

group :development do
gem 'rspec-rails', '2.5.0'
gem 'faker', '0.3.1'
#gem 'ruby-debug19'
gem 'ruby-debug'
gem 'autotest', '4.4.6'
gem 'autotest-rails-pure', '4.1.2'
gem 'autotest-fsevent', '0.2.4'
gem 'autotest-growl', '0.2.9'
end

group :test do
  gem 'rspec', '2.5.0'
  gem 'rcov'
  gem 'webrat', '0.7.1'
  gem 'factory_girl_rails', '1.0'
end

Why does passenger (or bundler) think it needs ALL gems instead only the gems for production environment?

Thanks for your help!

解决方案

Are you using the bundler capistrano recipes?

Make sure this is in your config/deploy.rb

require 'bundler/capistrano'

Basically it will invoke bundle with the --without development test option, which should only install the production gems. If you are just doing a regular bundle, it will install try to install the gems for all environments.

这篇关于乘客错过了生产环境中的发展宝石的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 01:03