我的生产服务器上有一个奇怪的行为:我通过 Capistrano 将 Rails 3 应用程序部署到生产服务器。 Capistrano 脚本在部署结束时重新启动乘客。当我打开应用程序时,我看到一条乘客错误消息:
Could not find autotest-fsevent-0.2.4 in any of the sources
(Bundler::GemNotFound)
当然我的生产环境中没有安装autotest-fsevent(甚至在Ubuntu上也无法安装...)
环境在apache的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>
这是我的 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
为什么乘客(或 bundle 者)认为它需要所有 gem,而不是仅生产环境的 gem?
感谢您的帮助!
最佳答案
您是否使用 bundler capistrano 食谱?
确保它位于您的config/deploy.rb
require 'bundler/capistrano'
基本上,它将使用--withoutdevelopmenttest
选项调用bundle,该选项应该只安装生产gems。如果您只是做一个常规的 bundle
,它将安装尝试为所有环境安装gems。
关于ruby-on-rails - 乘客错过了生产环境中的开发 gem ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6200931/