Environment Variables

Environment variables are used to store the values of the frequently used parameters, that are provided to a software program at runtime. Setting and using such placeholders instead of specifying the required values in the application code each time they are needed, makes your application more portable and flexible. It brings even more convenience if these values may differ from one host to another.

Each Jelastic-managed software stack is provided with a number of default variables, which display all the significant container information to help developers with application hosting.

Jelastic PaaS also gives you the possibility to declare your own custom environment variables (user-defined parameters) by means of adding the needed values to a special configuration file and in such a way, keeping them out of the code. Inside this file, you can set placeholders for your folder names, usernames, passwords, hosts, IP addresses, etc instead of hardcoding their values to every file they are required in.

Default Environment Variables

Within variables Jelastic provides the data on the created stack. Most of them are just informational (marked within tables below) and do not have any actual effect on the container. For example, using the TOMCAT_VERSION variable you can compare versions of the running Tomcat server and the one required by your application (to ensure compatibility), but changing its value won’t upgrade your container.

There is a number of options available for all software stack templates:

VariableValue ExampleDescription
CLONE_ON_SCALEFALSEDefines if new nodes upon horizontal scaling should be clones of a layer master (true) or created from scratch (false)
DOCKER_EXPOSED_PORT7979,8009,8743,21,22,25,443,80,8080Specifies which ports will be opened via container firewall after environment creation
PATH/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binA default shell variable, with a list of paths to directories with executable programs (informational)
STACK_PATH/opt/tomcatStack home directory (informational)
STACK_USERtomcatName of the default user for the stack (informational)
STACK_VERSION9.0.5Version of the current template (informational)
MASTER_IP192.168.4.210Internal IP address of a master node within a layer (informational)
MASTER_ID162713Unique node  identifier of a master node within a layer (informational)
MASTER_HOSTnode162713A short hostname for a master node within a layer (informational)

