Configuring Dispatcher, Author and Publish Instance of Adobe Experience Manager (AEM)

29 / Mar / 2017 by Gunjan Lal 0 comments

A shorter time to market is critical to product companies. With the growth in competition, it is important to deliver a fast, secure and seamless application experience.  It is the usability of the application that will differentiate an organization from its competitors.

Adobe Experience Manager (or AEM), a component of the Adobe Marketing Cloud, is the leading enterprise content management platform for building websites and mobile applications along with managing digital assets and content. These applications need to be highly available and deployed over an easily scalable infrastructure.

Amazon Web Services (or AWS) provides a plethora of cloud services which can be used and integrated to build a complete solution architecture for such applications. AWS provides capabilities such as global capacity, security, reliability, fault tolerance, programmability, and usability.

An AEM instance is essentially a copy of the AEM jar running on a system on a specific port. These instances can be run on a single machine (using a different port for each instance) or various machines. This blog demonstrates the process of setting up AEM Author and AEM Publish instances, along with the Dispatcher on an AWS EC2 machine running on CentOS 7.

  • AEM Author: The Author instance is used to design, create and review the content which will be published on the application in the future. The instance is located inside the organization’s firewall under full protection of the internal network. It provides an easy GUI for the tasks and uses the port 4502 by default.
  • AEM Publish: The Publish instance is used to make the designed application available to the public and is located in a demilitarized zone. The default port used by the instance is 4503.
  • AEM Dispatcher: The Dispatcher is another instance used in AEM which handles instance security, load balancing, and caching from the Publish instance.

You need to ensure that the Apache HTTP Server and Java are running to set up AEM instances.

Install Apache

sudo yum update
sudo yum install httpd

Install Java

sudo yum install java-1.8.0-openjdk-devel

Outlined below are the steps to setup AEM instances:

- Dispatcher

The dispatcher instance is configured using a dispatcher module (dispatcher-apache<x.y>-<rel-nr>.so) and a configuration file (dispatcher.any)

    • Download the appropriate tar.gz from here
    • Untar and remove the original tar file:
       tar -xvf dispatcher-apache-xxx.tar.gz
      rm dispatcher-apache-xxx.tar.gz 
    • The directory structure is as follows:

- CHANGES

Changes comprise of issues resolved in each release

- Conf

These are configuration files for dispatcher

dispatcher-apache<x.y>-<rel-nr>.so : The Dispatcher shared object library file which will be added to the Apache web server

- README

README contains installation instructions

    • Make a softlink of the DSO file in the ‘modules’ directory of Apache
      ln -s /path/to/dispatcher/dispatcher-apache<x.y>-<rel-nr>.so /etc/httpd/modules/mod_dispatcher.so
    • Copy the dispatcher.any file to ‘conf’ folder of Apache
      cp dispatcher.any /etc/httpd/conf/dispatcher.any
    • Disable SELinux: SELinux (or Security Enhanced Linux), if enabled, may cause some errors while running Dispatcher.
      • Edit /etc/selinux/config:
        SELINUX=disabled
      • Run
/usr/sbin/setsebool httpd_can_network_connect true
    • Edit the configurations in /etc/httpd/conf/httpd.conf:
      • Load module: to load module on start-up
      • Add dispatcher configuration: Dispatcher-specific configuration entries
      • SetHandler: to activate the dispatcher
      • ModMimeUsePathInfo: to modify the behavior of mod_mime

Add the following lines:

Listen 80
Include conf.modules.d/*.conf
LoadModule dispatcher_module /etc/httpd/modules/mod_dispatcher.so
<IfModule disp_apache2.c>
 DispatcherConfig conf/dispatcher.any
 DispatcherLog logs/dispatcher.log
 DispatcherLogLevel 3
 DispatcherNoServerHeader 0
 DispatcherDeclineRoot 0
 DispatcherUseProcessedURL 0
 DispatcherPassError 0
 DispatcherKeepAliveTimeout 60
</IfModule>

<Directory />
 <IfModule disp_apache2.c>
 SetHandler dispatcher-handler
 </IfModule>
 Options FollowSymLinks
 AllowOverride None
</Directory>
<Directory />
 <IfModule disp_apache2.c>
 SetHandler dispatcher-handler
 ModMimeUsePathInfo On
 </IfModule>
 Options FollowSymLinks
 AllowOverride None
</Directory>

- Author and Publisher:

    • To set up AEM, the AEM Quickstart Jar (AEM_6.x_Quickstart.jar) and License file (license.properties) are required. These files are always placed together to run the Author or Publish instance.
    • Create directories for author and publisher
mkdir -p /opt/aem/author
mkdir -p /opt/aem/publish
    • Copy jar and license file and set appropriate names for jar files:

AEM author and publish instances are configured using run modes. For example, author instances use the author run mode and publish instances use the publish run mode.

These run instances can be configured through the naming of the jar file (cq5-<run mode>-p<port>.jar).

cp AEM_6.x_Quickstart.jar /opt/aem/author/cq5-author-p4502.jar
cp AEM_6.x_Quickstart.jar /opt/aem/publish/cq5-publish-p4503.jar
cp license.properties /opt/aem/author/license.properties
cp license.properties /opt/aem/publish/license.properties
    • Unpack jars:

The run mode of an AEM instance cannot be changed once it has been installed.

java -jar /opt/aem/author/cq5-author-p4502.jar -unpack
java -jar /opt/aem/publish/cq5-publish-p4503.jar -unpack

Unpacking of the jar files creates a folder named ‘crx-quickstart’ which contains the script to start/stop the AEM instance and logs.

    • Start the publish instance for the first time:
java -jar /opt/aem/publish/cq5-author-p4502.jar -r publish
    • Edit start script of the publish instance:

Every AEM instance is an author instance by default. To configure the publish instance, set the following properties in /opt/AEM/publish/crx-quickstart/bin/start:

CQ_PORT=4503
CQ_RUNMODE='publish'

Stop and restart the publish instance using the scripts in crx-quickstart/bin/.

Note: The start script can be used to define various configurations of the instance, such as java heap memory.

    • Edit /etc/httpd/conf/dispatcher.any
      • Add virtual hosts (URI and hostname requests which the dispatcher will accept)
      • Add the renderer (the server that provides the pages to be served, i.e., the publish instance).

Include the following:

/virtualhosts {
"*:80"
}
/renders {
/rend01 {
# Hostname or IP of the render
/hostname "127.0.0.1"
# Port of the render
/port "4503”
}
}

This configuration accepts all requests on port 80 and serves the pages provided by the publish instance on port 4503.

    • Start the author instance using the start script.
bash /opt/aem/author/crx-quickstart/bin/start

 

AEM Author login screen

AEM Author login screen

Starting Author and Publish instances

Starting author and publish instance

Stopping Author and Publish instances

Stopping Author and Publish instances

Check correct installation  of dispatcher in logs

Check correct installation of dispatcher in logs

You will be easily able to configure AEM by following the above steps on one or multiple AWS EC2 instances.

References:
1. Author and Publish
2. Dispatcher

FOUND THIS USEFUL? SHARE IT

Leave a comment -