Install Application Server

The following instructions describe how to install and set up the Apache Tomcat application server for use by the Content Engine.

On your engine-host(s), while logged in as escenic:

  1. Download the latest Tomcat package from http://tomcat.apache.org/. If you are installing on more than one machine and have created the shared folders described in Create Shared File System, then it is a good idea to download these packages to the /mnt/download folder you created. Otherwise, download them to some temporary location of your choice.

  2. Change user to root and unpack the Tomcat package to /opt:

    $ su 
    # cd /opt
    # tar -zxvf /mnt/download/apache-tomcat-version-number.tar.gz

    where version-number is the version number of the package you have downloaded.

  3. Create a symbolic link from /opt/tomcat to the Tomcat folder, so that it will be easier to upgrade to new versions when necessary, and change the owner of the Tomcat folder to escenic.

    # ln -s /opt/apache-tomcat-version-number /opt/tomcat
    # chown -R escenic:escenic /opt/apache-tomcat-version-number
  4. Open Tomcat's configuration file file (/opt/tomcat/conf/catalina.properties) for editing and add the following characters:

    ,${catalina.home}/escenic/lib/*.jar

    to the end of the common.loader property setting.

  5. Download a JDBC driver for the database system you are using. For MySQL, the driver is called Connector/J and can be downloaded from http://dev.mysql.com/downloads/connector/.

  6. Change user back to escenic and install the driver by copying it to the /opt/tomcat/lib folder. If you downloaded the MySQL driver package to /mnt/download, then you can do this as follows:

    # su - escenic
    $ cd /tmp
    $ tar -zxvf /mnt/download/mysql-connector-java-version-number.tar.gz
    $ cp mysql-connector-java-version-number/mysql-connector-java-version-number-bin.jar /opt/tomcat/lib/
  7. Create the /opt/tomcat/escenic/lib folder you added to the common.loader path in step 4:

    $ mkdir -p /opt/tomcat/escenic/lib/
  8. Set up database pooling. For MySQL, you do this by opening /opt/tomcat/conf/context.xml for editing and inserting the following two resource definitions as children of the root Context element:

    <Resource 
      name="jdbc/ECE_READ_DS" 
      auth="Container"
      type="javax.sql.DataSource" 
      username="user" 
      password="password"
      driverClassName="com.mysql.jdbc.Driver"
      maxActive="30" 
      maxIdle="10"
      maxWait="5000"
      url="jdbc:mysql://database-host/db-name?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=UTF-8"
    />
                  
    <Resource
      name="jdbc/ECE_UPDATE_DS"
      auth="Container"
      type="javax.sql.DataSource"
      username="user"
      password="password"
      driverClassName="com.mysql.jdbc.Driver"
      maxActive="10"
      maxIdle="5"
      maxWait="5000"
      url="jdbc:mysql://database-host/db-name?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=UTF-8"
    />

    Replace database-host, db-name, user and password in the above definitions with the names you have defined earlier (see Install Database).

  9. Set up indexing by inserting the following elements in /opt/tomcat/conf/context.xml as children of the root Context element:

    <Environment
        name="escenic/indexer-webservice"
        value="http://indexer-web-service-host:8080/indexer-webservice/index/"
        type="java.lang.String"
        override="false"/>
    
    <Environment
        name="escenic/index-update-uri"
        value="http://localhost:8080/solr/update/"
        type="java.lang.String"
        override="false"/>
    
    <Environment
        name="escenic/solr-base-uri"
        value="http://localhost:8080/solr/"
        type="java.lang.String"
        override="false"/>
    
    <Environment
        name="escenic/head-tail-storage-file"
        value="/var/lib/escenic/head-tail.index"
        type="java.lang.String"
        override="false"/>
    
    <Environment
        name="escenic/failing-documents-storage-file"
        value="/var/lib/escenic/failures.index"
        type="java.lang.String"
        override="false"/>

    where indexer-web-service-host is the host name or IP address of the editorial-host on which the Content Engine's indexer web service is to run. If you are creating a single-host installation, then you can use the host name localhost.

  10. Open Tomcat's web.xml file (/opt/tomcat/conf/web.xml) for editing and insert links to the resources you have defined:

    <resource-ref>
      <description>Read link</description>
      <res-ref-name>jdbc/ECE_READ_DS</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
    </resource-ref>
       
    <resource-ref>
      <description>Update link</description>
      <res-ref-name>jdbc/ECE_UPDATE_DS</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
    </resource-ref>

    These elements must be inserted as children of the root web-app element: otherwise, position is irrelevant.

  11. Open /opt/tomcat/conf/server.xml for editing.

  12. Somewhere in this file you will find a Connector element that configures connections on port 8080. Make sure that this element contains a URIEncoding attribute, and that it is set to UTF-8. For example:

    <Connector port="8080" protocol="HTTP/1.1" 
         connectionTimeout="20000" 
         redirectPort="8443" 
         URIEncoding="UTF-8"/>

    This ensures that Content Engine search functionality works for non-Latin characters.