Skip to content

erwbgy/puppet-tomcat

Repository files navigation

Unmaintained

I no longer use Puppet actively and this software has not been maintained for some time.

puppet-tomcat

Puppet module to install Apache Tomcat and run instances as Runit services under one or more users.

The recommended usage is to place the configuration in hiera and just:

include tomcat

Example hiera config:

tomcat::config:
  admin_user: 'admin'

tomcat::cpu_affinity: '0,1'

tomcat::files:
  lib/postgresql-9.2-1002.jdbc4.jar:
    source:   'puppet:https:///files/jdbc/postgresql-9.2-1002.jdbc4.jar'

tomcat::templates:
  conf/tomcat-users.xml:
    mode:     '0440'
    template: '/etc/puppet/templates/myapp/tomcat-users.xml.erb'

tomcat::group:     'tomcat'

tomcat::java_home: '/usr/java/jdk1.7.0_17'

tomcat::java_opts: '-XX:MaxPermSize=512m'

tomcat::jolokia_version: '1.1.1'

tomcat::min_mem:   '256m'
tomcat::max_mem:   '512m'

tomcat::version:   '7.0.37'

tomcat::instances:
  tomcat1:
    basedir:         '/apps/tomcat1'
    bind_address:    "%{ipaddress_eth0_1}"
    localhost:       '127.0.0.101'
    logdir:          '/apps/tomcat1/logs'
    jolokia:         'true'
    jolokia_address: %{ipaddress_eth0_1}
    jolokia_port:    '8190'
    config:
      admin_user:    'fbloggs'
    dependencies:
      - '/apps/activemq1/service/activemq'
  tomcat2:
    basedir:         '/apps/tomcat2'
    bind_address:    "%{ipaddress_eth0_2}"
    localhost:       '127.0.0.102'
    logdir:          '/apps/tomcat2/logs'
    config:
      admin_user:    'jbloggs'
    templates:
      conf/server.xml:
        mode:     '0440'
        template: '/etc/puppet/templates/myapp/tomcat-server.xml.erb'

tomcat parameters

basedir: The base installation directory. Default: '/opt/tomcat'

bind_address: The IP or hostname to bind listen ports to. Default: $fqdn

check_port: The port that the instance must be listening on (bound to bind_address) for it to be considered up. Default: '8080'

config: A hash of additional configuration variables that will be set when templates are processed.

dependencies: A list of Runit service directories whose services must be up before the Tomcat service is started.

cpu_affinity: Enable CPU affinity to be set to only run processes on specific CPU cores - for example '0,1' to only run processes on the first two cores.

files: A hash of configuration files to install - see below

filestore: The Puppet filestore location where the Tomcat tarball and Jolokia war file are downloaded from. Default: 'puppet:https:///files/tomcat'

gclog_enabled: Whether or not Garbage Collector logging is enabled. Default: 'false'

gclog_numfiles: The number of garbage collector log files to keep. Default: '5'

gclog_filesize: The maximum size of a garbage collector log file before it is rotated. Default: '100M'

group: The user''s primary group. Default: 'tomcat',

java_home: The base directory of the JDK installation to be used. Default: '/usr/java/latest'

java_opts: Additional java command-line options to pass to the startup script

jolokia: Whether or not to install the jolokia war file and configure a separate service to run it. Default: false

jolokia_address: The address that the jolokia HTTP service listens on. Default: 'localhost'

jolokia_cron: Whether or not to install cron jobs to run the Jolokia JMX monitoring scripts every minute writing to local log files. Default: 'true'

jolokia_port: The port that the jolokia HTTP service listens on. Default: '8190'

jolokia_version: The version of the jolokia war file to download and install. Default: '1.1.1'

localhost: The localhost address to bind listen ports to. Default: 'localhost'

logdir: The base log directory. Default: '/var/logs/tomcat'

min_mem: The minimum heap size allocated by the JVM. Default: 1024m

max_mem: The maximum heap size allocated by the JVM. Default: 2048m

mode: The permissions to create files with (eg. 0444).

remove_docs: Whether or not to remove the Tomcat docs under webapps. Default: true

remove_examples: Whether or not to remove the Tomcat examples under webapps. Default: true

templates: A hash of configuration templates to process and install - see below

ulimit_nofile: The maximum number of open file descriptors the java process is allowed. Default is '$(ulimit -H -n)' which sets the value to the hard limit in /etc/security/limits.conf (or equivalent) for the user.

version