שגיאה בשינוי סיסמת משתמש בעת בניית קונטיינר Postgres

After postgres is successfully installed in the container, the launcher script tries to change the password of the discourse user. However I get this error

Pups::ExecError: su - postgres -c 'psql discourse' failed with return #<Process::Status: pid 100 exit 141>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec failed with the params {"stdin"=>"alter user discourse with password 'redacted';\n", "cmd"=>"su - postgres -c 'psql discourse'", "raise_on_fail"=>true}
bootstrap failed with exit code 141
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.

Seems like postgres isn’t running when this command is reached so it fails in a broken pipe. My postgres.yml is based off the data.yml sample file though, so I’m not sure what I’m doing wrong. Any ideas?

Would you please

And then share them here?

לייק 1

Hi, nothing notable in the earlier logs, but I noticed in the container logs this message

2024-01-26 12:30:54 I, [2024-01-26T17:30:54.465403 #1]  INFO -- : Reading from stdin
2024-01-26 12:30:54 /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/config.rb:22:in `block in initialize': undefined method `has_key?' for nil:NilClass (NoMethodError)
2024-01-26 12:30:54 
2024-01-26 12:30:54         @config[key] = {} unless @config.has_key?(key)
2024-01-26 12:30:54                                         ^^^^^^^^^
2024-01-26 12:30:54     from /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/config.rb:21:in `each'
2024-01-26 12:30:54     from /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/config.rb:21:in `initialize'
2024-01-26 12:30:54     from /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/cli.rb:68:in `new'
2024-01-26 12:30:54     from /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/cli.rb:68:in `run'
2024-01-26 12:30:54     from /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/bin/pups:9:in `<top (required)>'
2024-01-26 12:30:54     from /usr/local/bin/pups:25:in `load'
2024-01-26 12:30:54     from /usr/local/bin/pups:25:in `<main>'

This crashes the container even with the after_postgres password alteration commented out, which is where the broken pipe comes in