URGENT: FATAL: Peer authentication failed for user "discourse"


(Slack-Moehrle) #1

I tried to restore a backup on a new server and realized I needed to install thor. After installing, I get:

URGENT: FATAL:  Peer authentication failed for user "discourse"
 Failed to initialize site default
Starting restore: public/backups/default/cocos2d-x-forum-2016-08-03-164447.tar.gz
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `initialize': FATAL:  Peer authentication failed for user "discourse" (PG::ConnectionBad)
    from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `new'
    from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `connect'
    from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize'
    from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new'
    from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection'
    from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection'
    from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection'
    from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection'
    from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout'
    from /usr/local/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
    from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout'
    from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection'
    from /usr/local/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
    from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection'
    from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:571:in `retrieve_connection'
    from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
    from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7/lib/active_record/connection_handling.rb:87:in `connection'
    from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7/lib/active_record/attributes.rb:93:in `columns'
    from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7/lib/active_record/attributes.rb:98:in `columns_hash'
    from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7/lib/active_record/core.rb:173:in `block in find_by'
    from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7/lib/active_record/core.rb:173:in `each'
    from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7/lib/active_record/core.rb:173:in `all?'
    from /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7/lib/active_record/core.rb:173:in `find_by'
    from /var/www/discourse/lib/discourse.rb:282:in `system_user'
    from script/discourse:77:in `restore'
    from /usr/local/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /usr/local/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /usr/local/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from /usr/local/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from script/discourse:227:in `<main>'

I’m researching a solution, starting with this: FATAL: Peer authentication failed for user “discourse” but I’m not well versed in Postgres. I had followed this to setup the new server: discourse/INSTALL-cloud.md at master · discourse/discourse · GitHub


(Rafael dos Santos Silva) #2

Are you using the default single container docker install?


(Slack-Moehrle) #3

Yes, I am. discourse/INSTALL-cloud.md at master · discourse/discourse · GitHub


(Rafael dos Santos Silva) #4

Ok, I have used the guide to migrate a server from Google Cloud to Linode two days ago, and it worked fine.

After installing Discourse is working?

Then you create an admin account, upload backup, allow restore on settings, click on restore and the error comes?


(Slack-Moehrle) #5

Yes, Discourse is working.

Yes, the backup data is where it is supposed to be.

Yes, allow restore is checked.

I started the backup yesterday and after 16 hours was still on “Migrating data”. The backup was about 3.5gb.

so today I re-booted the server and tried via the command-line and this is the error I am seeing.


(Rafael dos Santos Silva) #6

Are you using:

RAILS_DB=default  RAILS_ENV=production bundle exec script/discourse restore <filename.of.the.backup.tar.gz>

Or sometting like this?


(Slack-Moehrle) #7

I ran this command: script/discourse restore <filename.of.the.backup.tar.gz>


(Slack-Moehrle) #8

I’m doing this on an older PC with only 2gb of RAM running Ubuntu 16.04.1.

I’ll fire up a second test box with more ram and try Ubuntu 14.04. Perhaps this might yield something.


(Kane York) #9

Try just “discourse” without the script/ .