Below, we’ve provided a list of the stack-specific environment variables:
  • Java
    • Tomcat & TomEE
      VariableValue ExampleDescription
      JAVA_HOME/usr/java/latest/A path to the directory with the Java compiler (informational)
      JAVA_OPTS_CONFFILE/opt/tomcat/conf/variables.confPath to the variables.conf file
      JAVA_VERSION1.8.0.161A version of the running Java engine (informational)
      JELASTIC_EXPOSE0Disables or enables the auto-redirect functionality with an ability to define required port manually
      TOMCAT_SHORT_VERSION9A major version of the running Tomcat server (informational)
      TOMCAT_VERSION9.0.5A minor version of the running Tomcat server (informational)
      VERT_SCALINGtrueDefines if the default Java GC agent should be enabled (true) or disabled (false)
      WEBROOT/opt/tomcat/webapps/Sets a path to the directory for  application deployment
    • GlassFish & Payara
      VariableValue ExampleDescription
      ADMIN_USERadminLogin of the admin user for the administration console (informational)
      DASfalseShows if there is a DAS node (required to configure cluster) for the current layer
      GMS_LISTENER_PORT9090Port to be used by the group management service (GMS) on nodes (informational)
      HAZELCAST_CONFIG/opt/glassfish/hazelcast.xmlSets a path to the hazelcast configuration file
      HOME_DIR/home/jelasticContainer home directory (informational)
      JAVA_OPTS_CONFFILE/opt/glassfish/glassfish/domains/domain1/config/variables.confPath to the variables.conf file
      JAVA_VERSION1.8.0.144A version of the running Java engine (informational)
      JELASTIC_PRIORITY_PORTS28080Sets a GlassFish HTTP listener port
      ON_ENV_INSTALLhttps://raw.githubusercontent.com/jelastic-jps/glassfish/master/addons/auto-cluster.jpsA script to be executed after environment creation
      PORT_4848_TCP_PORT4848Port for admin console (informational)
      PSWD_FILE/home/jelastic/.ssh/pwdfilePath to the file with the admin user password (informational)
      WEBROOT/opt/glassfish/glassfish/domains/domain1/applicationsSets a path to the directory for  application deployment
    • WildFly
      VariableValue ExampleDescription
      ADMIN_USERadminLogin of the admin user for the administration console (informational)
      HOME_DIR/home/jelasticContainer home directory (informational)
      JAVA_HOME/usr/java/latest/A path to the directory with the Java compiler (informational)
      JAVA_OPTS_CONFFILE/opt/wildfly/conf/variables.confPath to the variables.conf file
      JAVA_VERSION10A version of the running Java engine (informational)
      JBOSS_HOME/opt/wildflyStack home directory (informational)
      JELASTIC_EXPOSEFALSEDisables or enables the auto-redirect functionality with an ability to define required port manually
      JELASTIC_MEMORY_AUTOCONFIGtrueEnables or disables memory auto-configuration for WildFly
      LAUNCH_JBOSS_IN_BACKGROUNDtrueRuns an application server in the background mode
      ON_ENV_INSTALLhttps://raw.githubusercontent.com/jelastic-jps/wildfly/master/addons/auto-clustering/auto-cluster.jpsA script to be executed after environment creation
      VERT_SCALINGtrueDefines if the default Java GC agent should be enabled (true) or disabled (false)
      WILDFLY_VERSION12.0.0.FinalA version of the running WildFly server (informational)
    • Spring Boot
      VariableValue ExampleDescription
      HOME_DIR/home/jelasticContainer home directory (informational)
      JAVA_ARGSarg1 arg2Allows to pass some custom arguments to your application main function
      JAVA_HOME/usr/java/latest/A path to the directory with the Java compiler (informational)
      JAVA_OPTS_CONFFILE/home/jelastic/conf/variables.confPath to the variables.conf file
      JAVA_VERSION10.0.1A version of the running Java engine (informational)
      VERT_SCALINGtrueDefines if the default Java GC agent should be enabled (true) or disabled (false)
    • Java Engine
      VariableValue ExampleDescription
      HOME_DIR/home/jelasticContainer home directory (informational)
      JAVA_ARGSarg1Allows to pass some custom arguments to your application main function
      JAVA_HOME/usr/java/latest/Points to the directory where the Java runtime environment (JRE) is installed
      JAVA_OPTS_CONFFILE/home/jelastic/conf/variables.confPath to the variables.conf file
      JAVA_VERSION10.0.1A version of the running Java engine (informational)
  • PHP
    • Apache
      VariableValue ExampleDescription
      APACHE_VERSION2.4.6A version of the running Apache server (informational)
      PHP_VERSION7.2.1A version of the running PHP engine (informational)
      WEBROOT/var/www/webrootSets a path to the directory for  application deployment
    • NGINX
      VariableValue ExampleDescription
      NGINX_VERSION1.12.2A version of the running NGINX server (informational)
      PHP_VERSION7.2.1A version of the running PHP engine (informational)
      WEBROOT/var/www/webrootSets a path to the directory for  application deployment
  • Ruby
    • Apache
      VariableValue ExampleDescription
      MY_RUBY_HOME/usr/local/rvm/rubies/ruby-2.5.1The path to the directory where the ruby engine is located
      RUBY_VERSION2.5.1The version of Ruby engine installed in the container
      GEM_HOME/usr/local/rvm/gems/ruby-2.5.1Locations (there may be several) where gems can be found (should include GEM_PATH)
      GEM_PATH/usr/local/rvm/gems/ruby-2.5.1Location where gems will be installed (by default)
      IRBRC/usr/local/rvm/rubies/ruby-2.5.1/.irbrcPath to IRB configuration file
      APACHE_VERSION2.4.33The version of Apache used for running the Ruby application
    • NGINX
      VariableValue ExampleDescription
      MY_RUBY_HOME/usr/local/rvm/rubies/ruby-2.5.1The path to the directory where the ruby engine is located
      RUBY_VERSION2.5.1The version of Ruby engine installed in the container
      GEM_HOME/usr/local/rvm/gems/ruby-2.5.1Locations (there may be several) where gems can be found (should include GEM_PATH)
      GEM_PATH/usr/local/rvm/gems/ruby-2.5.1Location where gems will be installed (by default)
      IRBRC/usr/local/rvm/rubies/ruby-2.5.1/.irbrcPath to IRB configuration file
      NGINX_VERSION1.14.0The version of NGINX used for running the Ruby application
  • Node.js
    • NodeJS
      VariableValue ExampleDescription
      APP_FILEserver.jsThe main application file to be launched
      AUTO_OLD_HEAPTRUETurns on/off Jelastic memory autoconfiguration (sets maximum size of old heap based on the amount of memory on container)
      HOME_DIR/home/jelasticContainer home directory (informational)
      NODE_ENVdevelopmentSpecifies the environment in which an application is running (e.g. development, staging, production, testing, etc)
      NODE_OPTS--trace-warningsVariable for specifying the V8 runtime options
      NVM_DIRinformationalPath where NVM is installed
      PACKAGE_MANAGERnpmVariable which contains the name of the utility used for installing the javascript packages
      PROCESS_MANAGERnpmVariable for choosing the Node.js process manager (i.e. npm, pm2, forever, supervisor)
      PROCESS_MANAGER_FILE
      Path to the file which contains the start options for the process manager
      ROOT_DIR/home/jelastic/ROOTSets a path to the directory for application deployment
      STACK_NAMEnodejsName of the stack (informational)
      STACK_SHORT_VERSION6Major version of the current template (informational)
  • Go
    • Golang
      VariableValue ExampleDescription
      GO_RUN
      Sets a name of the executable binary file (if not specified, the deployment script will try to locate one based on the project name)
      GOPATH/home/jelastic/webappDefines the deployment folder
      GO_BUILD_OPTIONS-aOptions and flags which are used for application building
      GO_RUN_OPTIONS-execOptions and flags which are used to run application
      GO_VERSION1.10Version of Golang server used inside the container

      WEB_ROOT

      /home/jelastic/webappPath to the deployed application
  • Load Balancer
    • HAProxy
      VariableValue ExampleDescription
      HAPROXY_VERSION1.8.9Version of HAProxy balancer used inside the container
      TCP_BALANCINGTRUEEnables traffic proxying and balancing to TPC backends
    • NGINX
      VariableValue ExampleDescription
      NGINX_VERSION1.12.2002Version of NGINX load balancer used inside the container
  • Database
    • MySQL
      VariableValue ExampleDescription
      MYSQL_VERSION5.7.20A version of the running MySQL server (informational)
      ON_ENV_INSTALLhttps://raw.githubusercontent.com/jelastic-jps/mysql-cluster/master/addons/auto-clustering/auto-cluster.jpsA script to be executed after environment creation
    • MariaDB
      VariableValue ExampleDescription
      MARIADB_VERSION10.2.12A version of the running MariaDB server (informational)
    • PostgreSQL
      VariableValue ExampleDescription
      POSTGRES_VERSION10.4A version of the running PostgreSQL server (informational)
    • Redis
      VariableValue ExampleDescription
      REDIS_COMMANDERenabledDefines if the Redis Commander management tool should be enabled or disabled
      REDIS_SENTINELdisabledDefines if Redis Sentinel high-availability and monitoring tool should be enabled or disabled
      STACK_NAMEredisA name of the current stack (informational)
  • Other
    • Maven
      VariableValue ExampleDescription
      JAVA_HOME/usr/java/latestPoints to the directory where the Java runtime environment (JRE) is installed
      JAVA_OPTS_CONFFILE/opt/maven/conf/variables.confPath to the variables.conf file
      JAVA_VERSION1.8.0.171A version of the running Java engine (informational)
      MAVEN_OPTS-showversionThis variable contains parameters used to start up the JVM running Maven and can be used to supply additional global options to Maven
      MAVEN_RUN_ARGS-T2Allows to pass some custom arguments for the application build
      MVN_VER3.5.3Version of the current template (informational)
    • Memcached
      VariableValue ExampleDescription
      MEMCACHED_VERSION1.5.2008Version of the current template (informational)