I'm currently setting up a rails application on a VPS and the process went rather well up until now. There seems to be a problem with rails connecting to my production database.
What I tried so far: Creating the "test" user and the production database "nn_production":
$ sudo -u postgres createuser -D -P test
$ sudo -u postgres createdb -O test nn_production;
\l gives:
Name | Owner | Encoding | Collate | Ctype | Access privileges
---------------+----------+----------+-------------+-------------+-----------------------
nn_production | test | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
Furthermore in /etc/postgresql/9.1/main/pg_hba.conf
from related SO question
I changed this line only:
local all all peer
to this:
local all all md5
I tried the following and that works.
$ psql -d nn_production -U test -W
Here is my database.yml
production:
adapter: postgresql
encoding: unicode
database: nn_production
min_messages: ERROR
pool: 5
host: localhost
username: test
password: test
I used capistrano and I'm in /u/apps/nn/current
Now when I try:
$ rake RAILS_ENV=production db:schema:load
I get the infamous
ActiveRecord::ConnectionNotEstablished
I'd be very thankful for any pointers. If theres some vital information missing just shout at me.
Edit: cat /var/log/postgresql/postgresql-9.2-main.log
2013-03-05 14:32:55 CET LOG: received fast shutdown request
2013-03-05 14:32:55 CET LOG: aborting any active transactions
2013-03-05 14:32:55 CET LOG: autovacuum launcher shutting down
2013-03-05 14:32:55 CET LOG: shutting down
2013-03-05 14:32:55 CET LOG: database system is shut down
2013-03-05 14:32:56 CET LOG: database system was shut down at 2013-03-05 14:32:55 CET
2013-03-05 14:32:56 CET LOG: autovacuum launcher started
2013-03-05 14:32:56 CET LOG: database system is ready to accept connections
2013-03-05 14:32:57 CET LOG: incomplete startup packet
Setup:
- Ubuntu 12.10
- rvm
- ruby 1.9.3
- rails version 3.2.12
- pg gem 0.14.1