I just updated my production rails app with Capistrano within a new gemset for ruby 2.2 and I got the following error :
/var/www/odpf/shared/bundle/ruby/2.2.0/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/connection_specification.rb:47:in `resolve_hash_connection': database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified)
This is my database.yml :
production:
host: localhost
port: xxxx
adapter: postgresql
encoding: utf8
database: odpf
pool: 5
username: xxxxxx
password: xxxxxx
I dont understand why I got this error as my database.yml didnt changed before and after the capisrano update.
All gems are stored into /var/www/odpf/shared/bundle/ruby/2.2.0/gems.
The pg gem for postgresql is present if I run a bundle exec gem list
My database is working as I can connect to it from psql with the user of database.yml : \c odpf xxxxxx 127.0.0.1 xxxx
So I don't understand what's going wrong.
This is also an extract of a bigger trace error when I run a bundle exec rails c
:
/var/www/odpf/current$ bundle exec rails c
/var/www/odpf/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.21/lib/active_support/values/time_zone.rb:270: warning: circular argument reference - now
/var/www/odpf/shared/bundle/ruby/2.2.0/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/connection_specification.rb:47:in `resolve_hash_connection': database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified)
from /var/www/odpf/shared/bundle/ruby/2.2.0/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/connection_specification.rb:41:in `resolve_string_connection'
It is talking about a circular reference in ActiveSupport, maybe it helps to solve this ?
=== UPDATE ===
I just add test and development section to my database.yml and the error message did change. It seems rails believe he is in test mode :
bundle exec rails c
/var/www/odpf/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.21/lib/active_support/values/time_zone.rb:270: warning: circular argument reference - now
/var/www/odpf/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- test/unit/testcase (LoadError)
I can't figure out why this happen though ? Because I've got a RailsEnv production
line in my virtual host, and it was working fine before capistrano update.
In fact everything was correct.
About rails console, it always executes in developpement mode unless you ask specificaly for production parameter.
Concerning my issue, I had to stop postgresql, stop apache2, and modify my .gitignore
file to track again the tmp/restart.txt file and make it part of my repository again (by copying it, deleting the old one, git add -A
, git push ...
).
Then start back postgresql and apache2.
Sorry for the question.