Haufe-Lexware / wicked.haufe.io

An API Management system based on Mashape Kong
http://wicked.haufe.io
Other
121 stars 37 forks source link

Reloading configuration still takes unnecessarily long #212

Closed DonMartin76 closed 5 years ago

DonMartin76 commented 5 years ago

On Kubernetes environments, the restarting of the wicked environment after a configuration reload still takes unnecessarily long, even after implementing #191.

The solution of this may lie in the Kubernetes configuration, and in the liveness and readiness probes. As shows on the wicked.box environment, restarts can be pretty quick (just 2-3 seconds usually).

Explore whether using either nodemon or pm2 can be a solution for the non-api containers. The api container will still need a full reload, as the git clone happens in the startup script of the container - at least currently.

DonMartin76 commented 5 years ago

This had a very simple and straightforward fix: Surround calling npm start with a forever.sh bash script, which just restarts the process. This makes Kubernetes usually not even detect that something has restarted.

The same thing could be applied to the api container as well - there is now a semaphore which checks whether a stopped node process is due to a deliberate reload, or not. If it is, the container is kept up, the git repo is recloned, and everything just restarts, without e.g. Kubernetes or docker agent interaction.

Will land in 1.0.0-rc.8.