diff --git a/manifests/swh/deploy/storage.pp b/manifests/swh/deploy/storage.pp index a85afec..d64c7e8 100644 --- a/manifests/swh/deploy/storage.pp +++ b/manifests/swh/deploy/storage.pp @@ -1,79 +1,76 @@ # Deployment of the swh.storage.api server class profile::swh::deploy::storage { $conf_directory = hiera('swh::deploy::storage::conf_directory') $conf_file = hiera('swh::deploy::storage::conf_file') $user = hiera('swh::deploy::storage::user') $group = hiera('swh::deploy::storage::group') - $db_host = hiera('swh::deploy::storage::db::host') - $db_user = hiera('swh::deploy::storage::db::user') - $db_dbname = hiera('swh::deploy::storage::db::dbname') - $db_password = hiera('swh::deploy::storage::db::password') - $directory = hiera('swh::deploy::storage::directory') $swh_packages = ['python3-swh.storage'] $uwsgi_listen_address = hiera('swh::deploy::storage::uwsgi::listen') $uwsgi_workers = hiera('swh::deploy::storage::uwsgi::workers') $uwsgi_http_workers = hiera('swh::deploy::storage::uwsgi::http_workers') $uwsgi_http_keepalive = hiera('swh::deploy::storage::uwsgi::http_keepalive') $uwsgi_http_timeout = hiera('swh::deploy::storage::uwsgi::http_timeout') $uwsgi_max_requests = hiera('swh::deploy::storage::uwsgi::max_requests') $uwsgi_max_requests_delta = hiera('swh::deploy::storage::uwsgi::max_requests_delta') $uwsgi_reload_mercy = hiera('swh::deploy::storage::uwsgi::reload_mercy') + $storage_config = hiera('swh::deploy::storage::config') + include ::uwsgi package {$swh_packages: ensure => latest, require => Apt::Source['softwareheritage'], notify => Service['uwsgi'], } file {$conf_directory: ensure => directory, owner => 'root', group => $group, mode => '0755', } file {$conf_file: ensure => present, owner => 'root', group => $group, mode => '0640', - content => template('profile/swh/deploy/storage/storage.ini.erb'), + content => inline_template('<%= @storage_config.to_yaml %>'), notify => Service['uwsgi'], } ::uwsgi::site {'swh-storage': ensure => enabled, settings => { plugin => 'python3', workers => $uwsgi_workers, max_requests => $uwsgi_max_requests, max_requests_delta => $uwsgi_max_requests_delta, worker_reload_mercy => $uwsgi_reload_mercy, reload_mercy => $uwsgi_reload_mercy, uid => $user, gid => $user, umask => '022', module => 'swh.storage.api.server', callable => 'run_from_webserver', } } ::uwsgi::site {'swh-storage-http': ensure => enabled, settings => { workers => 0, http => $uwsgi_listen_address, http_workers => $uwsgi_http_workers, http_keepalive => $uwsgi_http_keepalive, http_timeout => $uwsgi_http_timeout, http_to => '/var/run/uwsgi/app/swh-storage/socket', uid => $user, gid => $user, } } } diff --git a/templates/swh/deploy/storage/storage.ini.erb b/templates/swh/deploy/storage/storage.ini.erb deleted file mode 100644 index eab75af..0000000 --- a/templates/swh/deploy/storage/storage.ini.erb +++ /dev/null @@ -1,6 +0,0 @@ -# swh.storage.api configuration file -# File managed by puppet - modifications will be overwritten - -[main] -db = host=<%= @db_host %> user=<%= @db_user %> dbname=<%= @db_dbname %> password=<%= @db_password %> -storage_base = <%= @directory %>