title: Unable to authenticate postgres user during capistrano deploy on AWS
body: <p>I'm attempting to deploy a rails app to AWS.  The deploy fails with</p>
  
  <pre><code>PG::ConnectionBad: FATAL: Ident authentication failed for user "postgres"
  </code></pre>
  
  <p>My <code>database.yml</code> file (merged by capistrano from the shared dir under my app root) looks like this</p>
  
  <pre><code>production:
    adapter: postgresql
    encoding: unicode
    database: tpms_prod
    username: postgres
    host: 127.0.0.1
    port: 5432
  </code></pre>
  
  <p>and the <code>pg_hba.conf</code> is the default and looks like this</p>
  
  <pre><code># TYPE  DATABASE        USER            ADDRESS                 METHOD
  
  # "local" is for Unix domain socket connections only
  local   all             all                                     peer
  # IPv4 local connections:
  host    all             all             127.0.0.1/32            ident
  # IPv6 local connections:
  host    all             all             ::1/128                 ident
  </code></pre>
  
  <p>I've tried changing the authentication settings in <code>pg_hba.conf</code> to <code>password</code> but that still reports a failing Ident authentication!  </p>
  
  <p>I've tried adding a new super user to the database and using that user in the <code>database.yml</code> file - but the ident auth fails for that user as well, so I know that the <code>database.yml</code> file is being used by the deploy process.</p>
  
  <p>If I understand the ident mechanism correctly, then the user requesting the connection just has to 'be' a declared user and this is borne out on the command line. </p>