Directory structure

Tentative directory structures are desbribed below for the Manager installations, and for the Agents.

Maybe we could merge both the Manager and Agent structure so all machines could run the CLI and Web Managers by definition.

Manager

The Manager directory structure contains the managers applications, the configuration, and all the deployables:

<MANAGER_HOME>
  +- bin                           : Grid executables
  | +- grid.sh                     : CLI Manager script (can also start/stop the Web Manager)
  | +- grid.bat                    : CLI Manager script (can also start/stop the Web Manager)
  | +- grid-<version>.jar          : CLI Manager library
  | +- grid-<version>.war          : Web Manager application
  +- conf                          : Configurations dir
  | +- grid.xml                    : Grid configuration file
  +- deployables                   : Contains installables and releases files
    +- agent                       : Agent package (installable)
    | +- agent-<version>.tgz       : Agent executables
    |   +- agent.sh                : Agent script
    |   +- agent.bat               : Agent script
    |   +- agent-<version>.jar     : Agent library
    +- layouts                     : Layouts (Tomcat installables) dir
    | +- tomcat-8.0.13.tgz         : A Tomcat layout (installable)
    | +- tomcat-8.0.13-core.tgz    : A Tomcat layout (installable)
    | +- tomcat-8.0.21-core.tgz    : A Tomcat layout (installable)
    +- libraries                   : Uploaded libraries (ready to install)
    | +- ojdbc6.jar                : A library
    | +- apache-activemq-4.1.0.jar : A library
    +- hooks                       : Stores all hooks scripts
    +- releases                    : Stores the releases
      +- <version-id1>             : A release version (autogenerated or specified)
      | +- <application1>          : A war application alias
      | | +- <app1-file>.war       : War application (file or dir)
      | +- <application2>          : A war application alias
      |   +- <app2-file>.war       : War application (file or dir)
      +- <version-id2>             : A release version (autogenerated or specified)
        +- <application1>          : A war application alias
        | +- <app1-file>.war       : War application (file or dir)
        +- <application2>          : A war application alias
          +- <app2-file>.war       : War application (file or dir)

Agent

The Agent directory structure contains the agent application, the grid and agent configurations, all deployables, and all the local Tomcat instances:

<AGENT_HOME>
  +- bin                           : Agent executables
  | +- agent.sh                    : Agent script
  | +- agent.bat                   : Agent script
  | +- agent-<version>.jar         : Agent library
  +- conf                          : Configurations dir
  | +- grid.xml                    : Grid configuration file
  | +- agent.xml                   : Agent data file (includes agent id, agent_home, etc.)
  +- deployables...                : Replicated copy of the "deployables" dir of the Manager
  +- instances                     : Contains all the local Tomcat instances
    +- <tomcat-1>                  : Tomcat installation for the instance
    +- <tomcat-2>                  : Tomcat installation for the instance
    +- <tomcat-N>                  : Tomcat installation for the instance

Configuration files

Two configuration files are envisioned. All extra configuration, such as libraries, installables, web applications, hooks, etc are referenced on the configuration file but are stored in the standard file system locations as described above.

Grid configuration file

The following example grid.xml configuration file, the main configuration file considers a Tomcat Grid with four instances in two machines:

  • terminus (machine):
    • tomcat101 (tomcat instance): runs the customer facing war.
    • tomcat102 (tomcat instance): runs the customer care war (lighter config).
  • anacreon (machine):
    • tomcat201 (tomcat instance): runs the customer facing war.
    • tomcat202 (tomcat instance): runs the customer care war (lighter config), and the backend war.

As an overview, the configuration file shown below includes all machines and all Tomcat instances for each one. Particularly each Tomcat instance specifies:

  • Its name.
  • The Tomcat layout (core Tomcat installable) to use.
  • All additions to the layout (libraries, drivers, etc.)
  • The full JVM profile (java options) to run the Tomcat instance.
  • The full Tomcat server profile (aka server.xml) to use.
  • All the web applications to deploy, including their context configurations, and virtual hosts.

This information covers all the aspects needed to run each instance.

Considering the profiles are usually shared between instances (the customer facing profiles are probably identical for all customer facing instances), they are defined only once. Each instance references them, so they can be easily tuned on a single place instead of being copied all over the place.

<?xml version="1.0"?>

<!DOCTYPE tomcat-grid SYSTEM "http://tomcat.apache.org/tomcat/grid/grid.dtd">

