Red Hat Bugzilla – Bug 1021671
pre_start_nodejs-0.10 action_hook does not fire on app restart
Last modified: 2015-05-14 19:31:03 EDT
Description of problem:
When using the pre_start_nodejs-0.10 action_hook to set an environment variable (such as NODE_ENV), on a nodejs cartridge, the environment variable is correctly set when creating the application, when doing a git push, or when doing an rhc app stop/rhc app start, but, when you do an rhc app restart, the script is not fired and the environment variable does not fire. I'm not sure this is the intended result, as it makes no sense for that environment variable to disappear when you restart your application. This also occurs if you restart your application from the web console. I know that you can use the --env NODE_ENV=production when you create a gear from the command line, but this doesn't help when you use a web based quickstart.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Create nodejs application and create a pre_start_nodejs-0.10 action_hook that sets an environment variable
2. modify the code to show the environment variable on the screen when you go to the site you created
3. deploy the application
4. rhc app restart $appname, or restart from the web console
the environment variable will not be set after a restart
the environment variable should still exist (get re-set) when the app restarts, it should execute the pre_start_nodejs-0.10 action_hook since it is restarting the node server.
Restart is a different code path in some cartridges than stop/start. If you need pre_start called you can add a call to pre_start in pre_restart.