Pull request Compare This branch is 129 commits ahead, 498 commits behind chef-boneyard:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Installs and configures the Tomcat, Java servlet engine and webserver.



  • CentOS, Red Hat, Fedora (OpenJDK)

The following Opscode cookbooks are dependencies:

  • java


  • prefix_dir - /usr/local/, /var/lib/, etc.


  • default.rb -- installs tomcat via debian package only on a debian based distribution. Otherwise installs via tomcat7_binary.rb
  • package.rb -- installs tomcat7 unless node['tomcat']['version'] set to 6. The package typically installs a system service.
  • ark.rb installs a vanilla tomcat and creates a service
  • base.rb installs the tomcat from the binary provided by tomcat.apache.org, will use version 7 unless node['tomcat']['version'] set to 6. No tomcat service is installed.

All of the default webapps such as "ROOT" and "manager" are removed in the tomcat::ark recipe


This recipe creates a vanilla tomcat installation based on the tarball of bytecode available from http://tomcat.apache.org and places it in ${prefix_dir}. Additionally, it configures a system v init script and creates the symlink

${prefix_dir}/tomcat/default -> ${prefix_dir}/tomcat/tomcat{6,7}


It creates an installation of tomcat to prefix_dir. It does very little besides that.

By default it uses the tomcat 7 by including tomcat7 recipe

This recipe is intended to be used together with the CATALINA_BASE method to install multiple tomcat instances that use the same set of tomcat installation files. This recipe does not add any services. It is intended to be used together with the tomcat lwrp.

${prefix_dir}/tomcat/tomcat{6,7}  # CATALINA_HOME

and creates a symlink to that directory

${prefix_dir}/tomcat/default -> ${prefix_dir}/tomcat/tomcat{6,7}




  • :install: install
  • :remove: remove the instance
  • :webapps: returns location of the webapps directory, typically for use with a deploy or maven lwrp (coming soon)

Attribute Parameters

  • http_port: port_num or true/false, default to true and 8080
  • ajp_port: port_num or true/false, default to true and 8009
  • shutdown_port: port_num or true/false, default to 8005
  • host_name: name for Host element, defaults to localhost
  • unpack_wars: defaults to true
  • auto_deploy: defaults to true
  • jvm_opts: Array of options for the JVM
  • jmx_opts: Array of JMX monitoring options
  • webapp_opts: Array of directives passed to a webapp
  • more_opts: crap that doesn't fit anywhere else
  • env: environment variables to export in init script
  • user: user to run the tomcat as

An exception will be thrown if one of the values specified by *_port is already in use by another tomcat lwrp

All *_OPTS attributes are combined into the environment variable JAVA_OPTS. Duplicate options are removed.


tomcat "pentaho" do
  http_port  false
  https_port "8443"
  version    "7"

To deploy a webapp to the new tomcat, you use a deploy resource or a maven resource (coming soon).


deploy "pentaho" do
deploy_root tomcat['pentaho']['webapps'] repository "github.com/bryanwb/pentaho.git" revision "1.0.2" restart_command tomcat['pentaho'] :restart end


License and Author

Author:: Bryan W. Berry (bryan.berry@gmail.com)

Copyright:: 2012, Bryan W. Berry

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at


Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.