Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-72541

Support reading configuration properties from O.S. environment

    Details

      Description

      This ability will allow deploying Liferay portal in cloud-native environments in an easier way, delegating portal configuration to the underlying system, whether it is a physical machine, a virtual machine, or a container.

      First, Liferay will initialize Configuration with portal properties (and extensions), which is the default Liferay approach for properties. Then, if there is an environment variable representing Liferay properties, then the environment variable values will be used to override properties.

      Dynamic environments

      As the value is read during Configuration initialization, future changes in the env variables values will take no effect on the configuration. A newly created environment (i.e. container) defines its runtime configuration, so if a single variable is changed later on, it means that the environment is completely different.

      Clustering

      Each cluster node will define its own env variables, so this cloud-native approach does not affect to the cluster. Besides, module configurations will be replicated using the current clustering replication process.

      Env Vars declaration

      This section describes how Liferay will read environment variables: (These rules only apply to env var names, not values. Values are allowed to literally put in all values that are allowed by the OS)

      1. env vars names must be defined in uppercase letters, digits and '_'(underline). And do not begin with a digit. (This is a general OS rule, not by Liferay)
      2. env vars names are converted to lower case before being used to override configuration property.
      3. env vars names representing Liferay Portal properties must start with the prefix "LIFERAY_".
      4. disallowed chars must be encoded to obey rule 1 and 2. There are 2 ways of encoding:

      For examples:

      1. For CharPool way:
        • "AMPERSAND" represents '&'.
        • "BACKSLASH" represents '
          ', see the constant name is "BACK_SLASH" and the middle '_' is removed.
        • "UPPERCASEA" represents 'A', due rule 2, upper case property key must be encoded, otherwise they will be converted to lower case. And see the constant name is "UPPER_CASE_A" and the 2 middle '_' are removed.
      2. For uncode code point way:
        • "75" represents 'K'
        • "58" represents ':'

      Env Vars examples

      liferay.home=/liferay
      setup.wizard.enabled=false
      index.on.startup=false
      setup.database.driverClassName[db2]=com.ibm.db2.jcc.DB2Driver
      setup.database.jar.name[com.mysql.jdbc.Driver]=mysql.jar
      layout.static.portlets.start.column-1[user][/home]=6
      

      will be represented by:

      export LIFERAY_LIFERAY_PERIOD_HOME=/liferay
      export LIFERAY_SETUP_PERIOD_WIZARD_PERIOD_ENABLED=true
      export LIFERAY_INDEX_PERIOD_ON_PERIOD_STARTUP=false
      export LIFERAY_SETUP_PERIOD_DATABASE_PERIOD_DRIVER_UPPERCASEC_LASS_UPPERCASEN_AME_OPENBRACKET_DB2_CLOSEBRACKET_=com.ibm.db2.jcc.DB2Driver
      export LIFERAY_SETUP_PERIOD_DATABASE_PERIOD_JAR_PERIOD_NAME_OPENBRACKET_COM_PERIOD_MYSQL_PERIOD_JDBC_PERIOD__UPPERCASED_RIVER_CLOSEBRACKET_=mysql.jar
      export LIFERAY_LAYOUT_PERIOD_STATIC_PERIOD_PORTLETS_PERIOD_START_PERIOD_COLUMN_DASH_1_OPENBRACKET_USER_CLOSEBRACKET__OPENBRACKET__SLASH_HOME_CLOSEBRACKET_=6
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Packages

                  Version Package
                  7.0.0 DXP FP24
                  7.0.X EE
                  7.0.4 CE GA5
                  Master