简体   繁体   中英

What happens precisely when hot deploying a node.js application on Openshift?

From the documentation I could find, I don't understand what precisely happens when a node.js application is hot deployed in Openshift.

Are the following assumptions correct?

  1. The existing node.js application is stopped.
  2. A new node.js application with the new pushed code is started.
  3. Whatever was in memory in the existing node.js application is not transferred to the new one.
  4. If these applications use a database (in other cartridge), this database is not restarted. The existing application closes its connection, and the new application creates a new one.
  5. Hence, hot deployments are not recommended if your need to run a database script required for your newly pushed node.js code.

I tried to find out a lot for documentation from some official source on hot deployment on openshift, but I dont see anything more than these lines anywhere,

I don't say I am really answering your question but here is something about the hot deployment approach, everyone must read this

It just creates a server which watches changes to your js files, Now, any time you modify js, the code will notice and replace the local js with the new code. Any existing requests will continue to use the old code, while any new incoming requests will use the new code. All without shutting down the server, bouncing any requests, prematurely killing any requests, or even relying on an intelligent load balancer.

I guess openshift does the same thing when hot deployment marker is enabled(I m not sure and this may not be the case). Now in this case, coming back to your question:

  1. The existing node.js application is stopped and a new node.js application with the new pushed code is started: NO

  2. If these applications use a database (in other cartridge), this database is not restarted. The existing application closes its connection, and the new application creates a new one: YES

I think the best way to answer this question is to go to the source .

The post_deploy control operation, used as part of the build lifecycle, (git commit), is what get's called.

Depending on how the cartridge is configured (if your using npm and if your using supervisor), the cartridge will behave differently. If NPM is used the cartridge restarts, if your not using supervisor, the cartridge restarts. Its only if you are NOT using NPM and supervisor is running, does the hot deployment feature, work as explained in the documentation .

Hot deploying your application enables your changes to take effect without restarting the application cartridge, thus increasing deployment speed and minimizing application downtime.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM