简体   繁体   English

AWS OpsWorks中未建立ActiveRecord :: Connection

[英]ActiveRecord::ConnectionNotEstablished in AWS OpsWorks

I already tried the various solutions including this one below, but still getting the same error. 我已经尝试过各种解决方案,包括下面的解决方案,但仍然遇到相同的错误。 Appreciate any leads. 赞赏任何线索。

Removing database.yml when using Mongoid in Rails 3.2 在Rails 3.2中使用Mongoid时删除database.yml

root@cumulonimbus:/srv/www/myapp/current/log# cat unicorn.stderr.log 
I, [2014-02-15T13:59:29.053668 #19768]  INFO -- : Refreshing Gem list
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
I, [2014-02-15T14:00:11.666899 #19768]  INFO -- : listening on addr=/srv/www/myapp/shared/sockets/unicorn.sock fd=14
E, [2014-02-15T14:00:11.667401 #19768] ERROR -- : ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)
/home/deploy/.bundler/myapp/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
/home/deploy/.bundler/myapp/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
/home/deploy/.bundler/myapp/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
/srv/www/myapp/shared/config/unicorn.conf:31:in `block in reload'
/home/deploy/.bundler/myapp/ruby/1.9.1/gems/unicorn-4.8.2/lib/unicorn/http_server.rb:515:in `call'
/home/deploy/.bundler/myapp/ruby/1.9.1/gems/unicorn-4.8.2/lib/unicorn/http_server.rb:515:in `spawn_missing_workers'
/home/deploy/.bundler/myapp/ruby/1.9.1/gems/unicorn-4.8.2/lib/unicorn/http_server.rb:140:in `start'
/home/deploy/.bundler/myapp/ruby/1.9.1/gems/unicorn-4.8.2/bin/unicorn_rails:209:in `<top (required)>'
/home/deploy/.bundler/myapp/ruby/1.9.1/bin/unicorn_rails:23:in `load'
/home/deploy/.bundler/myapp/ruby/1.9.1/bin/unicorn_rails:23:in `<main>'

root@cumulonimbus:/srv/www/myapp/current# grep -r active_record config/
config/environments/test.rb:  # config.active_record.schema_format = :sql
config/initializers/session_store.rb:# MyApp::Application.config.session_store :active_record_store
config/initializers/devise.rb:  # Load and configure the ORM. Supports :active_record (default) and
config/application.rb:# require "active_record/railtie"
config/application.rb:    # config.active_record.observers = :cacher, :garbage_collector, :forum_observer

root@cumulonimbus:/srv/www/myapp/current# bundle show|grep -E 'unicorn|rails'

• rails (3.2.11) •滑轨(3.2.11)

• unicorn (4.8.2) •独角兽(4.8.2)

root@cumulonimbus:/srv/www/myapp/current# gem -v

2.1.11

root@cumulonimbus:/srv/www/myapp/current# ruby -v

ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]

Issue sorted. 问题已排序。 Apparently the stock OpsWorks unicorn cookbook has references to ActiveRecord. 显然,《 OpsWorks独角兽食谱》参考了ActiveRecord。 So by commenting/removing the whole blocks of before_fork..end and after_fork..end helped us deploy the app that uses mongoid. 因此,通过注释/删除before_fork..end和after_fork..end的整个块,可以帮助我们部署使用mongoid的应用程序。

https://github.com/aws/opsworks-cookbooks/blob/master-chef-11.4/unicorn/templates/default/unicorn.conf.erb https://github.com/aws/opsworks-cookbooks/blob/master-chef-11.4/unicorn/templates/default/unicorn.conf.erb

We need to leverage sock file as opposed to port method in NginX, so highly beneficial for our app. 我们需要利用Sock文件而不是NginX中的port方法,因此对我们的应用程序非常有益。

Two more tasks are to override the default key-values from stock unicorn and auto start using shared/script/unicorn script as deploy user. 还有两个任务是从股票unicorn覆盖默认键值,并以部署用户的身份使用共享/脚本/ unicorn脚本自动启动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM