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

Enabling Your Project For Replication

Enabling your project for replication is a bit more involved than simply adding the right artifacts and tweaking the configuration.

The replication source distribution will be different from the replication target distribution in that they contain different components and configuration to fulfil their respective tasks. We will have to create different CMS web archives for the source and the target. You can choose to do this by creating separate modules for both, or, in the spirit of code reuse, work with maven profiles. We use the latter method in our exposition here.

 

Replication Source Distribution

The replication source is the cluster where CMS users log in and edit and publish documents, and where web masters work with the Channel Editor to change the way the site looks and behaves. It will contain the CMS application for editing documents, the Site application necessary for previewing and editing channels and templates, and a Hippo Repository backing both.

The following dependency is required to include the artifacts that contain the code for running a replication source in your CMS application:

        <dependency>
          <groupId>com.onehippo.cms7</groupId>
          <artifactId>hippo-addon-replication-source-dependencies</artifactId>
          <type>pom</type>
        </dependency>

Add this dependency to a profile called replication-source in the cms pom:

    <profile>
      <id>replication-source</id>
      <dependencies>
        <dependency>
          <groupId>com.onehippo.cms7</groupId>
          <artifactId>hippo-addon-replication-source-dependencies</artifactId>
          <type>pom</type>
        </dependency>
      </dependencies>
    </profile>

In order to build the source distribution, issue the following command sequence from the root of your project:

$ mvn clean install -Preplication-source
$ mvn clean install -Pdist

Replication Target Distribution

The replication target is the cluster that lives inside the DMZ and hosts the live web site. It will contain a CMS application for administrative purposes, the Site application for serving web pages.

The following dependency is required to include the artifacts that contain the code for running a replication target in your CMS application:

        <dependency>
          <groupId>com.onehippo.cms7</groupId>
          <artifactId>hippo-addon-replication-target-dependencies</artifactId>
          <type>pom</type>
        </dependency>

Add this dependency to a profile called replication-target in the cms pom:

    <profile>
      <id>replication-target</id>
      <dependencies>
        <dependency>
          <groupId>com.onehippo.cms7</groupId>
          <artifactId>hippo-addon-replication-target-dependencies</artifactId>
          <type>pom</type>
        </dependency>
      </dependencies>
    </profile> 

The replication source sends replication packages to the target over REST. The CMS web application on the target side must be able to receive such requests. Hippo Repository contains a Jaxrs framework and servlet for this purpose. Copy cms/src/main/webapp/WEB-INF/web.xml to cms/src/main/target-web.xml In the latter, add the following servlet definition:

  <servlet>
    <servlet-name>RepositoryJaxrsServlet</servlet-name>
    <servlet-class>org.onehippo.repository.jaxrs.RepositoryJaxrsServlet</servlet-class>
    <load-on-startup>6</load-on-startup>
  </servlet>

Make sure this servlet is loaded after the repository servlet.

Add the following servlet mapping for the RepositoryJaxrsServlet:

  <servlet-mapping>
    <servlet-name>RepositoryJaxrsServlet</servlet-name>
    <url-pattern>/ws/*</url-pattern>
  </servlet-mapping>

The web application archive for the target environment must contain this modified web.xml instead of the the default one. Configuring the maven war plugin for this purpose the replication-target profile then becomes:

    <profile>
      <id>replication-target</id>
      <dependencies>
        <dependency>
          <groupId>com.onehippo.cms7</groupId>
          <artifactId>hippo-addon-replication-target-dependencies</artifactId>
          <type>pom</type>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <configuration>
              <webXml>src/main/target-web.xml</webXml>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

In order to build the target distribution, issue the following command sequence from the root or your project:

$ mvn clean install -Preplication-target
$ mvn clean install -Pdist

.

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?