diff --git a/Vagrantfile b/Vagrantfile index cb5366ef9..6732377fe 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -2,7 +2,7 @@ # vi: set ft=ruby : CENTOS_8_BOX_URL = "https://cloud.centos.org/centos/8-stream/x86_64/images/CentOS-Stream-Vagrant-8-20220913.0.x86_64.vagrant-libvirt.box" -CENTOS_9_BOX_URL = "https://cloud.centos.org/centos/9-stream/x86_64/images/CentOS-Stream-Vagrant-9-20230410.0.x86_64.vagrant-libvirt.box" +CENTOS_9_BOX_URL = "https://cloud.centos.org/centos/9-stream/x86_64/images/CentOS-Stream-Vagrant-9-latest.x86_64.vagrant-libvirt.box" Vagrant.configure("2") do |config| config.vm.box = "centos/7" @@ -111,9 +111,11 @@ Vagrant.configure("2") do |config| config.vm.define "redmine" do |override| override.vm.hostname = "redmine" + override.vm.box = "centos/stream9" - override.vm.provider "libvirt" do |libvirt| + override.vm.provider "libvirt" do |libvirt, provider| libvirt.memory = "2048" + provider.vm.box_url = CENTOS_9_BOX_URL end end end diff --git a/puppet/modules/redmine/files/redmine.socket b/puppet/modules/redmine/files/redmine.socket new file mode 100644 index 000000000..63eb431fe --- /dev/null +++ b/puppet/modules/redmine/files/redmine.socket @@ -0,0 +1,11 @@ +# Deployed with puppet +# + +[Unit] +Description=redmine socket + +[Socket] +ListenStream=3000 + +[Install] +WantedBy=sockets.target diff --git a/puppet/modules/redmine/manifests/init.pp b/puppet/modules/redmine/manifests/init.pp index b534e0824..920c21ea1 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 = { @@ -45,16 +46,6 @@ } # Needed for bundle install - if $facts['os']['release']['major'] == '8' { - package { 'ruby dnf module': - ensure => '2.7', - name => 'ruby', - enable_only => true, - provider => 'dnfmodule', - before => Package['rubygem-bundler.noarch', 'ruby-devel'], - } - } - $packages = [ 'git', 'rubygem-bundler.noarch', @@ -161,10 +152,46 @@ $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::unit_file {'redmine.socket': + ensure => 'present', + enable => true, + active => true, + content => file('redmine/redmine.socket'), + } + + systemd::unit_file {'redmine.service': + ensure => 'present', + enable => true, + active => true, + content => template('redmine/redmine.service.erb'), + } + + $apache_backend_config = { + 'proxy_preserve_host' => true, + 'proxy_add_headers' => true, + 'request_headers' => ['set X_FORWARDED_PROTO "https"'], + 'proxy_pass' => { + 'no_proxy_uris' => [ + '/server-status', '/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: diff --git a/puppet/modules/redmine/templates/redmine.service.erb b/puppet/modules/redmine/templates/redmine.service.erb new file mode 100644 index 000000000..b5121f255 --- /dev/null +++ b/puppet/modules/redmine/templates/redmine.service.erb @@ -0,0 +1,10 @@ +[Unit] +Description=redmine + +[Service] +Type=notify +User=<%= @username %> +ExecStart=<%= @app_root %>/bin/rails server --environment production +PrivateTmp=true +WorkingDirectory=<%= @app_root %> +SyslogIdentifier=redmine