Skip to content
This repository has been archived by the owner on Jul 24, 2018. It is now read-only.

Commit

Permalink
v0.4.0
Browse files Browse the repository at this point in the history
* Support installation from archive
* Use `nanliu/staging` instead of `nanliu/archive` to download and
extract files
* Improved systemd support
* `create_default_admin` defaults to `false`
* Numerous improvements in code and documentation
  • Loading branch information
antoineco committed Dec 18, 2014
1 parent c23e3f6 commit 5c4ab7a
Show file tree
Hide file tree
Showing 17 changed files with 479 additions and 227 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
###0.4.0

* Support installation from archive
* Use `nanliu/staging` instead of `nanliu/archive` to download and extract files
* Improved systemd support
* `create_default_admin` defaults to `false`
* Numerous improvements in code and documentation

###0.3.2

New parameter `manage_firewall`
Expand Down
36 changes: 23 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Use a non-default JVM and run it with custom options
```puppet
class { '::tomcat':
java_home => '/usr/java/jre1.7.0_65',
java_opts => '-server -Xmx2048m -Xms256m -XX:+UseConcMarkSweepGC'
java_opts => ['-server', '-Xmx2048m', '-Xms256m', '-XX:+UseConcMarkSweepGC']
}
```

Expand Down Expand Up @@ -88,7 +88,7 @@ class { '::tomcat':
jmx_listener => true,
jmx_registry_port => '8050',
jmx_server_port => '8051',
catalina_opts => '-Dcom.sun.management.jmxremote'
catalina_opts => ['-Dcom.sun.management.jmxremote', '-Dcom.sun.management.jmxremote.ssl=false', '-Dcom.sun.management.jmxremote.authenticate=false']
}
```

Expand Down Expand Up @@ -132,7 +132,7 @@ tomcat::instance { 'instance1':
http_port => 8080,
ajp_connector => false,
java_home => '/usr/java/jre1.7.0_65',
java_opts => '-server -Xmx2048m -Xms256m -XX:+UseConcMarkSweepGC',
java_opts => ['-server', '-Xms256m', '-Xmx2048m', '-XX:+UseConcMarkSweepGC'],
}
tomcat::instance { 'instance2':
control_port => 8006,
Expand Down Expand Up @@ -160,10 +160,12 @@ Primary class and entry point of the module

#####`version`
Tomcat full version number. The valid format is 'x.y.z'. Default depends on the distribution.
*Note:* if you define it manually please make **sure** this version if available in your system's repositories, since many parameters depend on this version number
*Note:* if you install tomcat from package and define this value manually, please make **sure** this version of tomcat if available in your system's repositories, since several sub-parameters depend on it
A list of available versions in each supported distribution is present withing the `params` class.
#####`archive_source`
Source of the tomcat server archive, if installed from archive. Defaults to `http://archive.apache.org/dist/tomcat/tomcat-${maj_version}/v${version}/bin/apache-tomcat-${version}.tar.gz`
#####`package_name`
Tomcat package name. Default depends on the distribution.
Tomcat package name. Ignored if installed from archive. Default depends on the distribution.
#####`tomcat_native`
Whether to install the Tomcat Native library. Boolean value. Defaults to `false`.
#####`tomcat_native_package_name`
Expand All @@ -181,24 +183,30 @@ Create a tomcat instance

**Parameters within `tomcat::instance`:**

#####`root_path`
Absolute path to the root of all tomcat instances. Defaults to `/opt/tomcat_instances`.
*Note:* the instance will be installed in `${root_path}/${title}` and $CATALINA_BASE will be set to that folder.

