Changeset View
Changeset View
Standalone View
Standalone View
site-modules/profile/manifests/swh/deploy/graph.pp
# Deployment of graph (checks for now) | # Deployment of graph (checks for now) | ||||
# FIXME: Graph is currently managed manually and running through a venv. At some point, | # FIXME: Graph is currently managed manually and running through a venv. At some point, | ||||
# adapt here to also install fully the graph from that manifest | # adapt here to also install fully the graph from that manifest | ||||
class profile::swh::deploy::graph { | class profile::swh::deploy::graph { | ||||
$packages = ['python3-venv'] | $packages = ['python3-venv'] | ||||
package {$packages: | package {$packages: | ||||
ensure => 'present', | ensure => 'present', | ||||
} | } | ||||
$user = lookup('swh::deploy::graph::user') | $user = lookup('swh::deploy::graph::user') | ||||
$group = lookup('swh::deploy::graph::group') | $group = lookup('swh::deploy::graph::group') | ||||
$sentry_dsn = lookup("swh::deploy::graph::sentry_dsn", Optional[String], 'first', undef) | $sentry_dsn = lookup('swh::deploy::graph::sentry_dsn', Optional[String], 'first', undef) | ||||
$sentry_environment = lookup("swh::deploy::graph::sentry_environment", Optional[String], 'first', undef) | $sentry_environment = lookup('swh::deploy::graph::sentry_environment', Optional[String], 'first', undef) | ||||
$sentry_swh_package = lookup("swh::deploy::graph::sentry_swh_package", Optional[String], 'first', undef) | $sentry_swh_package = lookup('swh::deploy::graph::sentry_swh_package', Optional[String], 'first', undef) | ||||
$max_heap = lookup('swh::deploy::graph::backend::max_heap') | |||||
$java_api_port = 50091 # hardcoded in swh-graph | $java_api_port = 50091 # hardcoded in swh-graph | ||||
$config_directory = lookup('swh::deploy::graph::conf_directory') | |||||
$config_file = "${config_directory}/graph.yml" | |||||
$config = { 'max_ram' => $max_heap } | |||||
# install services from templates | # install services from templates | ||||
$services = [ { # this matches the current status | $services = [ { # this matches the current status | ||||
'name' => 'swh-graph-shm-mount', | 'name' => 'swh-graph-shm-mount', | ||||
'status' => 'running', | 'status' => 'running', | ||||
'enable' => false, | 'enable' => false, | ||||
}, { | }, { | ||||
'name' => 'swh-graph', | 'name' => 'swh-graph', | ||||
'status' => 'running', | 'status' => 'running', | ||||
Show All 11 Lines | ::systemd::unit_file {$unit_name: | ||||
content => template("profile/swh/deploy/graph/${unit_name}.erb"), | content => template("profile/swh/deploy/graph/${unit_name}.erb"), | ||||
mode => '0644', | mode => '0644', | ||||
} ~> service {$service['name']: | } ~> service {$service['name']: | ||||
ensure => $service['status'], | ensure => $service['status'], | ||||
enable => $service['enable'], | enable => $service['enable'], | ||||
} | } | ||||
} | } | ||||
$backend_listen_host = lookup("swh::deploy::graph::backend::listen::host") | file {$config_directory: | ||||
$backend_listen_port = lookup("swh::deploy::graph::backend::listen::port") | ensure => directory, | ||||
owner => 'root', | |||||
group => $group, | |||||
mode => '0650', | |||||
} | |||||
file {$config_file: | |||||
ensure => present, | |||||
owner => 'root', | |||||
group => $group, | |||||
mode => '0640', | |||||
content => inline_template("<%= @config.to_yaml %>\n"), | |||||
notify => Service['swh-graph'], | |||||
} | |||||
$backend_listen_host = lookup('swh::deploy::graph::backend::listen::host') | |||||
$backend_listen_port = lookup('swh::deploy::graph::backend::listen::port') | |||||
$http_check_string = "graph API server" | $http_check_string = 'graph API server' | ||||
$icinga_checks_file = lookup('icinga2::exported_checks::filename') | $icinga_checks_file = lookup('icinga2::exported_checks::filename') | ||||
if $backend_listen_host == '0.0.0.0' { | if $backend_listen_host == '0.0.0.0' { | ||||
# It's not possible to directly test with the backend_listen_host in this case | # It's not possible to directly test with the backend_listen_host in this case | ||||
# so we fall back to localhost | # so we fall back to localhost | ||||
$local_check_address = '127.0.0.1' | $local_check_address = '127.0.0.1' | ||||
} else { | } else { | ||||
$local_check_address = $backend_listen_host | $local_check_address = $backend_listen_host | ||||
▲ Show 20 Lines • Show All 55 Lines • Show Last 20 Lines |