This article covers a Bloomreach Experience Manager version 11. There's an updated version available that covers our most recent release.

Create Separate Distributions for the Authoring and Delivery Applications

Introduction

Goal

Create separate distributions for the authoring and delivery application so they can be deployed in separate containers.

Background

Typically Hippo's authoring (cms) and delivery (site) applications are deployed together on the same application server. However there are use cases where deploying the authoring and delivery applications separately on different application servers is preferable. In these cases the delivery application is deployed without the authoring application, therefore it cannot access the repository hosted by the latter.

The solution is to create a Maven WAR module containing all the dependencies of the repository and deploy it together with the delivery application on those delivery-only servers. The repository WAR will provide for access from the delivery application to the underlying storage repository.

This page describes how to configure the repository module and create two separate distributions that can be deployed on different application servers as shown in the following diagram:

Create the Repository Module

To set up Hippo for deployment using a separate repository web application, follow the steps below.

Create a new Maven module in your project that will produce repository.war. Don't forget to add it to your primary POM's modules. Add the module under the default profile, together with the modules for the bootstrap, cms and site modules. 

A sample pom.xml for your new module could look like this:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <artifactId>myhippoproject</artifactId>
    <groupId>com.example</groupId>
    <version>1.0.0-SNAPSHOT</version>
  </parent>

  <name>Repository</name>
  <artifactId>repository</artifactId>
  <packaging>war</packaging>

  <dependencies>
    <dependency>
      <groupId>org.onehippo.cms7</groupId>
      <artifactId>hippo-package-app-dependencies</artifactId>
      <type>pom</type>
    </dependency>
  </dependencies>

  <build>
    <finalName>repository</finalName>
    <resources>
       <resource>
         <directory>src/main/webapp</directory>
         <filtering>false</filtering>
         <includes>
            <include>WEB-INF/web.xml</include>
         </includes>
       </resource>
     </resources>
  </build>

</project>
In case you create such a repository module, make sure it contains all the required dependencies. The above example only shows the default required dependencies, but you might need to think about custom derived functions, workflow, scheduler daemons, etc. 
For Hippo 10.0.x and 10.1.x you must include hippo-services-webfiles in the <dependencies> section as well:
​<dependency>
  <groupId>org.onehippo.cms7</groupId>
  <artifactId>hippo-services-webfiles</artifactId>
</dependency>

For Hippo 10.2.0 and higher, this is not needed any more.

Add web.xml under repository/src/main/webapp/WEB-INF with 1 entry, the RepositoryServlet

<web-app ....>
  ...

  <servlet>
    <servlet-name>Repository</servlet-name>
    <servlet-class>org.hippoecm.repository.RepositoryServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>Repository</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>

</web-app>

Create the CMS and Site Distributions

Create 2 new distribution XML files under src/main/assembly.

cms-distribution.xml

<assembly xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd" xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <id>cms-distribution</id>
  <formats>
    <format>tar.gz</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <files>
    <file>
      <source>cms/target/cms.war</source>
      <outputDirectory>/webapps</outputDirectory>
      <destName>cms.war</destName>
    </file>
    <file>
      <source>site/target/site.war</source>
      <outputDirectory>/webapps</outputDirectory>
      <destName>site.war</destName>
    </file>
  </files>
  <dependencySets>
    <dependencySet>
      <useProjectArtifact>false</useProjectArtifact>
      <outputDirectory>/common/lib</outputDirectory>
      <scope>provided</scope>
      <includes>
        <include>javax.jcr:jcr</include>
        <include>org.apache.geronimo.specs:geronimo-jta_1.1_spec</include>
        <include>javax.mail:mail</include>
      </includes>
    </dependencySet>
    <dependencySet>
      <useProjectArtifact>false</useProjectArtifact>
      <outputDirectory>/shared/lib</outputDirectory>
      <scope>provided</scope>
      <includes>
        <include>org.onehippo.cms7:hippo-cms7-commons</include>
        <include>org.onehippo.cms7:hippo-services</include>
        <include>org.onehippo.cms7:hippo-repository-api</include>
        <include>org.onehippo.cms7:hippo-repository-builtin</include>
        <include>org.slf4j:slf4j-api</include>
        <include>org.slf4j:jcl-over-slf4j</include>
        <include>org.slf4j:slf4j-log4j12</include>
        <include>log4j:log4j</include>
      </includes>
    </dependencySet>
  </dependencySets>
</assembly>

site-distribution.xml

<assembly xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd" xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <id>site-distribution</id>
  <formats>
    <format>tar.gz</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <files>
    <file>
      <source>repository/target/repository.war</source>
      <outputDirectory>/webapps</outputDirectory>
      <destName>repository.war</destName>
    </file>
    <file>
      <source>site/target/site.war</source>
      <outputDirectory>/webapps</outputDirectory>
      <destName>site.war</destName>
    </file>
  </files>
  <dependencySets>
    <dependencySet>
      <useProjectArtifact>false</useProjectArtifact>
      <outputDirectory>/common/lib</outputDirectory>
      <scope>provided</scope>
      <includes>
        <include>javax.jcr:jcr</include>        
        <include>org.apache.geronimo.specs:geronimo-jta_1.1_spec</include>
        <include>javax.mail:mail</include>
      </includes>
    </dependencySet>
    <dependencySet>
      <useProjectArtifact>false</useProjectArtifact>
      <outputDirectory>/shared/lib</outputDirectory>
      <scope>provided</scope>
      <includes>
        <include>org.onehippo.cms7:hippo-cms7-commons</include>
        <include>org.onehippo.cms7:hippo-services</include>
        <include>org.onehippo.cms7:hippo-repository-api</include>
        <include>org.onehippo.cms7:hippo-repository-builtin</include>
        <include>org.slf4j:slf4j-api</include>
        <include>org.slf4j:jcl-over-slf4j</include>
        <include>org.slf4j:slf4j-log4j12</include>
        <include>log4j:log4j</include>
      </includes>
    </dependencySet>
  </dependencySets>
</assembly>

Add a new profile for building those 2 distributions in your primary POM:

    <profile>
      <id>separate-dist</id>
      <dependencies>
        <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-log4j12</artifactId>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>jcl-over-slf4j</artifactId>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
          <scope>provided</scope>
        </dependency>
      </dependencies>
      <build>
        <defaultGoal>validate</defaultGoal>
        <plugins>
          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
              <execution>
                <id>site-assembly</id>
                <phase>validate</phase>
                <goals>
                  <goal>single</goal>
                </goals>
                <configuration>
                  <descriptors>
                    <descriptor>${project.basedir}/src/main/assembly/site-distribution.xml</descriptor>
                  </descriptors>
                </configuration>
              </execution>
              <execution>
                <id>cms-assembly</id>
                <phase>validate</phase>
                <goals>
                  <goal>single</goal>
                </goals>
                <configuration>
                  <descriptors>
                    <descriptor>${project.basedir}/src/main/assembly/cms-distribution.xml</descriptor>
                  </descriptors>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

That's it!

Build with Maven:

mvn clean verify

Then run:

mvn -Pseparate-dist

You'll get two tar.gz files containing the WARs you need. Deploy the cms and site wars to the first server, and the site and repository WARs to the second.

Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?