生产中的Rails部署 - 总是抱怨dalli

时间:2015-05-11 21:42:17

标签: ruby-on-rails ruby deployment production capistrano3

使用我在尝试生产部署时无法摆脱此错误

Could not find cache store adapter for mem_cache_store (cannot load such file -- dalli) (RuntimeError)

我真的不明白。到目前为止,我在开发中部署没有问题,即使我在我的Gemfile中将copy /environments/development.rb更改为/environments/production.rb , I still get the same message. I have added the gem delli`,但它仍然会抱怨。

我不知道mem_cache_store来自何处,因为即使我明确地将:memory_store更改为:file_store,错误仍然相同

环境/ production.rb

Rails.application.configure do
  config.cache_classes = true
  config.eager_load = true
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true
  config.serve_static_files = false
  config.assets.js_compressor = :uglifier
  config.assets.css_compressor = :sass
  config.assets.compile = false
  config.assets.digest = true
  config.assets.version = '1.0'
  config.force_ssl = true
  config.log_level = :debug
  ActionMailer::Base.smtp_settings = {
    :address => "localhost",
  }
  config.i18n.fallbacks = true
  config.active_support.deprecation = :notify
  config.cache_store = :memory_store
  config.log_formatter = ::Logger::Formatter.new
end

Capistrano deploy / production.rb

set :branch, :production
set :stage, :production
set :rails_env, 'production'
set :deploy_to, '/var/www/******'

set :log_level, :debug
set :keep_releases, 5
set :bundle_without, %w{test development}.join(' ') 
set :bundle_flags, '--deployment --quiet'

错误的完整堆栈跟踪

Could not find cache store adapter for mem_cache_store (cannot load such file -- dalli) (RuntimeError)
  /var/www/intranet_rails_test/shared/bundle/ruby/2.0.0/gems/activesupport-4.2.0/lib/active_support/cache.rb:106:in `rescue in retrieve_store_class'
  /var/www/intranet_rails_test/shared/bundle/ruby/2.0.0/gems/activesupport-4.2.0/lib/active_support/cache.rb:104:in `retrieve_store_class'
  /var/www/intranet_rails_test/shared/bundle/ruby/2.0.0/gems/activesupport-4.2.0/lib/active_support/cache.rb:60:in `lookup_store'
  /var/www/intranet_rails_test/shared/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/application/bootstrap.rb:76:in `block in <module:Bootstrap>'
  /var/www/intranet_rails_test/shared/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `instance_exec'
  /var/www/intranet_rails_test/shared/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `run'
  /var/www/intranet_rails_test/shared/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/initializable.rb:55:in `block in run_initializers'
  /usr/local/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
  /usr/local/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
  /usr/local/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
  /usr/local/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
  /usr/local/lib/ruby/2.0.0/tsort.rb:180:in `each'
  /usr/local/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
  /usr/local/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
  /var/www/intranet_rails_test/shared/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/initializable.rb:54:in `run_initializers'
  /var/www/intranet_rails_test/shared/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/application.rb:352:in `initialize!'
  /var/www/intranet_rails_test/releases/20150511202754/config/environment.rb:7:in `<top (required)>'
  config.ru:3:in `require'
  config.ru:3:in `block in <main>'
  /var/www/intranet_rails_test/shared/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/builder.rb:55:in `instance_eval'
  /var/www/intranet_rails_test/shared/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/builder.rb:55:in `initialize'
  config.ru:1:in `new'
  config.ru:1:in `<main>'
  /usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.37/helper-scripts/rack-preloader.rb:112:in `eval'
  /usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.37/helper-scripts/rack-preloader.rb:112:in `preload_app'
  /usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.37/helper-scripts/rack-preloader.rb:158:in `<module:App>'
  /usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.37/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
  /usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.37/helper-scripts/rack-preloader.rb:28:in `<main>'

使用Capistrano 3,Rails 4.2

1 个答案:

答案 0 :(得分:1)

有些宝石需要安装包。 Dalli使用memcached。如果您需要dalli,请使用您的包管理器安装它(apt-get等)