Pups::ExecError: su postgres -c 'psql discourse -c "alter schema public owner to discourse;"' failed with return

I am nnot fully sure of the procedure but you might be able to load the site in safe mode.

@JammyDodger can you link the procedure for safe mode?