paschmann / rasa-ui

Rasa UI is a frontend for the Rasa Framework
MIT License
960 stars 330 forks source link

Retry failed connections on startup #163

Closed beevelop closed 5 years ago

beevelop commented 5 years ago

Currently, if Rasa UI is started before its postgres DB (or if the DB gets rescheduled on a different node and the connection is lost in e.g. a Kubernetes cluster), Rasa UI might get stuck on a "connection failed" error. E.g.:

2019-02-15 10:28:21.822|rasa-ui|info|Postgres DB Connection Error: Error: connect ETIMEDOUT 100.64.121.193:5432;
2019-02-15 10:28:21.822|rasa-ui|info|Using connection string from: process.env.postgresserver;

The same seems to apply to connections to other components, at least during initialization:

2019-02-15 10:28:21.818|rasa-ui|info|Rasa Core Error: Error: connect ETIMEDOUT [...]:5005;
2019-02-15 10:28:21.818|rasa-ui|info|Using connection string from: process.env.rasacoreendpoint;
...
2019-02-15 10:28:21.819|rasa-ui|info|Rasa NLU Error: Error: connect ETIMEDOUT [...]:5000;
2019-02-15 10:28:21.819|rasa-ui|info|Using connection string from: process.env.rasanluendpoint;

Ideally, all such errors would be retried, to ensure Rasa UI can run on a k8s cluster.

yuxuan2015 commented 5 years ago

@beevelop you can try as follow

service postgresql stop
/etc/postgresql/11/main/postgresql.conf
change #listen_address='localhost' to listen_address='*'
change #password_encryption=md5 to password_encryption=md5

add host all all 0.0.0.0/0 md5 into /etc/postgresql/11/main/pg_hba.conf
service postgresql restart
beevelop commented 5 years ago

@yuxuan2015 It's not about restarting a Postgres database. It's about keeping Rasa UI running, if the database is rescheduled on a Kubernetes cluster.