Configuring Externally Managed Services

Externally managed services are created, configured, and managed outside the Liferay Helm chart.

Database

Configuring an external database for Liferay in AWS is done through portal properties. You can reference environment variables to keep the values secret:

portalProperties: |
  jdbc.default.driverClassName=org.postgresql.Driver
  jdbc.default.password=${env.DATABASE_PASSWORD}
  jdbc.default.url=jdbc:${env.DATABASE_PROTOCOL}://${env.DATABASE_ENDPOINT}:${env.DATABASE_PORT}/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
  jdbc.default.username=${env.DATABASE_USERNAME}

Search Engine

You must provide an OSGi configuration file to configure the search engine. Here are the instructions to using Elasticsearch or OpenSearch.

Elasticsearch

To use Elasticsearch, add the necessary OSGi config file using the configMap property:

configmap:
  data:
    com.liferay.portal.search.elasticsearch7.configuration.ElasticsearchConfiguration.config: |
      authenticationEnabled=B"<...>"
      clusterName="<...>"
      httpSSLEnabled=B"<...>"
      indexNamePrefix="liferay-"
      networkHostAddresses=["$[env:SEARCH_PROTOCOL]://$[env:SEARCH_ENDPOINT]"]
      operationMode="REMOTE"
      password="$[env:SEARCH_PASSWORD]"
      username="$[env:SEARCH_USERNAME]"
customVolumeMounts:
  x-search:
  - mountPath: /opt/liferay/osgi/configs/com.liferay.portal.search.elasticsearch7.configuration.ElasticsearchConfiguration.config
    name: liferay-configmap
    subPath: com.liferay.portal.search.elasticsearch7.configuration.ElasticsearchConfiguration.config
Important

The syntax to reference environment variables in OSGi properties is different from the one used in portal properties.

OpenSearch

To use OpenSearch, add the necessary OSGi config file using the configMap property:

configmap:
  data:
    com.liferay.portal.search.opensearch2.configuration.OpenSearchConfiguration.config: |
      remoteClusterConnectionId="REMOTE"
    com.liferay.portal.search.opensearch2.configuration.OpenSearchConnectionConfiguration-REMOTE.config: |
      active=B"true"
      authenticationEnabled=B"true"
      connectionId="REMOTE"
      httpSSLEnabled=B"false"
      networkHostAddresses=["https://opensearch-cluster-master:9200"]
      password="OpenSearch1@"
      username="admin"
customVolumeMounts:
  x-opensearch:
  - mountPath: /opt/liferay/osgi/configs/com.liferay.portal.search.opensearch2.configuration.OpenSearchConfiguration.config
    name: liferay-configmap
    subPath: com.liferay.portal.search.opensearch2.configuration.OpenSearchConfiguration.config
  - mountPath: /opt/liferay/osgi/configs/com.liferay.portal.search.opensearch2.configuration.OpenSearchConnectionConfiguration-REMOTE.config
    name: liferay-configmap
    subPath: com.liferay.portal.search.opensearch2.configuration.OpenSearchConnectionConfiguration-REMOTE.config

Then, blacklist the Elasticsearch connector bundles in DXP using the dependencies:

dependencies:
  search:
    portalBundleDenyList:
    - com.liferay.portal.search.elasticsearch.cross.cluster.replication.impl
    - com.liferay.portal.search.elasticsearch.monitoring.web
    - com.liferay.portal.search.elasticsearch7.api
    - com.liferay.portal.search.elasticsearch7.impl
    - com.liferay.portal.search.learning.to.rank.api
    - com.liferay.portal.search.learning.to.rank.impl
    source: external

The Liferay DXP image does not contain the OpenSearch connector modules. To use these modules, you must build a new Liferay Docker image that includes them. For more information on creating Docker images, see Building Liferay Docker Images. For more information on specifying a Liferay Docker image to use in AWS, see Configuring Liferay in AWS.

File Storage

There are several file (a.k.a. object) storage connectors in Liferay. You can choose the storage solution with the dl.store.impl portal property. For example, to use S3 as the file store

portalProperties: |
  dl.store.impl=com.liferay.portal.store.s3.S3Store

The Liferay S3 File Storage connector requires an OSGi configuration file. You can add it using the configMap property:

configmap:
  data:
    com.liferay.portal.store.s3.configuration.S3StoreConfiguration.config: |
      accessKey="$[env:OBJECT_STORAGE_ACCESSKEY]"
      bucketName="objectstorage"
      connectionProtocol="$[env:OBJECT_STORAGE_PROTOCOL]"
      s3Endpoint="$[env:OBJECT_STORAGE_ENDPOINT]"
      s3PathStyle=B"true"
      s3Region="$[env:OBJECT_STORAGE_REGION]"
      s3StorageClass="STANDARD"
      secretKey="$[env:OBJECT_STORAGE_SECRETKEY]"
customVolumeMounts:
  x-object-storage-external:
  - mountPath: /opt/liferay/osgi/configs/com.liferay.portal.store.s3.configuration.S3StoreConfiguration.config
    name: liferay-configmap
    subPath: com.liferay.portal.store.s3.configuration.S3StoreConfiguration.config
Important

The syntax to reference environment variables in OSGi properties is different from the one used in portal properties.