I'm working on deploying my flask application on nginx and gunicorn and for a while I've been able to access the site on my mobile device but a couple of days ago it abruptly stopped. The logs showed that postgres was not starting. When I checked the postgres logfile I got the following error.
2022-08-03 15:23:42.681 EAT [32977] LOG: starting PostgreSQL 14.2 on x86_64-pc-
linux-gnu, compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, 64-bit
2022-08-03 15:23:42.682 EAT [32977] LOG: listening on IPv4 address "127.0.0.1", port
5432
2022-08-03 15:23:42.824 EAT [32977] LOG: listening on Unix socket
"/tmp/.s.PGSQL.5432"
2022-08-03 15:23:42.891 EAT [32978] LOG: database system was shut down at 2022-08-03
15:22:21 EAT
2022-08-03 15:23:42.926 EAT [32977] LOG: database system is ready to accept
connections
2022-08-03 16:15:01.391 EAT [32977] LOG: received fast shutdown request
2022-08-03 16:15:01.448 EAT [32977] LOG: aborting any active transactions
2022-08-03 16:15:01.449 EAT [32977] LOG: background worker "logical replication
launcher" (PID 32984) exited with exit code 1
2022-08-03 16:15:01.449 EAT [32979] LOG: shutting down
2022-08-03 16:15:01.609 EAT [32977] LOG: database system is shut down
It's not clear to me where the kill signal is coming from for when I run netstat -pln |grep 5432
this is the result returned
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN
17301/postgres
unix 2 [ ACC ] STREAM LISTENING 1258541 17301/postgres
/tmp/.s.PGSQL.5432
and its clear to me that the database is running or so I think.
I have configured Nginx and Gunicorn to start on boot using Supervisord and I'm looking to do the same for Postgresql.
I believe the error has something to do with the application not waiting for the database to start or if it does then it restarts the database as it should but I can't be too sure about it.
Any help with be highly appreciated.