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:

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

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.

   1 <?xml version="1.0"?>
   2 
   3 <!DOCTYPE tomcat-grid SYSTEM "http://tomcat.apache.org/tomcat/grid/grid.dtd">
   4 
   5 <tomcat-grid name="AMT Benefits" environment="prod"
   6   manager-port="6001">
   7 
   8   <layouts>
   9     <layout name="core" package="apache-tomcat-7.0.42-core.tar.gz" />
  10     <layout name="realms" package="apache-tomcat-7.0.42-realms.tar.gz" />
  11   </layouts>
  12 
  13   <libraries>
  14     <libraries name="Oracle 6 JDBC driver" package="ojdbc6.jar" />
  15     <libraries name="ActiveMQ 4.1 driver" package="apache-activemq-4.1.0-incubator.jar" />
  16   </libraries>
  17 
  18   <application-configurations>
  19 
  20     <application-configuration name="customer-facing">
  21     <![CDATA[
  22       <Context>
  23         <Manager pathname="" />
  24         <Parameter name="UPLOAD_SHARED_MOUNT_PATH" value="/shared/brdsmnt071/attachments"
  25           override="true" />
  26         <Parameter name="LOG_FILE"
  27           value="/shared/brdsmnt071/logs/${service.name}.log" override="true" />
  28         <Environment name="maxAttachmentSize" value="20000000"
  29           type="java.lang.Integer" override="false" />
  30         <Resource name="jdbc/customerDS" auth="Container"
  31           type="javax.sql.DataSource" maxActive="100" maxIdle="30"
  32           maxWait="10000" username="benefits" password="benefits"
  33           driverClassName="oracle.jdbc.driver.OracleDriver"
  34           url="jdbc:oracle:thin:@10.14.121.60:1521:MFUNDS4" />
  35       </Context>
  36       ]]>
  37     </application-configuration>
  38 
  39     <application-configuration name="customer-care">
  40       <![CDATA[
  41       <Context>
  42         <Manager pathname="" />
  43         <Parameter name="UPLOAD_SHARED_MOUNT_PATH" value="/shared/brdsmnt071/attachments"
  44           override="true" />
  45         <Parameter name="LOG_FILE"
  46           value="/shared/brdsmnt071/logs/${service.name}.log" override="true" />
  47         <Environment name="maxAttachmentSize" value="20000000"
  48           type="java.lang.Integer" override="false" />
  49         <Resource name="jdbc/customerDS" auth="Container"
  50           type="javax.sql.DataSource" maxActive="100" maxIdle="30"
  51           maxWait="10000" username="benefits" password="benefits"
  52           driverClassName="oracle.jdbc.driver.OracleDriver"
  53           url="jdbc:oracle:thin:@10.14.121.60:1521:MFUNDS4" />
  54       </Context>
  55       ]]>
  56     </application-configuration>
  57 
  58     <application-configuration name="backend">
  59       <![CDATA[
  60       <Context>
  61         <Manager pathname="" />
  62         <Parameter name="UPLOAD_SHARED_MOUNT_PATH" value="/shared/brdsmnt071/attachments"
  63           override="true" />
  64         <Environment name="maxAttachmentSize" value="20000000"
  65           type="java.lang.Integer" override="false" />
  66         <Resource name="jdbc/personnelDS" auth="Container"
  67           type="javax.sql.DataSource" maxActive="100" maxIdle="30"
  68           maxWait="10000" username="benefits" password="benefits"
  69           driverClassName="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@10.14.121.60:1521:MFUNDS4" />
  70         <Resource name="jms/extWiresQueue" auth="Container"
  71           type="org.apache.activemq.command.ActiveMQQueue" description="External Wires Queue"
  72           factory="org.apache.activemq.jndi.JNDIReferenceFactory"
  73           physicalName="EXTWIREQ" />
  74       </Context>
  75       ]]>
  76     </application-configuration>
  77 
  78   </application-configurations>
  79 
  80   <applications>
  81 
  82     <application name="site" package="benefits.war"
  83       standard-source="/work/dists/benefits.war">
  84     </application>
  85 
  86     <application name="backend" package="benefits-aide.war"
  87       standard-source="/work/dists/benefits-aide.war">
  88     </application>
  89 
  90   </applications>
  91 
  92   <java-profiles>
  93 
  94     <java-profile name="site-face">
  95       <![CDATA[
  96       -Xms1024m -Xmx2048m
  97       -XX:PermSize=192m -XX:MaxPermSize=256m
  98       -XX:+DisableExplicitGC
  99       -XX:+PrintGCDetails
 100       -XX:+PrintGCTimeStamps
 101       -XX:+HeapDumpOnOutOfMemoryError
 102       -Dsun.rmi.dgc.server.gcInterval=3600000
 103       -Dsun.lang.ClassLoader.allowArraySyntax=true
 104       -Djava.net.preferIPv4Stack=true
 105       -Dlog.file=$GRID_HOME/logs/${service.name}.log
 106       ]]>
 107     </java-profile>
 108 
 109     <java-profile name="internal">
 110       <![CDATA[
 111       -Xms512m -Xmx768m
 112       -XX:PermSize=128m -XX:MaxPermSize=192m
 113       -XX:+DisableExplicitGC
 114       -XX:+PrintGCDetails
 115       -XX:+PrintGCTimeStamps
 116       -XX:+HeapDumpOnOutOfMemoryError
 117       -Dsun.rmi.dgc.server.gcInterval=3600000
 118       -Dsun.lang.ClassLoader.allowArraySyntax=true
 119       -Djava.net.preferIPv4Stack=true
 120       -Dlog.file=$GRID_HOME/logs/${service.name}.log
 121       ]]>
 122     </java-profile>
 123 
 124     <java-profile name="processes">
 125       <![CDATA[
 126       -Xms1024m -Xmx1024m
 127       -XX:PermSize=128m -XX:MaxPermSize=192m
 128       -XX:+DisableExplicitGC
 129       -XX:+PrintGCDetails
 130       -XX:+PrintGCTimeStamps
 131       -XX:+HeapDumpOnOutOfMemoryError
 132       -Dsun.rmi.dgc.server.gcInterval=3600000
 133       -Dsun.lang.ClassLoader.allowArraySyntax=true
 134       -Djava.net.preferIPv4Stack=true
 135       -Dlog.file=$GRID_HOME/logs/${service.name}.log
 136       ]]>
 137     </java-profile>
 138 
 139   </java-profiles>
 140 
 141   <server-profiles>
 142 
 143     <server-profile name="web">
 144       <![CDATA[
 145       <Server port="${server.port}" shutdown="SHUTDOWN">
 146         <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
 147         <Listener className="org.apache.catalina.core.JasperListener" />
 148         <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
 149         <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
 150         <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
 151         <GlobalNamingResources>
 152           <Resource name="UserDatabase" auth="Container"
 153             type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved"
 154             factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
 155             pathname="conf/tomcat-users.xml" />
 156         </GlobalNamingResources>
 157         <Service name="Catalina">
 158           <Connector name="http" executor="tomcatThreadPool"
 159             port="${http.port}" protocol="HTTP/1.1" connectionTimeout="20000" />
 160           <Engine name="Catalina" defaultHost="localhost">
 161             <Realm className="org.apache.catalina.realm.LockOutRealm">
 162               <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
 163                 resourceName="UserDatabase" />
 164             </Realm>
 165             <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
 166               <Valve className="org.apache.catalina.valves.AccessLogValve"
 167                 directory="logs" prefix="${service.name}-localhost_access_log."
 168                 suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" />
 169             </Host>
 170           </Engine>
 171         </Service>
 172       </Server>
 173       ]]>
 174     </server-profile>
 175 
 176     <server-profile name="auxiliary">
 177       <![CDATA[
 178       <Server port="${server.port}" shutdown="SHUTDOWN">
 179         <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
 180         <Listener className="org.apache.catalina.core.JasperListener" />
 181         <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
 182         <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
 183         <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
 184         <GlobalNamingResources>
 185           <Resource name="UserDatabase" auth="Container"
 186             type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved"
 187             factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
 188             pathname="conf/tomcat-users.xml" />
 189         </GlobalNamingResources>
 190         <Service name="Catalina">
 191           <Connector name="http" executor="tomcatThreadPool"
 192             port="${http.port}" protocol="HTTP/1.1" connectionTimeout="20000" />
 193           <Engine name="Catalina" defaultHost="localhost">
 194             <Realm className="org.apache.catalina.realm.LockOutRealm">
 195               <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
 196                 resourceName="UserDatabase" />
 197             </Realm>
 198             <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
 199               <Valve className="org.apache.catalina.valves.AccessLogValve"
 200                 directory="logs" prefix="${service.name}-localhost_access_log."
 201                 suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" />
 202             </Host>
 203           </Engine>
 204         </Service>
 205       </Server>
 206       ]]>
 207     </server-profile>
 208 
 209   </server-profiles>
 210 
 211   <machines>
 212 
 213     <machine id="1" name="Box #1 - Terminus" host="10.208.14.91"
 214       agent-port="6060" reported-hostname="terminus">
 215 
 216       <tomcat name="tomcat101" layout="core">
 217         <addition library="Oracle 6 JDBC driver" />
 218         <deployment application="site" engine="Catalina"
 219           virtual-host="localhost" appBase="webapps" configuration="customer-facing" />
 220         <java-options profile="site-face" />
 221         <server-configuration profile="web">
 222           <parameter name="server.port" value="8005" />
 223           <parameter name="http.port" value="8080" />
 224         </server-configuration>
 225       </tomcat>
 226 
 227       <tomcat name="tomcat102" layout="core">
 228         <addition library="Oracle 6 JDBC driver" />
 229         <deployment application="site" engine="Catalina"
 230           virtual-host="localhost" appBase="webapps" configuration="customer-care" />
 231         <java-options profile="internal" />
 232         <server-configuration profile="web">
 233           <parameter name="server.port" value="8105" />
 234           <parameter name="http.port" value="8180" />
 235         </server-configuration>
 236       </tomcat>
 237 
 238     </machine>
 239 
 240     <machine id="2" name="Box #2 - Anacreon" host="10.208.14.92"
 241       agent-port="6060" reported-hostname="anacreon">
 242 
 243       <tomcat name="tomcat201" layout="core">
 244         <addition library="Oracle 6 JDBC driver" />
 245         <deployment application="site" engine="Catalina"
 246           virtual-host="localhost" appBase="webapps" configuration="customer-facing" />
 247         <java-options profile="site-face" />
 248         <server-configuration profile="web">
 249           <parameter name="server.port" value="8005" />
 250           <parameter name="http.port" value="8080" />
 251         </server-configuration>
 252       </tomcat>
 253 
 254       <tomcat name="tomcat202" layout="realms">
 255         <addition library="Oracle 6 JDBC driver" />
 256         <addition library="ActiveMQ 4.1 driver" />
 257         <deployment application="site" engine="Catalina"
 258           virtual-host="localhost" appBase="webapps" configuration="customer-care" />
 259         <deployment application="backend" engine="Catalina"
 260           virtual-host="localhost" appBase="webapps" configuration="backend" />
 261         <java-options profile="processes" />
 262         <server-configuration profile="auxiliary">
 263           <parameter name="server.port" value="8105" />
 264           <parameter name="http.port" value="8280" />
 265         </server-configuration>
 266       </tomcat>
 267 
 268     </machine>
 269 
 270   </machines>
 271 
 272 </tomcat-grid>

Agent configuration file

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

   1 <?xml version="1.0"?>
   2 
   3 <!DOCTYPE tomcat-grid-agent SYSTEM "http://tomcat.apache.org/tomcat/grid/agent.dtd">
   4 
   5 <tomcat-grid-agent id="1">
   6 </tomcat-grid-agent>

TomcatGridDesign (last edited 2015-06-21 16:24:28 by theimpaler)