See also [Common parameters](#common-parameters)
No instance-specific parameters. See [Common parameters](#common-parameters)

####Common parameters

Common parameters to `tomcat` and `tomcat::instance`
Parameters common to both `tomcat` and `tomcat::instance`

**Packages and service**

#####`root_path`
Absolute path to the root of all tomcat instances. This parameter is ignored in the global context, unless tomcat was installed from archive. Defaults to `/opt` (global) / `/opt/tomcat_instances` (instance).
*Notes:*
* main instance will be installed in `${root_path}/tomcat-${version}` (if installed from archive) and both $CATALINA_HOME and $CATALINA_BASE will be set to that folder
* other instances will be installed in `${root_path}/${title}` (in all cases) and $CATALINA_BASE will be set to that folder

#####`service_name`
Tomcat service name. Defaults to `package_name` (global) / `${package_name}_${title}` (instance).
#####`service_ensure`
Whether the service should be running. Valid values are `stopped` and `running`. Defaults to `running`.
#####`service_enable`
Whether to enable the tomcat service. Boolean value. Defaults to `true`.
#####`service_start`
Optional override command for starting the service. Default depends on the platform.
#####`service_stop`
Optional override command for stopping the service. Default depends on the platform.
#####`enable_extras`
Whether to install tomcat extra libraries. Boolean value. Defaults to `false`.
*Warning:* enabled globally if defined within the global context
Expand All @@ -208,11 +216,11 @@ Whether to automatically manage firewall rules. Boolean value. Defaults to `fals
**Security and administration**

#####`admin_webapps`
Whether to install admin webapps (manager/host-manager). Boolean value. Defaults to `true`.
Whether to enable admin webapps (manager/host-manager). This will also install the required packages if tomcat was installed from package. This parameter is ignored if tomcat was installed from archive, since tomcat archives always contain these apps. Boolean value. Defaults to `true`.
#####`admin_webapps_package_name`
Admin webapps package name. Default depends on the distribution.
#####`create_default_admin`
Whether to create default admin user (roles: 'manager-gui', 'manager-script', 'admin-gui' and 'admin-script'). Boolean value. Defaults to `true`.
Whether to create default admin user (roles: 'manager-gui', 'manager-script', 'admin-gui' and 'admin-script'). Boolean value. Defaults to `false`.
#####`admin_user`
Admin user name. Defaults to `tomcatadmin`.
#####`admin_password`
Expand Down Expand Up @@ -328,5 +336,7 @@ User roles (array of strings)
##To Do

* Support SuSE Linux
* Proper startup script for distributions which do not have systemd
* Parameters validation

Features request and contributions are always welcome!
8 changes: 7 additions & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
file { 'tomcat server configuration':
path => "${::tomcat::catalina_base_real}/conf/server.xml",
content => template("${module_name}/common/server.xml.erb"),
owner => $::tomcat::tomcat_user_real,
group => $::tomcat::tomcat_group_real,
mode => '0600',
notify => Service[$::tomcat::service_name_real]
}

Expand All @@ -24,6 +27,9 @@
'tomcat environment variables':
path => $::tomcat::config_path_real,
content => template("${module_name}/common/setenv.erb"),
owner => $::tomcat::tomcat_user_real,
group => $::tomcat::tomcat_group_real,
mode => '0644',
notify => Service[$::tomcat::service_name_real]
}

Expand All @@ -39,7 +45,7 @@
path => "${::tomcat::catalina_base_real}/conf/tomcat-users.xml",
owner => $::tomcat::tomcat_user_real,
group => $::tomcat::tomcat_group_real,
mode => '0640',
mode => '0600',
notify => Service[$::tomcat::service_name_real]
}

Expand Down
46 changes: 20 additions & 26 deletions manifests/extras.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,36 @@
fail('You must include the tomcat base class before using any tomcat sub class')
}

Archive {
cleanup => false,
Staging::File {
require => File['global extras directory'],
notify => Service[$::tomcat::service_name_real]
}

archive {
staging::file {
'catalina-jmx-remote.jar':
path => "${::tomcat::catalina_home_real}/lib/extras/catalina-jmx-remote-${::tomcat::version}.jar",
target => "${::tomcat::catalina_home_real}/lib/extras/catalina-jmx-remote-${::tomcat::version}.jar",
source => "http://archive.apache.org/dist/tomcat/tomcat-${::tomcat::maj_version}/v${::tomcat::version}/bin/extras/catalina-jmx-remote.jar"
;

'catalina-ws.jar':
path => "${::tomcat::catalina_home_real}/lib/extras/catalina-ws-${::tomcat::version}.jar",
target => "${::tomcat::catalina_home_real}/lib/extras/catalina-ws-${::tomcat::version}.jar",
source => "http://archive.apache.org/dist/tomcat/tomcat-${::tomcat::maj_version}/v${::tomcat::version}/bin/extras/catalina-ws.jar"
;

'tomcat-juli-adapters.jar':
path => "${::tomcat::catalina_home_real}/lib/extras/tomcat-juli-adapters-${::tomcat::version}.jar",
target => "${::tomcat::catalina_home_real}/lib/extras/tomcat-juli-adapters-${::tomcat::version}.jar",
source => "http://archive.apache.org/dist/tomcat/tomcat-${::tomcat::maj_version}/v${::tomcat::version}/bin/extras/tomcat-juli-adapters.jar"
;

'tomcat-juli-extras.jar':
path => "${::tomcat::catalina_home_real}/lib/extras/tomcat-juli-extras-${::tomcat::version}.jar",
target => "${::tomcat::catalina_home_real}/lib/extras/tomcat-juli-extras-${::tomcat::version}.jar",
source => "http://archive.apache.org/dist/tomcat/tomcat-${::tomcat::maj_version}/v${::tomcat::version}/bin/extras/tomcat-juli.jar"
}

file {
'global extras directory':
ensure => directory,
path => "${::tomcat::catalina_home_real}/lib/extras",
seltype => 'usr_t';
ensure => directory,
path => "${::tomcat::catalina_home_real}/lib/extras";

'tomcat-juli.jar':
ensure => link,
Expand All @@ -46,27 +44,23 @@
backup => true;

'catalina-jmx-remote.jar':
ensure => link,
path => "${::tomcat::catalina_home_real}/lib/catalina-jmx-remote.jar",
target => "extras/catalina-jmx-remote-${::tomcat::version}.jar",
seltype => 'usr_t';
ensure => link,
path => "${::tomcat::catalina_home_real}/lib/catalina-jmx-remote.jar",
target => "extras/catalina-jmx-remote-${::tomcat::version}.jar";

'catalina-ws.jar':
ensure => link,
path => "${::tomcat::catalina_home_real}/lib/catalina-ws.jar",
target => "extras/catalina-ws-${::tomcat::version}.jar",
seltype => 'usr_t';
ensure => link,
path => "${::tomcat::catalina_home_real}/lib/catalina-ws.jar",
target => "extras/catalina-ws-${::tomcat::version}.jar";

'tomcat-juli-adapters.jar':
ensure => link,
path => "${::tomcat::catalina_home_real}/lib/tomcat-juli-adapters.jar",
target => "extras/tomcat-juli-adapters-${::tomcat::version}.jar",
seltype => 'usr_t';
ensure => link,
path => "${::tomcat::catalina_home_real}/lib/tomcat-juli-adapters.jar",
target => "extras/tomcat-juli-adapters-${::tomcat::version}.jar";

'tomcat-juli-extras.jar':
ensure => link,
path => "${::tomcat::catalina_home_real}/lib/tomcat-juli-extras.jar",
target => "extras/tomcat-juli-extras-${::tomcat::version}.jar",
seltype => 'usr_t'
ensure => link,
path => "${::tomcat::catalina_home_real}/lib/tomcat-juli-extras.jar",
target => "extras/tomcat-juli-extras-${::tomcat::version}.jar"
}
}
Loading

0 comments on commit 5c4ab7a

Please sign in to comment.