diff --git a/manifests/swh/deploy/archiver.pp b/manifests/swh/deploy/archiver.pp new file mode 100644 index 0000000..509fe4c --- /dev/null +++ b/manifests/swh/deploy/archiver.pp @@ -0,0 +1,21 @@ +# Archiver base configuration + +class profile::swh::deploy::archiver { + include ::profile::swh::deploy::objstorage_cloud + + $config_dir = hiera('swh::deploy::worker::swh_storage_archiver::conf_directory') + + file {$config_dir: + ensure => 'directory', + owner => 'swhworker', + group => 'swhworker', + mode => '0644', + } + + $packages = ['python3-swh.storage.archiver'] + + package {$packages: + ensure => 'installed', + } + +} diff --git a/manifests/swh/deploy/storage_archiver.pp b/manifests/swh/deploy/storage_archiver.pp deleted file mode 100644 index 3b74b18..0000000 --- a/manifests/swh/deploy/storage_archiver.pp +++ /dev/null @@ -1,68 +0,0 @@ -# Deployment of swh.storage.archiver.director instance -# Only asynchronous version possible. -# Cron not installed since we need to run one synchronous batch first -# to catch up - -class profile::swh::deploy::storage_archiver { - $conf_directory = hiera('swh::deploy::storage_archiver::conf_directory') - $conf_file = hiera('swh::deploy::storage_archiver::conf_file') - $user = hiera('swh::deploy::storage_archiver::user') - $group = hiera('swh::deploy::storage_archiver::group') - - $objstorage_type = hiera('swh::deploy::storage_archiver::objstorage_type') - $objstorage_path = hiera('swh::deploy::storage_archiver::objstorage_path') - $objstorage_slicing = hiera('swh::deploy::storage_archiver::objstorage_slicing') - $objstorage_url = hiera('swh::deploy::storage_archiver::objstorage_url') - - $batch_max_size = hiera('swh::deploy::storage_archiver::batch_max_size') - $archival_max_age = hiera('swh::deploy::storage_archiver::archival_max_age') - $retention_policy = hiera('swh::deploy::storage_archiver::retention_policy') - # archiver db info - $db_host = hiera('swh::deploy::storage_archiver::db::host') - $db_user = hiera('swh::deploy::storage_archiver::db::user') - $db_dbname = hiera('swh::deploy::storage_archiver::db::dbname') - $db_password = hiera('swh::deploy::storage_archiver::db::password') - - $log_file = hiera('swh::deploy::storage_archiver::log::file') - - $swh_packages = ['python3-swh.storage.archiver'] - - package {$swh_packages: - ensure => latest, - require => Apt::Source['softwareheritage'], - } - - file {$conf_directory: - ensure => directory, - owner => 'root', - group => $group, - mode => '0750', - } - - file {$conf_file: - ensure => present, - owner => 'root', - group => $group, - mode => '0640', - content => template('profile/swh/deploy/storage/archiver.ini.erb'), - require => [ - File[$conf_directory], - Package[$swh_packages], - ] - } - - # cron {'swh-storage-archiver': - # ensure => present, - # user => $user, - # command => "/usr/bin/python3 -m swh.storage.archiver.director --config-path ${conf_file} --async 2>&1 > ${log_file}", - # hour => fqdn_rand(24, 'stats_export_hour'), - # minute => fqdn_rand(60, 'stats_export_minute'), - # month => '*', - # monthday => '*', - # weekday => '*', - # require => [ - # File[$conf_file] - # ] - # } - -} diff --git a/manifests/swh/deploy/worker/swh_storage_archiver.pp b/manifests/swh/deploy/worker/swh_storage_archiver.pp new file mode 100644 index 0000000..0c8029e --- /dev/null +++ b/manifests/swh/deploy/worker/swh_storage_archiver.pp @@ -0,0 +1,35 @@ +# Deployment for swh-storage-archiver +class profile::swh::deploy::worker::swh_storage_archiver { + include ::profile::swh::deploy::archiver + + $concurrency = hiera('swh::deploy::worker::swh_storage_archiver::concurrency') + $loglevel = hiera('swh::deploy::worker::swh_storage_archiver::loglevel') + $task_broker = hiera('swh::deploy::worker::swh_storage_archiver::task_broker') + + $config_file = hiera('swh::deploy::worker::swh_storage_archiver::conf_file') + $config = hiera('swh::deploy::worker::swh_storage_archiver::config') + + $task_modules = ['swh.storage.archiver.tasks'] + $task_queues = ['swh_storage_archiver_worker'] + + ::profile::swh::deploy::worker::instance {'swh_storage_archiver': + ensure => present, + concurrency => $concurrency, + loglevel => $loglevel, + task_broker => $task_broker, + task_modules => $task_modules, + task_queues => $task_queues, + require => [ + File[$config_file], + ], + } + + file {$config_file: + ensure => 'present', + owner => 'swhworker', + group => 'swhdev', + # Contains passwords + mode => '0640', + content => inline_template('<%= @config.to_yaml %>'), + } +} diff --git a/templates/swh/deploy/storage/archiver.ini.erb b/templates/swh/deploy/storage/archiver.ini.erb deleted file mode 100644 index 03735c6..0000000 --- a/templates/swh/deploy/storage/archiver.ini.erb +++ /dev/null @@ -1,17 +0,0 @@ -# swh.storage.archiver.director configuration file -# File managed by puppet - modifications will be overwritten - -[main] -objstorage_type = <%= @objstorage_type %> - -# the following 2 entries are only used if obstorage_type is 'local_storage' -objstorage_path = <%= @objstorage_path %> -objstorage_slicing = <%= @objstorage_slicing %> - -# the following entry is only used if objstorage_type is remote_storage -objstorage_url = <%= @objstorage_url %> - -batch_max_size = <%= @batch_max_size %> -archival_max_age = <%= @archival_max_age %> -retention_policy = <%= @retention_policy %> -dbconn = host=<%= @db_host %> user=<%= @db_user %> dbname=<%= @db_dbname %> password=<%= @db_password %>