JBoss AS Environment Variables

The jbosseap cartridge provides several environment variables to reference for ease of use:

Variable Description

OPENSHIFT_JBOSSAS_IP

The IP address used to bind JBossAS

OPENSHIFT_JBOSSAS_HTTP_PORT

The JBossAS listening port

OPENSHIFT_JBOSSAS_CLUSTER_PORT

TODO

OPENSHIFT_JBOSSAS_MESSAGING_PORT

TODO

OPENSHIFT_JBOSSAS_MESSAGING_THROUGHPUT_PORT

TODO

OPENSHIFT_JBOSSAS_REMOTING_PORT

TODO

JAVA_OPTS_EXT

Appended to JAVA_OPTS prior to invoking the Java VM.

For more information, consult the Environment Variables guide.

Environment Variable Replacement Support

The jbossas cart provides special environment variable replacement functionality for some of the configuration files. For the following configuration files:

  • .openshift/config/standalone.xml

Ant-style environment replacements are supported for all OPENSHIFT_-prefixed environment variables in the application. For example, the following replacements are valid in standalone.xml:

<datasource jndi-name="java:jboss/datasources/MySQLDS" enabled="${mysql.enabled}" use-java-context="true" pool-name="MySQLDS" use-ccm="true">
  <connection-url>jdbc:mysql://${env.OPENSHIFT_MYSQL_DB_HOST}:${env.OPENSHIFT_MYSQL_DB_PORT}/${env.OPENSHIFT_APP_NAME}</connection-url>
  <driver>mysql</driver>
  <security>
    <user-name>${env.OPENSHIFT_MYSQL_DB_USERNAME}</user-name>
    <password>${env.OPENSHIFT_MYSQL_DB_PASSWORD}</password>
  </security>
  <validation>
    <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
    <background-validation>true</background-validation>
    <background-validation-millis>60000</background-validation-millis>
    <!--<validate-on-match>true</validate-on-match>-->
  </validation>
  <pool>
    <flush-strategy>IdleConnections</flush-strategy>
    <allow-multiple-users/>
  </pool>
</datasource>

During server startup, the configuration files in the source repository are processed to replace OPENSHIFT_* values, and the resulting processed file is copied to the live JBoss AS configuration directory.