Skip to content

Commit

Permalink
adding capability to configure apps. Effectively, this sets up a jkMo…
Browse files Browse the repository at this point in the history
…unt for the supplied name. These queue up into a single file, so that they will be added/removed as needed.
  • Loading branch information
sharumpe committed Dec 3, 2014
1 parent 4dc0f7f commit 0c54452
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 3 deletions.
11 changes: 9 additions & 2 deletions manifests/jk.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
(
$jkLogLevel = "error",
$jkWorkerHost = "localhost",
$jkWorkerPort = 8009
$jkWorkerPort = 8009,
$apps = []
)
{
include apache2::params

validate_string( $jkLogLevel )
validate_string( $jkWorkerHost )
validate_string( $jkWorkerPort )
validate_array( $apps )

# install the package
package { $params::jkPackageName :
Expand All @@ -27,11 +29,16 @@
$default = "$mod_path/templates/default$params::jkConfigPath.erb"

# write the config file
file { $apache2::jkConfigPath :
file { $params::jkConfigPath :
ensure => file,
content => inline_template( file( $specific, $default ) ),
notify => $apache2::serviceNotify,
require => Package[ $params::jkPackageName ],
}

# if any apps were specified, create them
class { 'apache2::jk::app' : }
if ( is_array( $apps ) and size( $apps ) > 0 ) {
apache2::jk::addApp{ $apps : }
}
}
44 changes: 44 additions & 0 deletions manifests/jk/app.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
class apache2::jk::app
{
concat { $params::jkAppsConfigPath :
ensure => present,
notify => $apache2::serviceNotify,
require => Package[ $params::jkPackageName ],
}


concat::fragment { "$params::jkAppsConfigPath-fragment-pre" :
target => $params::jkAppsConfigPath,
order => 01,
content => "<IfModule mod_jk.c>\n",
}

concat::fragment { "$params::jkAppsConfigPath-fragment-post" :
target => $params::jkAppsConfigPath,
order => 99,
content => "</IfModule>\n",
}
}

define apache2::jk::addApp
(
$appName = $name
)
{
include apache2::params

validate_string( $appName )

# Pick the template path we're going to use
$mod_path = get_module_path('apache2')
$specific = "$mod_path/templates/$operatingsystem/$operatingsystemrelease$params::jkAppsConfigPath-app-fragment.erb"
$default = "$mod_path/templates/default$params::jkAppsConfigPath-app-fragment.erb"

# write the config file
concat::fragment { $appName :
target => $params::jkAppsConfigPath,
order => 10,
content => inline_template( file( $specific, $default ) ),
}

}
2 changes: 2 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
$configConfdPath = "${configDirPath}/conf.d"
$accessConfigPath = "${configConfdPath}/access.conf"
$jkConfigPath = "${configConfdPath}/jk.conf"
$jkAppsConfigPath = "${configConfdPath}/jkApps.conf.inc"
$ldapConfigPath = "${configConfdPath}/ldap.conf"
$phpConfigPath = "${configConfdPath}/php5.conf"
$phpAppsConfigPath = "${configConfdPath}/php5Apps.conf.inc"
$remoteIpConfigPath = "${configConfdPath}/remoteip.conf"
$traceEnableConfigPath = "${configConfdPath}/trace.conf"

Expand Down
2 changes: 1 addition & 1 deletion templates/default/etc/apache2/conf.d/jk.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@
# Set properties for the status worker
JkWorkerProperty worker.status.type=status

Include /etc/apache2/conf.d/jk.d/*.mount
IncludeOptional /etc/apache2/conf.d/jkApps.conf.inc
</IfModule>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Location "/<%= @appName -%>*">
# see conf.d/access.conf for other access controls
JkMount localJvm1
Require host localhost
Require ip 127.0.0.1
</Location>

0 comments on commit 0c54452

Please sign in to comment.