sjacorg / bayanat

Open source data management solution for human rights documentation.
https://bayanat.org/
GNU Affero General Public License v3.0
21 stars 13 forks source link

Bayanat as systemd does not work anymore #11

Closed hapee closed 3 years ago

hapee commented 3 years ago

Describe the bug Bayanat start as a service and generates error: sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) could not translate host name "host" to address: No address associated with hostname May 07 10:34:27 bayanat uwsgi[333587]: (Background on this error at: http://sqlalche.me/e/14/e3q8) Leading to
[pid: 333587|app: 0|req: 6/24] 127.0.0.1 () {46 vars in 807 bytes} [Fri May 7 10:34:52 2021] GET /login?next=%2Fdashboard%2F => generated 0 bytes in 90 msecs (HTTP/1.0 500) 0 headers in 0 bytes (0 switches on core 1)

To Reproduce wget http://127.0.0.1:5000

-2021-05-07 10:34:27-- (try: 3) http://127.0.0.1:5000/login?next=%2Fdashboard%2F Connecting to 127.0.0.1:5000... connected. HTTP request sent, awaiting response... No data received. Retrying.

Logs Add log entries using journalctl -u bayanat.service (replace bayanat with the name of service you chose) of errors that appeared in the log when you experienced the issue. see above psycopg2.OperationalError: could not translate host name "host" to address: No address associated with hostname May 07 10:38:30 bayanat uwsgi[333587]: The above exception was the direct cause of the following exception:

hapee commented 3 years ago

The manual start does work so the quesiton is where should a host be set I think

sjacgit commented 3 years ago

This is likely to be a misconfiguration issue. SQLALCHEMY_DATABASE_URI needs to be set in ProdConfig class in enferno/settings.py or commented out to use the variable in the main Config class.

hapee commented 3 years ago

Correct, this line SQLALCHEMY_DATABASE_URI = 'postgresql://user:pass@host/db' ## Replace with correct values if needed, or postgresql:///db was not correct.