Backup restore failing on clean dev docker env: FATAL: Peer authentication failed for user “postgres”

I have had the same problems.
Finally I inserted the following as a workaround

   if Rails.env.development?
      username = "discourse"
      password = "discourse"
      config["host"] = "localhost"
      config["port"] = 5432
      config["database"] = "discourse_development"
    end

before

  DatabaseConfiguration.new(

into /lib/backup_restore.rb.

I also had to set the password for user discourse via

d/psql -c "ALTER USER discourse WITH PASSWORD 'discourse';"

There might be nicer ways to achieve this.

1 Like