diff --git a/site-modules/profile/manifests/swh/deploy/graph.pp b/site-modules/profile/manifests/swh/deploy/graph.pp index 28ef54d3..072cec61 100644 --- a/site-modules/profile/manifests/swh/deploy/graph.pp +++ b/site-modules/profile/manifests/swh/deploy/graph.pp @@ -1,98 +1,98 @@ # Deployment of graph (checks for now) # 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 class profile::swh::deploy::graph { $packages = ['python3-venv'] package {$packages: ensure => 'present', } $user = lookup('swh::deploy::graph::user') $group = lookup('swh::deploy::graph::group') $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_swh_package = lookup("swh::deploy::graph::sentry_swh_package", Optional[String], 'first', undef) # install services from templates $services = [ { # this matches the current status - 'name' => 'swhgraphshm', + 'name' => 'swh-graph-shm-mount', 'status' => 'running', 'enable' => false, }, { - 'name' => 'swhgraphdev', + 'name' => 'swh-graph', 'status' => 'running', 'enable' => true, } ] each($services) | $service | { $unit_name = "${service['name']}.service" # template uses: # $user # $group ::systemd::unit_file {$unit_name: ensure => present, content => template("profile/swh/deploy/graph/${unit_name}.erb"), mode => '0644', } ~> service {$service['name']: ensure => $service['status'], enable => $service['enable'], } } $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" $icinga_checks_file = lookup('icinga2::exported_checks::filename') if $backend_listen_host == '0.0.0.0' { # It's not possible to directly test with the backend_listen_host in this case # so we fall back to localhost $local_check_address = '127.0.0.1' } else { $local_check_address = $backend_listen_host } - # swhgraphdev.service exposes the main graph server. + # swh-graph.service exposes the main graph server. # Ensure the port is working ok through icinga checks @@::icinga2::object::service {"swh-graph api (local on ${::fqdn})": service_name => "swh-graph api (localhost)", import => ['generic-service'], host_name => $::fqdn, check_command => 'http', command_endpoint => $::fqdn, vars => { http_address => $local_check_address, http_vhost => $local_check_address, http_port => $backend_listen_port, http_uri => '/', http_header => ['Accept: application/html'], http_string => $http_check_string, }, target => $icinga_checks_file, tag => 'icinga2::exported', } if $backend_listen_host != '127.0.0.1' { @@::icinga2::object::service {"swh-graph api (remote on ${::fqdn})": service_name => "swh-graph api (remote)", import => ['generic-service'], host_name => $::fqdn, check_command => 'http', vars => { http_vhost => $::swh_hostname['internal_fqdn'], http_port => $backend_listen_port, http_uri => '/', http_header => ['Accept: application/html'], http_string => $http_check_string, }, target => $icinga_checks_file, tag => 'icinga2::exported', } } } diff --git a/site-modules/profile/templates/swh/deploy/graph/swhgraphshm.service.erb b/site-modules/profile/templates/swh/deploy/graph/swh-graph-shm-mount.service.erb similarity index 93% rename from site-modules/profile/templates/swh/deploy/graph/swhgraphshm.service.erb rename to site-modules/profile/templates/swh/deploy/graph/swh-graph-shm-mount.service.erb index 77af125d..741cf635 100644 --- a/site-modules/profile/templates/swh/deploy/graph/swhgraphshm.service.erb +++ b/site-modules/profile/templates/swh/deploy/graph/swh-graph-shm-mount.service.erb @@ -1,19 +1,19 @@ # Managed by puppet class profile::swh::deploy::graph # Changes will be overwritten [Unit] -Description=swh graph shm mapper +Description=swh-graph RAM data cache in /dev/shm [Service] Type=oneshot User=<%= @user %> Group=<%= @group %> RemainAfterExit=yes ExecStart=mkdir -p /dev/shm/swh-graph/default ExecStart=sh -c "ln -s /srv/softwareheritage/graph/latest/compressed/* /dev/shm/swh-graph/default" ExecStart=sh -c "cp --remove-destination /srv/softwareheritage/graph/latest/compressed/graph.graph /dev/shm/swh-graph/default" ExecStart=sh -c "cp --remove-destination /srv/softwareheritage/graph/latest/compressed/graph-transposed.graph /dev/shm/swh-graph/default" ExecStop=rm -rf /dev/shm/swh-graph/default [Install] WantedBy=multi-user.target diff --git a/site-modules/profile/templates/swh/deploy/graph/swhgraphdev.service.erb b/site-modules/profile/templates/swh/deploy/graph/swh-graph.service.erb similarity index 86% rename from site-modules/profile/templates/swh/deploy/graph/swhgraphdev.service.erb rename to site-modules/profile/templates/swh/deploy/graph/swh-graph.service.erb index 9c983292..d970e0aa 100644 --- a/site-modules/profile/templates/swh/deploy/graph/swhgraphdev.service.erb +++ b/site-modules/profile/templates/swh/deploy/graph/swh-graph.service.erb @@ -1,25 +1,25 @@ # Managed by puppet class profile::swh::deploy::graph # Changes will be overwritten [Unit] -Description=swh graph -After=swhgraphshm.service -Requires=swhgraphshm.service +Description=swh-graph HTTP server +After=swh-graph-shm-mount.service +Requires=swh-graph-shm-mount.service [Service] <%- if !@sentry_dsn.nil? and !@sentry_dsn.empty? -%> Environment=SWH_SENTRY_DSN=<%= @sentry_dsn %> <%- end -%> <%- if !@sentry_environment.nil? and !@sentry_environment.empty? -%> Environment=SWH_SENTRY_ENVIRONMENT=<%= @sentry_environment %> <%- end -%> <%- if !@sentry_swh_package.nil? and !@sentry_swh_package.empty? -%> Environment=SWH_MAIN_PACKAGE=<%= @sentry_swh_package %> <%- end -%> Type=simple User=<%= @user %> Group=<%= @group %> ExecStart=/opt/swhgraph_venv/bin/swh graph rpc-serve -g /dev/shm/swh-graph/default/graph [Install] WantedBy=multi-user.target