Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(tomcat) add the option to install ccs tomcat configuration #57

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* `ccs_software::log`: Create /var/log/ccs and install logrotation.
* `ccs_software::pre`: Install ccs software prerequisites
* `ccs_software::service`: Manages ccs systemd service units
* `ccs_software::tomcat`: Install /etc/ccs/tomcat files.

## Classes

Expand All @@ -35,6 +36,7 @@ The following parameters are available in the `ccs_software` class:
* [`base_path`](#-ccs_software--base_path)
* [`etc_path`](#-ccs_software--etc_path)
* [`log_path`](#-ccs_software--log_path)
* [`tomcat_rest_etc_path`](#-ccs_software--tomcat_rest_etc_path)
* [`user`](#-ccs_software--user)
* [`group`](#-ccs_software--group)
* [`adm_user`](#-ccs_software--adm_user)
Expand All @@ -47,8 +49,12 @@ The following parameters are available in the `ccs_software` class:
* [`hostname`](#-ccs_software--hostname)
* [`desktop`](#-ccs_software--desktop)
* [`git_force`](#-ccs_software--git_force)
* [`tomcat_rest`](#-ccs_software--tomcat_rest)
* [`global_properties`](#-ccs_software--global_properties)
* [`udp_properties`](#-ccs_software--udp_properties)
* [`tomcat_rest_url`](#-ccs_software--tomcat_rest_url)
* [`tomcat_rest_user`](#-ccs_software--tomcat_rest_user)
* [`tomcat_rest_pass`](#-ccs_software--tomcat_rest_pass)

##### <a name="-ccs_software--installations"></a>`installations`

Expand Down Expand Up @@ -120,6 +126,14 @@ Path to CCS log files.

Default value: `'/var/log/ccs'`

##### <a name="-ccs_software--tomcat_rest_etc_path"></a>`tomcat_rest_etc_path`

Data type: `Stdlib::Absolutepath`

Path to CCS tomcat configuration directory.

Default value: `'/etc/ccs/tomcat'`

##### <a name="-ccs_software--user"></a>`user`

Data type: `String`
Expand Down Expand Up @@ -220,6 +234,14 @@ true` to `vcsrepo` type resources.

Default value: `false`

##### <a name="-ccs_software--tomcat_rest"></a>`tomcat_rest`

Data type: `Boolean`

If true, install tomcat rest server configuration

Default value: `false`

##### <a name="-ccs_software--global_properties"></a>`global_properties`

Data type: `Array[String]`
Expand All @@ -236,3 +258,27 @@ Array of extra strings to add to the udp_ccs.properties file.

Default value: `[]`

##### <a name="-ccs_software--tomcat_rest_url"></a>`tomcat_rest_url`

Data type: `String[1]`

String giving URL for the rest server.

Default value: `'lsstcam-db01:3306/ccsdbprod'`

##### <a name="-ccs_software--tomcat_rest_user"></a>`tomcat_rest_user`

Data type: `Sensitive[String[1]]`

Sensitive string giving username for the rest server.

Default value: `Sensitive('user')`

##### <a name="-ccs_software--tomcat_rest_pass"></a>`tomcat_rest_pass`

Data type: `Sensitive[String[1]]`

Sensitive string giving password for the rest server.

Default value: `Sensitive('pass')`

27 changes: 27 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
# @param log_path
# Path to CCS log files.
#
# @param tomcat_rest_etc_path
# Path to CCS tomcat configuration directory.
#
# @param user
# Name of the role user under which CCS services will be run and the owner of config files
#
Expand Down Expand Up @@ -80,19 +83,32 @@
# Force the update of managed git clones. This is done by passing `force =>
# true` to `vcsrepo` type resources.
#
# @param tomcat_rest
# If true, install tomcat rest server configuration
#
# @param global_properties
# Array of extra strings to add to the ccsGlobal.properties file.
#
# @param udp_properties
# Array of extra strings to add to the udp_ccs.properties file.
#
# @param tomcat_rest_url
# String giving URL for the rest server.
#
# @param tomcat_rest_user
# Sensitive string giving username for the rest server.
#
# @param tomcat_rest_pass
# Sensitive string giving password for the rest server.
#
class ccs_software (
Hash[String, Hash] $installations = {},
Hash[String, Array[Variant[String, Hash]]] $services = {},
Optional[String] $service_workdir = undef,
Stdlib::Absolutepath $base_path = '/opt/lsst',
Stdlib::Absolutepath $etc_path = '/etc/ccs',
Stdlib::Absolutepath $log_path = '/var/log/ccs',
Stdlib::Absolutepath $tomcat_rest_etc_path = '/etc/ccs/tomcat',
String $user = 'ccs',
String $group = 'ccs',
String $adm_user = 'ccsadm',
Expand All @@ -105,8 +121,13 @@
Optional[String] $hostname = $facts['networking']['hostname'],
Boolean $desktop = false,
Boolean $git_force = false,
Boolean $tomcat_rest = false,
Array[String] $global_properties = [],
Array[String] $udp_properties = [],
String[1] $tomcat_rest_url = 'lsstcam-db01:3306/ccsdbprod',
## These are only required if tomcat rest server is being used.
Sensitive[String[1]] $tomcat_rest_user = Sensitive('user'),
Sensitive[String[1]] $tomcat_rest_pass = Sensitive('pass'),
) {
$ccs_path = "${base_path}/ccs"
$ccsadm_path = "${base_path}/ccsadm"
Expand All @@ -130,4 +151,10 @@
if ($desktop) {
contain ccs_software::desktop
}

if ($tomcat_rest) {
contain ccs_software::tomcat
Class['ccs_software::install']
-> Class['ccs_software::tomcat']
}
}
44 changes: 44 additions & 0 deletions manifests/tomcat.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#
# @summary
# Install /etc/ccs/tomcat files.
#
# @api private
class ccs_software::tomcat {
assert_private()

$etc_path = $ccs_software::tomcat_rest_etc_path
$etc_user = 'tomcat'
$etc_group = $ccs_software::adm_group
$user = $ccs_software::tomcat_rest_user
$pass = $ccs_software::tomcat_rest_pass
$url = $ccs_software::tomcat_rest_url

ensure_resources('file', {
$etc_path => {
ensure => directory,
owner => $etc_user,
group => $etc_group,
mode => '2770',
},
})

## Hash of templates and any arguments they take.
$etc_files = {
'logging.properties' => {},
'statusPersister.properties' => {
'user' => $user,
'pass' => $pass,
'url' => $url,
},
}

$etc_files.each |$file, $epp_vars| {
file { "${etc_path}/${file}":
ensure => file,
owner => $etc_user,
group => $etc_group,
mode => '0660',
content => epp("${module_name}/tomcat/${file}.epp", $epp_vars),
}
}
}
74 changes: 74 additions & 0 deletions templates/tomcat/logging.properties.epp
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# This file is managed by Puppet; changes may be overwritten

# Properties file which configures the operation of the CCS
# logging facility.

# Global logging properties.
# ------------------------------------------
# The set of handlers to be loaded upon startup.
# Comma-separated list of class names.
# (? LogManager docs say no comma here, but JDK example has comma.)
# do not put space characters in this list!
# handlers are loaded by the primordial log manager

handlers=org.lsst.ccs.utilities.logging.DailyRollingFileHandler,java.util.logging.ConsoleHandler

## BEWARE: you CAN'T set org.lsst.ccs.bus.utils.LogBusHandler HERE!
## because it is initialized later (when the buses are activated)

# Default global logging level.
# Loggers and Handlers may override this level
# SEE LSSTCCS-290
.level=WARNING

#The level of the CCS Root logger LSSTCCS-297
org.lsst.ccs.level=INFO
# Loggers
# ------------------------------------------
# Loggers are usually attached to packages.
# Here, the level for each package is specified.
# The global level is used by default, so levels
# specified here simply act as an override.
#myapp.ui.level=ALL
#myapp.business.level=CONFIG
#myapp.data.level=SEVERE


# Handlers
# -----------------------------------------

# --- ConsoleHandler ---
# Override of global logging level
java.util.logging.ConsoleHandler.level=INFO


## Pattern and Level
org.lsst.ccs.utilities.logging.DailyRollingFileHandler.pattern=/var/log/ccs/ccs-rest-server.log
org.lsst.ccs.utilities.logging.DailyRollingFileHandler.level=ALL

## Number of log files to cycle through restarts
org.lsst.ccs.utilities.logging.DailyRollingFileHandler.count=100

# Style of output
org.lsst.ccs.utilities.logging.DailyRollingFileHandler.formatter=java.util.logging.SimpleFormatter


# a special formatter that deals with StackTraces
org.lsst.ccs.messaging.LogBusHandler.formatter=org.lsst.ccs.utilities.logging.TextFormatter
java.util.logging.ConsoleHandler.formatter=org.lsst.ccs.utilities.logging.TextFormatter

# change that one if you want to modify the way StackTraces are printed
# negative value means all the stacktrace will be printed
org.lsst.ccs.logging.StackTraceFormats.depth=2

# Example to customize the SimpleFormatter output format
# to print one-line log message like this:
# <level>: <log message> [<date/time>]
#
java.util.logging.SimpleFormatter.format=[%1$tY-%1$tm-%1$tdT%1$tT.%1$tL%1$tZ] %4$s: %5$s (%2$s)%n%6$s

# index starts at 1 : date, source, Logger, Level, message, throwableStr
# here we have <source> :<log message> <throwable>
org.lsst.ccs.utilities.logging.TextFormatter.format=%4$s: %5$s (%2$s) [%1$tc]%n%6$s

org.lsst.ccs.localdb.level=INFO
11 changes: 11 additions & 0 deletions templates/tomcat/statusPersister.properties.epp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<%- | Sensitive[String[1]] $user,
Sensitive[String[1]] $pass,
String[1] $url
| -%>
# This file is managed by Puppet; changes may be overwritten
hibernate.connection.url=jdbc:mysql://<%= $url %>
hibernate.connection.driver_class=com.mysql.jdbc.Driver
#hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.dialect=org.hibernate.dialect.MariaDBDialect
hibernate.connection.username=<%= $user %>
hibernate.connection.password=<%= $pass %>
Loading