2020-07-24 00:05:25 +02:00
|
|
|
# @summary Observability using Grafana
|
|
|
|
#
|
|
|
|
class zulip_ops::profile::grafana {
|
|
|
|
include zulip_ops::profile::base
|
|
|
|
include zulip::supervisor
|
|
|
|
|
2021-12-28 03:00:14 +01:00
|
|
|
$version = $zulip::common::versions['grafana']['version']
|
2021-12-28 02:08:41 +01:00
|
|
|
$dir = "/srv/zulip-grafana-${version}"
|
|
|
|
$bin = "${dir}/bin/grafana-server"
|
2021-12-28 02:49:35 +01:00
|
|
|
$data_dir = '/var/lib/grafana'
|
2021-12-09 05:25:49 +01:00
|
|
|
|
|
|
|
zulip::external_dep { 'grafana':
|
|
|
|
version => $version,
|
2022-02-11 20:37:31 +01:00
|
|
|
url => "https://dl.grafana.com/oss/release/grafana-${version}.linux-${zulip::common::goarch}.tar.gz",
|
2021-12-28 02:08:41 +01:00
|
|
|
tarball_prefix => "grafana-${version}",
|
2020-07-24 00:05:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
group { 'grafana':
|
|
|
|
ensure => present,
|
|
|
|
gid => '1070',
|
|
|
|
}
|
|
|
|
user { 'grafana':
|
|
|
|
ensure => present,
|
|
|
|
uid => '1070',
|
|
|
|
gid => '1070',
|
|
|
|
shell => '/bin/bash',
|
2021-12-28 02:50:36 +01:00
|
|
|
home => $data_dir,
|
2020-07-24 00:05:25 +02:00
|
|
|
managehome => false,
|
|
|
|
}
|
2021-12-28 02:49:35 +01:00
|
|
|
file { $data_dir:
|
2020-07-24 00:05:25 +02:00
|
|
|
ensure => directory,
|
|
|
|
owner => 'grafana',
|
|
|
|
group => 'grafana',
|
|
|
|
require => [ User[grafana], Group[grafana] ],
|
|
|
|
}
|
|
|
|
file { '/var/log/grafana':
|
|
|
|
ensure => directory,
|
|
|
|
owner => 'grafana',
|
|
|
|
group => 'grafana',
|
|
|
|
}
|
|
|
|
|
|
|
|
zulip_ops::teleport::application { 'monitoring': port => '3000' }
|
|
|
|
zulip_ops::firewall_allow { 'grafana': port => '3000' }
|
2021-06-11 22:37:36 +02:00
|
|
|
file { "${zulip::common::supervisor_conf_dir}/grafana.conf":
|
2020-07-24 00:05:25 +02:00
|
|
|
ensure => file,
|
|
|
|
require => [
|
|
|
|
Package[supervisor],
|
2021-12-29 21:44:03 +01:00
|
|
|
Zulip::External_Dep['grafana'],
|
2021-12-28 02:49:35 +01:00
|
|
|
File[$data_dir],
|
2020-07-24 00:05:25 +02:00
|
|
|
File['/var/log/grafana'],
|
|
|
|
],
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
|
|
|
mode => '0644',
|
2021-12-09 05:25:49 +01:00
|
|
|
content => template('zulip_ops/supervisor/conf.d/grafana.conf.erb'),
|
2020-07-24 00:05:25 +02:00
|
|
|
notify => Service[supervisor],
|
|
|
|
}
|
|
|
|
|
|
|
|
file { '/etc/grafana':
|
|
|
|
ensure => directory,
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
2023-01-26 23:26:51 +01:00
|
|
|
mode => '0755',
|
2020-07-24 00:05:25 +02:00
|
|
|
}
|
|
|
|
file { '/etc/grafana/grafana.ini':
|
|
|
|
ensure => file,
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
|
|
|
mode => '0644',
|
|
|
|
source => 'puppet:///modules/zulip_ops/grafana/grafana.ini',
|
|
|
|
notify => Service[supervisor],
|
|
|
|
}
|
|
|
|
}
|