I have an application running on Ubuntu server that's using PostgreSQL.
I can run the application's executable (as a non-root user) from the project's directory.
I have created a service for this application (/etc/systemd/system/cineapi.service
), so that it starts automatically on reboot. The contents of this file are:
[Unit]Description=cineapi[Service]Type=simpleRestart=on-failureRestartSec=5sWorkingDirectory=/home/saurabh/projects/cineapiExecStart=/home/saurabh/projects/cineapi/cineapi.o[Install]WantedBy=multi-user.target
When a reload the system daemon and start the service like:
sudo systemctl daemon-reloadsudo service cineapi start
I'm getting an error:
pq: password authentication failed for user "root"
I dont understand why this is happening. I'm not using the "root" user anywhere in the application. It's .env
file looks like
postgres://goapi:somepassword@MY_IPV4_ADDR:DB_PORT/cineapi
and is sourced at startup. I also have the following changes in:
/etc/postgresql/16/main/postgresql.conf
password_encryption = scram-sha-256
/etc/postgresql/16/main/pg_hba.conf
host cineapi goapi MY_IPV4_ADDR scram-sha-256