Peer Authentication Failed

Problem:
I have foreman running behind nginx and it can’t start. It says "Message from application: FATAL: Peer authentication failed for user “foreman”

Manually logging into postgresql with the foreman credential from database.yaml doesn’t work as well, says password is incorrect.

Expected outcome:
To start foreman

Foreman and Proxy versions:
Foreman Version: 1.16
Nginx Version: 1.13.9
Ruby: 2.3

Foreman and Proxy plugin versions:
No plugins other than the default

Other relevant data:
App 4391 stdout:
App 4391 stderr: Log file /usr/share/foreman/log/production.log cannot be opened. Falling back to STDOUT
App 4391 stdout: WARN root : No appender set, logging to STDOUT
App 4391 stderr: The PGconn, PGresult, and PGError constants are deprecated, and will be
App 4391 stderr: removed as of version 1.0.
App 4391 stderr:
App 4391 stderr: You should use PG::Connection, PG::Result, and PG::Error instead, respectively.
App 4391 stderr:
App 4391 stderr: Called from /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.9/lib/active_support/dependencies.rb:240:in `load_dependency’
App 4391 stdout:
[ E 2018-03-07 11:21:33.3849 4080/Tz age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /usr/share/foreman: An error occurred while starting up the preloader.
Error ID: 90b9c4ad
Error details saved to: /tmp/passenger-error-A5DW50.html
Message from application: FATAL: Peer authentication failed for user “foreman”
(PG::ConnectionBad)

Is this a new install or did it stop working after an upgrade? Does the user exist?

$ sudo -u postgres psql
postgres=# \du
                             List of roles
 Role name |                   Attributes                   | Member of 
-----------+------------------------------------------------+-----------
 candlepin | Superuser                                      | {}
 katello   | Superuser                                      | {}
 postgres  | Superuser, Create role, Create DB, Replication | {}

(Sorry, I’m using katello in this example; your user will be ‘foreman’)