Description of problem: Currently, we generally recommend that people use "hot_deploy" with nodejs. In some cases, a nodejs application with thousands of files in its modules directory can take several seconds (even 20 or 30 seconds) to start. When a new version of a scaled app is deployed, what we should be able to do is rotate through all of the app's nodejs gears and deploy / restart them in sequence. hot_deploy does not do this because it assumes a restart is unnecessary. If use_npm is enabled and hot_deploy is disabled, then we should have logic similar to the jboss cartridges' "ishttpup" to block until the app is ready, so that gear rotation can work. Ideally we would have some way to wait for apps to reload in hot_deploy mode as well, but this seems like it would be a complete rearchitecting of the scaled app code (and how would you know when the reload actually started, since it's dependent on supervisor's poll interval?) So this suggestion of disabling hot_deploy and using npm is the best I could come up with. Other solutions would also be welcome.
Andy, at minimum I can add 'ishttpup' check into the 'start' operation of the nodejs cartride that waits (60 seconds?) till the HTTP port is available. As you said, for hot_deploy that check will be noop as the supervisor process will keep serving the port 8080 all the time. To verify that the application was deployed (and all code changes are now loaded), you will have to have some 'health-check' mechanism that will tell you current GIT ref. However, I can't think of a simple way how to hijack this into the user application...
https://github.com/openshift/origin-server/pull/6143
Commit pushed to master at https://github.com/openshift/origin-server https://github.com/openshift/origin-server/commit/9f59ea95fc34af03c3aa990d726a9569353fd51f Bug 1221836 - Add check if the HTTP port is open for nodejs cartridge
Version: devenv_5545 Steps to Reproduce: 1. Login and create app rhc app-create -a nodejs nodejs-0.10 -s 2. Check markers directory cd .openshift/markers, thers is no use_npm, no hot_deploy included 3. Visit app's url 4. Touch the file use_npm touch use_npm 5. Modify index.html vi index.html 6. Push the change git add .;git commit -amp;git push 7. Visit app's url 8. Touch hot_deploy and remove use_npm touch hot_deploy && rm -rf use_npm 10. Modify index.html 11. Push the change git add .;git commit -amp;git push 12. Visit app's url Actual results: http appears to work quickly ,it's about 20s. Expected results: it should wait for http to be available.
QE cannot reproduce this bug on devenv_5545 with steps in comment #4(please ignore the Expected result part)
Can't reproduce this issue. Putting ON_QA
Verified on devenv-5563 app's url is available in less than 10s