I am running a JSF application on the JBoss EWS 2.0 cartridge in OpenShift, and the time has come to set the application to run in Production mode. To keep my application as portable as possible, I would like to do this by setting the faces.PROJECT_STAGE
environment variable.
First I tried using rhc set-env ...
or rhc env set ...
but it didn't like the "dot" in the variable name. So I created this environment variable:
rhc env set facesPROJECT_STAGE=Production -a myapp
and then SSH'ed into my OpenShift account to change the file facesPROJECT_STAGE
in .env/user_vars
to facesPROJECT_STAGE
. Running rhc env list -a myapp
then shows me:
faces.PROJECT_STAGE=Production
However when I restart my application, it doesn't pick up the faces.PROJECT_STAGE
environment variable. Doing a rhc app reload -a myapp
doesn't help either. If it makes any difference my application is currently not auto-scalable.
You need to use system properties instead of environment variables. Set the JAVA_OPTS_EXT
environment variable to -Dfaces.PROJECT_STAGE=Production -a myapp
like this:
export JAVA_OPTS_EXT=-Dfaces.PROJECT_STAGE=Production
... and you should be good to go. (You may need to do something else to get that value to stick for for all time for your process -- and processes launched in the future).