<tomcat-grid name="AMT Benefits" environment="prod"
  manager-port="6001">

  <layouts>
    <layout name="core" package="apache-tomcat-7.0.42-core.tar.gz" />
    <layout name="realms" package="apache-tomcat-7.0.42-realms.tar.gz" />
  </layouts>

  <libraries>
    <libraries name="Oracle 6 JDBC driver" package="ojdbc6.jar" />
    <libraries name="ActiveMQ 4.1 driver" package="apache-activemq-4.1.0-incubator.jar" />
  </libraries>

  <application-configurations>

    <application-configuration name="customer-facing">
    <![CDATA[
      <Context>
        <Manager pathname="" />
        <Parameter name="UPLOAD_SHARED_MOUNT_PATH" value="/shared/brdsmnt071/attachments"
          override="true" />
        <Parameter name="LOG_FILE"
          value="/shared/brdsmnt071/logs/${service.name}.log" override="true" />
        <Environment name="maxAttachmentSize" value="20000000"
          type="java.lang.Integer" override="false" />
        <Resource name="jdbc/customerDS" auth="Container"
          type="javax.sql.DataSource" maxActive="100" maxIdle="30"
          maxWait="10000" username="benefits" password="benefits"
          driverClassName="oracle.jdbc.driver.OracleDriver"
          url="jdbc:oracle:thin:@10.14.121.60:1521:MFUNDS4" />
      </Context>
      ]]>
    </application-configuration>

    <application-configuration name="customer-care">
      <![CDATA[
      <Context>
        <Manager pathname="" />
        <Parameter name="UPLOAD_SHARED_MOUNT_PATH" value="/shared/brdsmnt071/attachments"
          override="true" />
        <Parameter name="LOG_FILE"
          value="/shared/brdsmnt071/logs/${service.name}.log" override="true" />
        <Environment name="maxAttachmentSize" value="20000000"
          type="java.lang.Integer" override="false" />
        <Resource name="jdbc/customerDS" auth="Container"
          type="javax.sql.DataSource" maxActive="100" maxIdle="30"
          maxWait="10000" username="benefits" password="benefits"
          driverClassName="oracle.jdbc.driver.OracleDriver"
          url="jdbc:oracle:thin:@10.14.121.60:1521:MFUNDS4" />
      </Context>
      ]]>
    </application-configuration>

    <application-configuration name="backend">
      <![CDATA[
      <Context>
        <Manager pathname="" />
        <Parameter name="UPLOAD_SHARED_MOUNT_PATH" value="/shared/brdsmnt071/attachments"
          override="true" />
        <Environment name="maxAttachmentSize" value="20000000"
          type="java.lang.Integer" override="false" />
        <Resource name="jdbc/personnelDS" auth="Container"
          type="javax.sql.DataSource" maxActive="100" maxIdle="30"
          maxWait="10000" username="benefits" password="benefits"
          driverClassName="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@10.14.121.60:1521:MFUNDS4" />
        <Resource name="jms/extWiresQueue" auth="Container"
          type="org.apache.activemq.command.ActiveMQQueue" description="External Wires Queue"
          factory="org.apache.activemq.jndi.JNDIReferenceFactory"
          physicalName="EXTWIREQ" />
      </Context>
      ]]>
    </application-configuration>

  </application-configurations>

  <applications>

    <application name="site" package="benefits.war"
      standard-source="/work/dists/benefits.war">
    </application>

    <application name="backend" package="benefits-aide.war"
      standard-source="/work/dists/benefits-aide.war">
    </application>

  </applications>

  <java-profiles>

    <java-profile name="site-face">
      <![CDATA[
      -Xms1024m -Xmx2048m
      -XX:PermSize=192m -XX:MaxPermSize=256m
      -XX:+DisableExplicitGC
      -XX:+PrintGCDetails
      -XX:+PrintGCTimeStamps
      -XX:+HeapDumpOnOutOfMemoryError
      -Dsun.rmi.dgc.server.gcInterval=3600000
      -Dsun.lang.ClassLoader.allowArraySyntax=true
      -Djava.net.preferIPv4Stack=true
      -Dlog.file=$GRID_HOME/logs/${service.name}.log
      ]]>
    </java-profile>

    <java-profile name="internal">
      <![CDATA[
      -Xms512m -Xmx768m
      -XX:PermSize=128m -XX:MaxPermSize=192m
      -XX:+DisableExplicitGC
      -XX:+PrintGCDetails
      -XX:+PrintGCTimeStamps
      -XX:+HeapDumpOnOutOfMemoryError
      -Dsun.rmi.dgc.server.gcInterval=3600000
      -Dsun.lang.ClassLoader.allowArraySyntax=true
      -Djava.net.preferIPv4Stack=true
      -Dlog.file=$GRID_HOME/logs/${service.name}.log
      ]]>
    </java-profile>

    <java-profile name="processes">
      <![CDATA[
      -Xms1024m -Xmx1024m
      -XX:PermSize=128m -XX:MaxPermSize=192m
      -XX:+DisableExplicitGC
      -XX:+PrintGCDetails
      -XX:+PrintGCTimeStamps
      -XX:+HeapDumpOnOutOfMemoryError
      -Dsun.rmi.dgc.server.gcInterval=3600000
      -Dsun.lang.ClassLoader.allowArraySyntax=true
      -Djava.net.preferIPv4Stack=true
      -Dlog.file=$GRID_HOME/logs/${service.name}.log
      ]]>
    </java-profile>

  </java-profiles>

  <server-profiles>

    <server-profile name="web">
      <![CDATA[
      <Server port="${server.port}" shutdown="SHUTDOWN">
        <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
        <Listener className="org.apache.catalina.core.JasperListener" />
        <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
        <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
        <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
        <GlobalNamingResources>
          <Resource name="UserDatabase" auth="Container"
            type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved"
            factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
            pathname="conf/tomcat-users.xml" />
        </GlobalNamingResources>
        <Service name="Catalina">
          <Connector name="http" executor="tomcatThreadPool"
            port="${http.port}" protocol="HTTP/1.1" connectionTimeout="20000" />
          <Engine name="Catalina" defaultHost="localhost">
            <Realm className="org.apache.catalina.realm.LockOutRealm">
              <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
                resourceName="UserDatabase" />
            </Realm>
            <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
              <Valve className="org.apache.catalina.valves.AccessLogValve"
                directory="logs" prefix="${service.name}-localhost_access_log."
                suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" />
            </Host>
          </Engine>
        </Service>
      </Server>
      ]]>
    </server-profile>

    <server-profile name="auxiliary">
      <![CDATA[
      <Server port="${server.port}" shutdown="SHUTDOWN">
        <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
        <Listener className="org.apache.catalina.core.JasperListener" />
        <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
        <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
        <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
        <GlobalNamingResources>
          <Resource name="UserDatabase" auth="Container"
            type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved"
            factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
            pathname="conf/tomcat-users.xml" />
        </GlobalNamingResources>
        <Service name="Catalina">
          <Connector name="http" executor="tomcatThreadPool"
            port="${http.port}" protocol="HTTP/1.1" connectionTimeout="20000" />
          <Engine name="Catalina" defaultHost="localhost">
            <Realm className="org.apache.catalina.realm.LockOutRealm">
              <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
                resourceName="UserDatabase" />
            </Realm>
            <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
              <Valve className="org.apache.catalina.valves.AccessLogValve"
                directory="logs" prefix="${service.name}-localhost_access_log."
                suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" />
            </Host>
          </Engine>
        </Service>
      </Server>
      ]]>
    </server-profile>

  </server-profiles>

  <machines>

    <machine id="1" name="Box #1 - Terminus" host="10.208.14.91"
      agent-port="6060" reported-hostname="terminus">

      <tomcat name="tomcat101" layout="core">
        <addition library="Oracle 6 JDBC driver" />
        <deployment application="site" engine="Catalina"
          virtual-host="localhost" appBase="webapps" configuration="customer-facing" />
        <java-options profile="site-face" />
        <server-configuration profile="web">
          <parameter name="server.port" value="8005" />
          <parameter name="http.port" value="8080" />
        </server-configuration>
      </tomcat>

      <tomcat name="tomcat102" layout="core">
        <addition library="Oracle 6 JDBC driver" />
        <deployment application="site" engine="Catalina"
          virtual-host="localhost" appBase="webapps" configuration="customer-care" />
        <java-options profile="internal" />
        <server-configuration profile="web">
          <parameter name="server.port" value="8105" />
          <parameter name="http.port" value="8180" />
        </server-configuration>
      </tomcat>

    </machine>

    <machine id="2" name="Box #2 - Anacreon" host="10.208.14.92"
      agent-port="6060" reported-hostname="anacreon">

      <tomcat name="tomcat201" layout="core">
        <addition library="Oracle 6 JDBC driver" />
        <deployment application="site" engine="Catalina"
          virtual-host="localhost" appBase="webapps" configuration="customer-facing" />
        <java-options profile="site-face" />
        <server-configuration profile="web">
          <parameter name="server.port" value="8005" />
          <parameter name="http.port" value="8080" />
        </server-configuration>
      </tomcat>

      <tomcat name="tomcat202" layout="realms">
        <addition library="Oracle 6 JDBC driver" />
        <addition library="ActiveMQ 4.1 driver" />
        <deployment application="site" engine="Catalina"
          virtual-host="localhost" appBase="webapps" configuration="customer-care" />
        <deployment application="backend" engine="Catalina"
          virtual-host="localhost" appBase="webapps" configuration="backend" />
        <java-options profile="processes" />
        <server-configuration profile="auxiliary">
          <parameter name="server.port" value="8105" />
          <parameter name="http.port" value="8280" />
        </server-configuration>
      </tomcat>

    </machine>

  </machines>

</tomcat-grid>

Agent configuration file

The Agent configuration file contains minimal information needed to identify the local configuration from the general grid configuration file.

<?xml version="1.0"?>

<!DOCTYPE tomcat-grid-agent SYSTEM "http://tomcat.apache.org/tomcat/grid/agent.dtd">

<tomcat-grid-agent id="1">
</tomcat-grid-agent>
  • No labels