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

This works for me:

But there are several other ways to fix this to choose from:

  • add env setting USER=discourse to the docker boot image

  • add -e USER=discourse \ to d\exec

  • add this to backup_restore.rb

      if Rails.env.development?
        username = ENV["USER"] || "discourse"
      end
    

In addition, there is a new problem when executing d/discourse in the docker dev environment:

$ d/discourse backup
<internal:/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:86:in `require': cannot load such file -- thor (LoadError)
        from <internal:/usr/local/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:86:in `require'
        from script/discourse:4:in `<main>'

while d/bundle exec script/discourse backup works (see patch).