diff --git a/manifests/swh/deploy/scheduler_updater.pp b/manifests/swh/deploy/scheduler_updater.pp index 474c6476..0aae812f 100644 --- a/manifests/swh/deploy/scheduler_updater.pp +++ b/manifests/swh/deploy/scheduler_updater.pp @@ -1,32 +1,32 @@ # Deployment of swh-scheduler-updater related utilities -class profile::swh::deploy::scheduler::updater { +class profile::swh::deploy::scheduler_updater { # Package and backend configuration $scheduler_updater_packages = ['python3-swh.scheduler.updater'] package {$scheduler_updater_packages: ensure => latest, } $backend_conf_dir = lookup('swh::deploy::scheduler::updater::backend::conf_dir') $backend_conf_file = lookup('swh::deploy::scheduler::updater::backend::conf_file') $backend_user = lookup('swh::deploy::scheduler::updater::backend::user') $backend_group = lookup('swh::deploy::scheduler::updater::backend::group') $backend_config = lookup('swh::deploy::scheduler::updater::backend::config') - file {$backend_conf_dir: - ensure => directory, - owner => 'root', - group => $backend_group, - mode => '0755', - } + # file {$backend_conf_dir: + # ensure => directory, + # owner => 'root', + # group => $backend_group, + # mode => '0755', + # } - file {$backend_config: + file {$backend_conf_file: ensure => present, owner => 'root', group => $backend_group, mode => '0640', content => inline_template("<%= @backend_config.to_yaml %>\n"), } } diff --git a/manifests/swh/deploy/scheduler_updater_consumer.pp b/manifests/swh/deploy/scheduler_updater_consumer.pp index 04e606cd..97e8ba0f 100644 --- a/manifests/swh/deploy/scheduler_updater_consumer.pp +++ b/manifests/swh/deploy/scheduler_updater_consumer.pp @@ -1,68 +1,68 @@ # Deployment of swh-scheduler-updater related utilities -class profile::swh::deploy::scheduler::updater::consumer { - include ::profile::swh::deploy::scheduler::updater +class profile::swh::deploy::scheduler_updater_consumer { + include ::profile::swh::deploy::scheduler_updater # only ghtorrent so far $consumer_conf_dir = lookup('swh::deploy::scheduler::updater::consumer::ghtorrent::conf_dir') $consumer_conf_file = lookup('swh::deploy::scheduler::updater::consumer::ghtorrent::conf_file') $consumer_user = lookup('swh::deploy::scheduler::updater::consumer::user') $consumer_group = lookup('swh::deploy::scheduler::updater::consumer::group') - file {$consumer_conf_dir: - ensure => directory, - owner => 'root', - group => $consumer_group, - mode => '0755', - } +# file {$consumer_conf_dir: +# ensure => directory, +# owner => 'root', +# group => $consumer_group, +# mode => '0755', +# } $consumer_config = lookup('swh::deploy::scheduler::updater::consumer::ghtorrent::config') file {$consumer_conf_file: ensure => present, owner => 'root', group => $consumer_group, mode => '0640', content => inline_template("<%= @consumer_config.to_yaml %>\n"), } # service needed to forward port locally $local_port = lookup('swh::deploy::scheduler::updater::consumer::ghtorrent::port') $ghtorrent_private_key_raw = lookup('swh::deploy::scheduler::updater::consumer::ghtorrent::private_key') - $ghtorrent_private_key = '~/.ssh/id-rsa-swh-ghtorrent' + $ghtorrent_private_key = "/home/${consumer_user}/.ssh/id-rsa-swh-ghtorrent" # write private key to access the ghtorrent infra file {$ghtorrent_private_key: ensure => present, owner => $consumer_user, group => $consumer_group, mode => '0600', content => inline_template("<%= @ghtorrent_private_key_raw %>"), } $ghtorrent_service_name = 'ssh-ghtorrent' $ghtorrent_unit_name = "${ghtorrent_service_name}.service" # Service to open up the ghtorrent connection infra (no consumption) ::systemd::unit_file {$ghtorrent_unit_name: ensure => present, content => template("profile/swh/deploy/scheduler/${ghtorrent_unit_name}.erb"), } ~> service {$ghtorrent_service_name: ensure => running, enable => true, require => File[$ghtorrent_private_key], } # actual service consuming from ghtorrent - ghtorrent_consumer_service = 'swh-scheduler-updater-consumer-ghtorrent.service' - ghtorrent_consumer_unit_name = "${ghtorrent_consumer_service_name}.service" + $ghtorrent_consumer_service = 'swh-scheduler-updater-consumer-ghtorrent' + $ghtorrent_consumer_unit_name = "${ghtorrent_consumer_service}.service" # Service to consume from ghtorrent ::systemd::unit_file {$ghtorrent_consumer_unit_name: ensure => present, content => template("profile/swh/deploy/scheduler/${ghtorrent_consumer_unit_name}.erb"), } ~> service {$ghtorrent_consumer_service: ensure => stopped, enable => true, require => Service[$ghtorrent_service_name], } } diff --git a/manifests/swh/deploy/scheduler_updater_writer.pp b/manifests/swh/deploy/scheduler_updater_writer.pp index a1352cdc..119e2608 100644 --- a/manifests/swh/deploy/scheduler_updater_writer.pp +++ b/manifests/swh/deploy/scheduler_updater_writer.pp @@ -1,51 +1,51 @@ # Deployment of swh-scheduler-writer related utilities -class profile::swh::deploy::scheduler::updater::writer { - include ::profile::swh::deploy::scheduler::updater +class profile::swh::deploy::scheduler_updater_writer { + include ::profile::swh::deploy::scheduler_updater $writer_conf_dir = lookup('swh::deploy::scheduler::updater::writer::conf_dir') $writer_conf_file = lookup('swh::deploy::scheduler::updater::writer::conf_file') $writer_user = lookup('swh::deploy::scheduler::updater::writer::user') $writer_group = lookup('swh::deploy::scheduler::updater::writer::group') $writer_config = lookup('swh::deploy::scheduler::updater::writer::config') - file {$writer_conf_dir: - ensure => directory, - owner => 'root', - group => $writer_group, - mode => '0755', - } +# file {$writer_conf_dir: +# ensure => directory, +# owner => 'root', +# group => $writer_group, +# mode => '0755', +# } - file {$writer_config: + file {$writer_conf_file: ensure => present, owner => 'root', group => $writer_group, mode => '0640', content => inline_template("<%= @writer_config.to_yaml %>\n"), } # unit + timer - writer_service = 'swh-scheduler-updater-writer' - writer_unit_name = "${writer_service}.service" + $writer_service = 'swh-scheduler-updater-writer' + $writer_unit_name = "${writer_service}.service" # Service to consume from ghtorrent ::systemd::unit_file {$writer_unit_name: ensure => present, - content => template("profile/swh/deploy/scheduler/${writer_unit_name}.erb"), - } ~> service {$writer_service: + content => template("profile/swh/deploy/scheduler/${writer_unit_name}.erb") + } ~> service {$writer_unit_name: + ensure => stopped, enable => true, + require => File[$writer_conf_file], } - writer_timer_period = lookup('swh::deploy::scheduler::writer::timer_period') - writer_timer = 'swh-scheduler-updater-writer' - writer_timer_unit_name = "${writer_timer}.timer" + $writer_timer_period = lookup('swh::deploy::scheduler::updater::writer::timer_period') + $writer_timer = 'swh-scheduler-updater-writer' + $writer_timer_unit_name = "${writer_timer}.timer" ::systemd::unit_file {$writer_timer_unit_name: ensure => present, content => template("profile/swh/deploy/scheduler/${writer_timer_unit_name}.erb"), - } ~> service {$writer_service: - enable => true, - } ~> service {$writer_timer: + } ~> service {$writer_timer_unit_name: ensure => running, enable => true, - require => Service[$ghtorrent_service_name], + require => Service[$writer_unit_name], } } diff --git a/templates/swh/deploy/scheduler/swh-scheduler-updater-writer.timer.erb b/templates/swh/deploy/scheduler/swh-scheduler-updater-writer.timer.erb index 8e44dd04..debdd8fa 100644 --- a/templates/swh/deploy/scheduler/swh-scheduler-updater-writer.timer.erb +++ b/templates/swh/deploy/scheduler/swh-scheduler-updater-writer.timer.erb @@ -1,18 +1,18 @@ # Scheduler Updater Writer Timer unit file # Managed by puppet class profile::swh::deploy::scheduler::updater::writer # Changes will be overwritten [Unit] Description=Software Heritage Scheduler Updater Writer Timer [Timer] # Time to wait after booting before we run first time OnBootSec=10min # periodic run -OnCalendar=<%= writer_timer_period %> +OnCalendar=<%= @writer_timer_period %> # of unit -Unit=<%= writer_unit_name %> +Unit=<%= @writer_unit_name %> [Install] WantedBy=timers.target