13.5.9. JBoss Environment Variables
JBoss environment variables are available for supported JBoss applications.
Environment Variable Name | Purpose |
---|---|
JAVA_OPTS | Controlled by the cartridge and used to specify additional arguments to the JVM where JBoss application will run. |
JAVA_OPTS_EXT | Appended to the JAVA_OPTS environment variable before the JVM is invoked, and used to provide additional options to the JVM without rewriting the JAVA_OPTS environment variable. This allows developers to better support their application users. |
DISABLE_OPENSHIFT_MANAGED_SERVER_CONFIG | Set to true and the standalone.xml file from the repository is ignored, as is the copy that was retained. |
JBoss environment variables are stored in the
/App_Name/.openshift/config/standalone.xml
file that is part of jbossas-7. The following example code shows the environment variables for a MySQL datasource connection URL in the form jdbc:mysql://SERVER_NAME:PORT/DATABASE_NAME:
<connection-url>jdbc:mysql://${env.OPENSHIFT_MYSQL_DB_HOST}:${env.OPENSHIFT_MYSQL_DB_PORT}/${env.OPENSHIFT_APP_NAME}</connection-url>
The environment variables can be saved on the server so that sensitive information is not repeatedly passed to the command line. The following instructions describe how to set environment variables on the server.
Procedure 13.4. To Set Environment Variables on the Server:
- Open the
App_Name/.openshift/config/standalone.xml
file. - Specify the required values for any of your environment variables, then save and close the file.
- Commit and push the changes to the server:
$
git commit -a -m "COMMIT MESSAGE"
$git push
Important
Sensitive information stored in environment variables is visible if you use the
rhc snapshot
commands.
Note
If you use the jboss-cli.sh tool or the JBoss Management Console to edit the
standalone.xml
file, it only edits the local gear's standalone.xml
file and not the repository one provided by your OpenShift cartridge template: App_Name/.openshift/config/standalone.xml
. Manual changes will be lost upon an application restart, and the last version of the repository standalone.xml
file will be used even if you remove the repository standalone.xml
file.
To make your jboss-cli.sh tool or JBoss Management Console changes persistent or to stop the application from using the repository
standalone.xml
file, set the DISABLE_OPENSHIFT_MANAGED_SERVER_CONFIG
environment variable to true
by running:
# rhc env set DISABLE_OPENSHIFT_MANAGED_SERVER_CONFIG=true -a App_Name