My question is similar to the one posted below, I want to follow the answer provided but I can’t find where the docker-composer.yml file is located on my Ubuntu 22.04 server. I only have ssh access to admin root.
postgres with docker compose gives FATAL: role “root” does not exist error
Full story for context:
I am running a Discourse forum on Ubuntu 22.04 (recently step updated from 18.04–>20.04–>22.04)
When I try to rebuild the Discourse app launcher, I get the following issue which prevents the app from rebuilding:
connection to server on socket “/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory (PG::ConnectionBad) Is the server running locally and accepting connections on that socket?
I followed these steps to install postgres: How to Install and Use PostgreSQL on Ubuntu 20.04. | Linode Docs
It is successfully running, (as per the below output):
root@domain:~# sudo systemctl enable postgresql.service
Synchronizing state of postgresql.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable postgresql
root@domain:~# sudo systemctl status postgresql.service
● postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
Active: active (exited) since Tue 2024-06-11 22:27:14 UTC; 34s ago
Main PID: 164416 (code=exited, status=0/SUCCESS)
CPU: 1ms
–
However, the app rebuild still fails to rebuild with same error. I suspect this is due to the docker-compose file not configured with the correct postgres user:
psql postgres -c 'SELECT version();'
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: role "root" does not exist
This is from the linked topic on Stack overflow:
*If you don’t specify the PGUSER environment variable, then psql will assume you want to use the current OS user as your database user name. In this case, you are using root as your OS user, and you will attempt to log in as root, but that user doesn’t exist in the database.
You’ll need to either call psql -U postgres, or su - Postgres first*
Where do I edit the docker-compose.yml file to assign the correct user…Or am I barking up the wrong tree entirely?
TIA