Files
zulip/puppet/kandra/manifests/prometheus/process.pp
Alex Vandiver b0e3191434 puppet: Stop relying on "tidy" ordering, which ignores metaparams.
The `tidy` parameter is buggy, and ignores all ordering
metaparameters.  This is fixed in Puppet 7[^1], but it's helpful to
resolve it now.  Specifically, this fixes bugs with tidy running too
early, and deleting the old version of a package before its new
version is installed or symlinked, leaving a race condition if
anything tries to run the binary in this window.

This is mostly not a problem for Supervisor-managed processes, since
the binary is already running, and can continue to run if it is tidied
out from under the running process.  For stand-alone tools like wal-g,
which are run frequently by PostgreSQL, this may cause issues if
PostgreSQL tries to call them during a puppet run.

Remove all complicated uses of tidy, and replace them with an `exec`
which does the equivalent.  We also generate `file` resources for
binaries, making them easier (and clearer) to specify as dependencies.

[^1]: https://puppet.atlassian.net/browse/PUP-10688
2024-04-15 14:30:24 -07:00

44 lines
1.4 KiB
Puppet

# @summary Prometheus monitoring of Zulip server processes
#
class kandra::prometheus::process {
include kandra::prometheus::base
include zulip::supervisor
$version = $zulip::common::versions['process_exporter']['version']
$dir = "/srv/zulip-process_exporter-${version}"
$bin = "${dir}/process-exporter"
$conf = '/etc/zulip/process_exporter.yaml'
zulip::external_dep { 'process_exporter':
version => $version,
url => "https://github.com/ncabatoff/process-exporter/releases/download/v${version}/process-exporter-${version}.linux-${zulip::common::goarch}.tar.gz",
tarball_prefix => "process-exporter-${version}.linux-${zulip::common::goarch}",
bin => [$bin],
cleanup_after => [Service[supervisor]],
}
kandra::firewall_allow { 'process_exporter': port => '9256' }
file { $conf:
ensure => file,
require => User[zulip],
owner => 'zulip',
group => 'zulip',
mode => '0644',
source => 'puppet:///modules/kandra/process_exporter.yaml',
}
file { "${zulip::common::supervisor_conf_dir}/prometheus_process_exporter.conf":
ensure => file,
require => [
User[zulip],
Package[supervisor],
File[$bin],
File[$conf],
],
owner => 'root',
group => 'root',
mode => '0644',
content => template('kandra/supervisor/conf.d/prometheus_process_exporter.conf.template.erb'),
notify => Service[supervisor],
}
}