为什么在部署时我没有配置'开发'数据库。可用:[“生产”]?

时间:2016-01-16 09:28:21

标签: ruby-on-rails deployment sidekiq

当我尝试bundle exec sidekiq时,我看到'development' database is not configured. Available: ["production"]。但是,如果我将应用程序部署到服务器并需要production,它为什么要查找开发数据库?上次我没有这个问题..在哪里看?

修改 我的控制台$ /var/www/vkgazer/code# bundle exec sidekiq

之后
'development' database is not configured. Available: ["production"]
/var/www/vkgazer/code/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.4/lib/active_record/connection_adapters/connection_specification.rb:248:in `resolve_symbol_connection'
/var/www/vkgazer/code/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.4/lib/active_record/connection_adapters/connection_specification.rb:211:in `resolve_connection'
/var/www/vkgazer/code/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.4/lib/active_record/connection_adapters/connection_specification.rb:139:in `resolve'
/var/www/vkgazer/code/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.4/lib/active_record/connection_adapters/connection_specification.rb:169:in `spec'
/var/www/vkgazer/code/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.4/lib/active_record/connection_handling.rb:50:in `establish_connection'
/var/www/vkgazer/code/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.4/lib/active_record/railtie.rb:120:in `block (2 levels) in <class:Railtie>'
/var/www/vkgazer/code/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
/var/www/vkgazer/code/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
/var/www/vkgazer/code/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
/var/www/vkgazer/code/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/lazy_load_hooks.rb:27:in `each'
/var/www/vkgazer/code/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
/var/www/vkgazer/code/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.4/lib/active_record/railtie.rb:116:in `block in <class:Railtie>'
/var/www/vkgazer/code/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `instance_exec'
/var/www/vkgazer/code/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `run'
/var/www/vkgazer/code/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:55:in `block in run_initializers'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `each'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `call'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
/var/www/vkgazer/code/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/initializable.rb:54:in `run_initializers'
/var/www/vkgazer/code/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/application.rb:352:in `initialize!'
/var/www/vkgazer/code/config/environment.rb:7:in `<top (required)>'
/var/www/vkgazer/code/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
/var/www/vkgazer/code/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `block in require'
/var/www/vkgazer/code/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240:in `load_dependency'
/var/www/vkgazer/code/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
/var/www/vkgazer/code/vendor/bundle/ruby/2.2.0/gems/sidekiq-4.0.1/lib/sidekiq/cli.rb:236:in `boot_system'
/var/www/vkgazer/code/vendor/bundle/ruby/2.2.0/gems/sidekiq-4.0.1/lib/sidekiq/cli.rb:49:in `run'
/var/www/vkgazer/code/vendor/bundle/ruby/2.2.0/gems/sidekiq-4.0.1/bin/sidekiq:13:in `<top (required)>'
/var/www/vkgazer/code/vendor/bundle/ruby/2.2.0/bin/sidekiq:23:in `load'
/var/www/vkgazer/code/vendor/bundle/ruby/2.2.0/bin/sidekiq:23:in `<main>'

请帮助。

1 个答案:

答案 0 :(得分:1)

默认rails环境为development,无论是部署还是本地。默认值为development。所以你应该用production指定你的环境:

$ RAILS_ENV=production bundle exec sidekiq