From 73d966a63013de44b649cdd35f3adc4a98f3d3ee Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 14 May 2024 17:03:05 -0700 Subject: [PATCH 1/4] (templates/tomcat) new templates --- templates/tomcat/logging.properties.epp | 74 +++++++++++++++++++ .../tomcat/statusPersister.properties.epp | 11 +++ 2 files changed, 85 insertions(+) create mode 100644 templates/tomcat/logging.properties.epp create mode 100644 templates/tomcat/statusPersister.properties.epp diff --git a/templates/tomcat/logging.properties.epp b/templates/tomcat/logging.properties.epp new file mode 100644 index 0000000..338c099 --- /dev/null +++ b/templates/tomcat/logging.properties.epp @@ -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: +# : [] +# +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 : +org.lsst.ccs.utilities.logging.TextFormatter.format=%4$s: %5$s (%2$s) [%1$tc]%n%6$s + +org.lsst.ccs.localdb.level=INFO diff --git a/templates/tomcat/statusPersister.properties.epp b/templates/tomcat/statusPersister.properties.epp new file mode 100644 index 0000000..1701e05 --- /dev/null +++ b/templates/tomcat/statusPersister.properties.epp @@ -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 %> From fe3551319267e03ca1538a8b31f6e5f6b6748c02 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 14 May 2024 17:03:34 -0700 Subject: [PATCH 2/4] (manifest/tomcat) new manifest --- manifests/tomcat.pp | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 manifests/tomcat.pp diff --git a/manifests/tomcat.pp b/manifests/tomcat.pp new file mode 100644 index 0000000..b397300 --- /dev/null +++ b/manifests/tomcat.pp @@ -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), + } + } +} From f05448b38dff5845cfc8419dea4ee2c4d5ac01e5 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 14 May 2024 17:04:17 -0700 Subject: [PATCH 3/4] (manifests/init) add option to install ccs tomcat rest config --- manifests/init.pp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/manifests/init.pp b/manifests/init.pp index 497a775..a3c8bf3 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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 # @@ -80,12 +83,24 @@ # 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 = {}, @@ -93,6 +108,7 @@ 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', @@ -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" @@ -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'] + } } From c717698ad3d441ecdd1f0e0120e620c779ef3119 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 14 May 2024 17:18:56 -0700 Subject: [PATCH 4/4] (REFERENCE) regenerate --- REFERENCE.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/REFERENCE.md b/REFERENCE.md index 31cae80..734ea9c 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -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 @@ -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) @@ -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) ##### `installations` @@ -120,6 +126,14 @@ Path to CCS log files. Default value: `'/var/log/ccs'` +##### `tomcat_rest_etc_path` + +Data type: `Stdlib::Absolutepath` + +Path to CCS tomcat configuration directory. + +Default value: `'/etc/ccs/tomcat'` + ##### `user` Data type: `String` @@ -220,6 +234,14 @@ true` to `vcsrepo` type resources. Default value: `false` +##### `tomcat_rest` + +Data type: `Boolean` + +If true, install tomcat rest server configuration + +Default value: `false` + ##### `global_properties` Data type: `Array[String]` @@ -236,3 +258,27 @@ Array of extra strings to add to the udp_ccs.properties file. Default value: `[]` +##### `tomcat_rest_url` + +Data type: `String[1]` + +String giving URL for the rest server. + +Default value: `'lsstcam-db01:3306/ccsdbprod'` + +##### `tomcat_rest_user` + +Data type: `Sensitive[String[1]]` + +Sensitive string giving username for the rest server. + +Default value: `Sensitive('user')` + +##### `tomcat_rest_pass` + +Data type: `Sensitive[String[1]]` + +Sensitive string giving password for the rest server. + +Default value: `Sensitive('pass')` +