Note that there are some explanatory texts on larger screens.

plurals
  1. POSetting up postgres for rails production on VPS
    primarykey
    data
    text
    <p>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.</p> <p>What I tried so far: Creating the "test" user and the production database "nn_production":</p> <pre><code>$ 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 | </code></pre> <p>Furthermore in <code>/etc/postgresql/9.1/main/pg_hba.conf</code> <a href="https://stackoverflow.com/questions/9797640/rails-3-2-2-or-3-2-1-postgresql-9-1-3-ubuntu-11-10-connection-error">from related SO question</a></p> <p>I changed this line only:</p> <pre><code>local all all peer </code></pre> <p>to this:</p> <pre><code>local all all md5 </code></pre> <p>I tried the following and that works.</p> <pre><code>$ psql -d nn_production -U test -W </code></pre> <p>Here is my database.yml</p> <pre><code>production: adapter: postgresql encoding: unicode database: nn_production min_messages: ERROR pool: 5 host: localhost username: test password: test </code></pre> <p>I used capistrano and I'm in /u/apps/nn/current</p> <p>Now when I try:</p> <pre><code>$ rake RAILS_ENV=production db:schema:load </code></pre> <p>I get the infamous</p> <pre><code>ActiveRecord::ConnectionNotEstablished </code></pre> <p>I'd be very thankful for any pointers. If theres some vital information missing just shout at me.</p> <p>Edit: <code>cat /var/log/postgresql/postgresql-9.2-main.log</code></p> <pre><code>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 </code></pre> <p>Setup:</p> <ul> <li>Ubuntu 12.10</li> <li>rvm</li> <li>ruby 1.9.3</li> <li>rails version 3.2.12</li> <li>pg gem 0.14.1</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload