GSMA-CPAS / BWRP

Blockchain Wholesale Roaming Project
Apache License 2.0
2 stars 0 forks source link

Startup dependency between webapp and webapp-db #54

Open jhoos70 opened 3 years ago

jhoos70 commented 3 years ago

The webapp and the webapp database are running within the same pod and therefore start together. The webapp does not wait for the database to become ready resulting in the "node setup.js" script to fail because the database connection cannot be established.

{"timestamp":"2021-06-29T11:04:26.928Z","level":"error","message":"[SessionManagementAdapter::onSetup] Error checking database - {\"errno\":\"ECONNREFUSED\",\"code\":\"ECONNREFUSED\",\"syscall\":\"connect\",\"address\":\"127.0.0.1\",\"port\":3306,\"fatal\":true} "} {"timestamp":"2021-06-29T11:04:26.932Z","level":"error","message":"[Setup] connect ECONNREFUSED 127.0.0.1:3306"}

A consistent dependency between these containers should be implemented.

jhoos70 commented 3 years ago

I can confirm that delaying the start of the webapp lets the container start successfully.

But I think delaying the container start for a hard configured time is not a good idea. As I don't see any straight forward solution on kubernetes level I would suggest to implement it in the javascript setup code. It should catch the connection error and try to reconnect for some time before it fails.