From 451ebfde9e453161ea8b47e90e73b0de40fcc5d5 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Mon, 4 Sep 2023 13:56:19 +0200 Subject: [PATCH] allow puma/systemd deployment --- puppet/Puppetfile | 2 +- puppet/modules/redmine/manifests/init.pp | 58 ++++++++++++++++++++++-- 2 files changed, 55 insertions(+), 5 deletions(-) diff --git a/puppet/Puppetfile b/puppet/Puppetfile index 7ed4b40dc..f1fc74df6 100644 --- a/puppet/Puppetfile +++ b/puppet/Puppetfile @@ -19,7 +19,7 @@ mod 'puppet/pbuilder', '1.0.0' mod 'puppet/redis', '8.8.0' mod 'puppet/rvm', '2.0.0' mod 'puppet/selinux', '3.4.1' -mod 'puppet/systemd', '4.2.0' +mod 'puppet/systemd', '5.2.0' mod 'puppet/unattended_upgrades', '7.1.0' mod 'puppetlabs/apache', '8.6.0' mod 'puppetlabs/apt', '9.0.2' diff --git a/puppet/modules/redmine/manifests/init.pp b/puppet/modules/redmine/manifests/init.pp index b534e0824..8ee14bf41 100644 --- a/puppet/modules/redmine/manifests/init.pp +++ b/puppet/modules/redmine/manifests/init.pp @@ -35,6 +35,7 @@ String $db_name = 'redmine', String $db_password = extlib::cache_data('foreman_cache_data', 'db_password', extlib::random_password(32)), Boolean $https = false, + String $deployment = 'passenger', ) { # PostgreSQL tuning $postgresql_settings = { @@ -161,10 +162,59 @@ $docroot = "${app_root}/public" $priority = '05' - $apache_backend_config = { - passenger_app_root => $app_root, - passenger_min_instances => 1, - passenger_start_timeout => 600, + if $deployment == 'passenger' { + $apache_backend_config = { + passenger_app_root => $app_root, + passenger_min_instances => 1, + passenger_start_timeout => 600, + } + } else { + systemd::manage_unit {'redmine.socket': + ensure => 'present', + unit_entry => { + 'Description' => 'redmine socket', + }, + socket_entry => { + 'ListenStream' => 3000, + }, + install_entry => { + 'WantedBy' => 'sockets.target', + }, + } + + systemd::manage_unit{'redmine.service': + ensure => 'present', + enable => true, + active => true, + unit_entry => { + 'Description' => 'redmine', + }, + service_entry => { + 'Type' => 'notify', + 'User' => $username, + #'PrivateTmp' => true, + 'WorkingDirectory' => $app_root, + 'ExecStart' => "${app_root}/bin/rails server --environment production", + }, + } + + $apache_backend_config = { + 'proxy_preserve_host' => true, + 'proxy_add_headers' => true, + 'request_headers' => ['set X_FORWARDED_PROTO "https"'], + 'proxy_pass' => { + 'no_proxy_uris' => ['/icons', '/server-status', '/assets', '/help', '/images', '/javascripts', '/plugin_assets', '/stylesheets', '/themes', '/favicon.ico'], + 'path' => '/', + 'url' => 'http://127.0.0.1:3000', + }, + } + + if $facts['os']['selinux']['enabled'] { + selboolean { 'httpd_can_network_connect': + persistent => true, + value => 'on', + } + } } apache::vhost { $servername: