(888) 685-3101 ext. 2

Introduction

Liferay’s out-of-the-box packaging provides a set of ready-made “bundles” which include a functional application server configured to work with the Liferay application. While these “bundles” do make it convenient for an individual to quickly start up a local Liferay instance for experimentation, they make assumptions that directly conflict with long-terms maintainability and scalability. As a result, XTIVIA has devised an alternative deployment structure for all Liferay installations; this deployment structure is designed to provide the following benefits: Scalability for local application server instances Isolation of the Liferay application server from the main operating system Standardization of application server instance layout, to aid in automation and maintenance

Definitions and Conventions

Liferay Root

The ${LIFERAY_ROOT} directory is the directory, drive, or mount point containing all Liferay-related applications, data, and operational files.

  • for Unix: /opt/liferay
  • for Windows: D:liferay

Liferay Home Directory

The ${liferay.home} directory corresponds to a Liferay instance’s local directory for storing/retrieving configuration information, operational files/directories, and some types of persistent data. The location of this directory is specified in the Liferay portal-ext.properties file, and it actually contains that very same file. The system property external-properties is specified as a JVM command-line option to specify the location of the portal-ext.properties file.

Solr Home Directory

The ${solr.solr.home} directory is the directory that contains the configuration and persisted search indexes used by a single instance of the Solr search engine.

Tomcat Directories

There are two directories which are important for an Apache Tomcat server; first, there is the ${CATALINA_HOME} directory, which should point to the location that contains the shared libraries, executables, and other assets used by all Tomcat instances on the server. This is basically the Tomcat “installation” directory. The second directory, ${CATALINA_BASE} is configured on a per-instance basis, and contains all of the instance configuration data, libraries, deployed web applications, work, temp, and log directories for a single Tomcat instance. Unlike ${CATALINA_HOME}, this directory is not shared between Tomcat instances.

Liferay Installation Structure

The overall directory structure of an example Liferay instance, running on Apache Tomcat with a local Apache Solr instance providing search functionality, is represented below.

${LIFERAY_ROOT}
|--- apache-tomcat-${TOMCAT_VERSION} - Apache Tomcat install directory
|--- instances
|  |--- liferay-01
|  |  |--- liferay-home - the first server’s ${liferay.home} value
|  |  |  |--- data - Liferay data dir (license, search indexes, etc)
|  |  |  |--- deploy - autodeploy directory
|  |  |  |--- logs - Liferay log file
|  |  |  --- portal-ext.properties - Liferay configuration
|  |  --- tomcat-home - the first server’s ${CATALINA_BASE} value
|  |     |--- bin - contains setenv.sh and tomcat-juli.jar
|  |     |--- conf - contains the server instance’s config (server.xml)
|  |     |--- lib - where shared libraries should be deployed.
|  |     |--- logs - instance logs
|  |     |--- temp
|  |     |--- webapps - instance webapps
|  |     |  --- ROOT - Liferay web application
|  |     --- work
|  |--- liferay-02 - Contents match liferay-01 if a second instance is needed
|  --- solr-01
|     |--- solr-home - the first Solr server’s solr.solr.home
|     --- tomcat-home - the first Solr server’s ${CATALINA_BASE} value
|--- java - symlink to the installed JDK directory
|--- jdk${JDK_VERSION} - the installed JDK
|--- tomcat symlink to the Apache Tomcat install directory
|--- zk-instances - Container directory for an Apache ZooKeeper instances
|  |--- zk-${ENVIRONMENT_NAME}-01
|  |  |--- zk-data - the first ZK instance's data dir
|  |  --- zoo.cfg - the first ZK instance's config file
|  --- zk-${ENVIRONMENT_NAME}-02
|     |--- zk-data - the second ZK instance's data dir
|     --- zoo.cfg - the second ZK instance's config file
|--- zookeeper - symlink to the Apache Zookeeper install directory
--- zookeeper-${ZK_VERSION} - Apache Zookeeper install directorya

The startup script for Tomcat should be modified to point ${CATALINA_HOME} to ${LIFERAY_ROOT}/tomcat and ${CATALINA_BASE} to the tomcat-home nested inside of the instance’s [liferay-*|solr-*] directory. The startup script for each ZooKeeper instance should reference the shared ${LIFERAY_ROOT}/zookeeper/bin directory for the zkStart.[sh|cmd] file, but each init script should reference its own instance’s zoo.cfg file.

Summary

Here at XTIVIA, we strongly believe in making certain that any production or production-like environments are easily extensible and scalable; to that end, we’ve standardized on the above structure for a standard Liferay/Tomcat/Solr environment. The organization as outlined is not restricted to only this application stack; it is presented as an example, as it’s the stack which is most likely to be familiar to individuals who have worked or are working with the Liferay Portal server. We’ve found that going with this structure vastly simplifies ongoing maintenance for each component in the stack; in addition, deployment automation and validation activities are streamlined, as all components in the stack benefit from standard locations for application data and runtime code.

Share This