title: Can't connect to PostgreSQL with Rails and Capistrano
body: <p>I'm trying to deploy my Rails 5 application using Postgres to a VPS via Capistrano. It keeps failing, though - giving me a <code>PG::ConnectionBad: FATAL: password authentication failed for user 'sys_user'</code>.</p>
  
  <p>The relevant settings of my <code>database.yml</code> are:</p>
  
  <pre><code>production:
    &lt;&lt;: *default
    database: &lt;%= ENV['RDS_DB_NAME'] %&gt;
    username: &lt;%= ENV['RDS_USERNAME'] %&gt;
    password: &lt;%= ENV['RDS_PASSWORD'] %&gt;
    host: &lt;%= ENV['RDS_HOSTNAME'] %&gt;
    port: &lt;%= ENV['RDS_PORT'] %&gt;
  </code></pre>
  
  <p>All these environment variables have been set in <code>/etc/environment</code> - this is definitely the case because it's picking up the <code>RDS_USERNAME</code> as <code>sys_user</code>. The password of the database is the same as the variable <code>RDS_PASSWORD</code>. The port, hostname etc. are all the same also.</p>
  
  <p>I'm stumped. Please help.</p>