Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow puma/systemd deployment #1883

Merged
merged 4 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
11 changes: 11 additions & 0 deletions puppet/modules/redmine/files/redmine.socket
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Deployed with puppet
#

[Unit]
Description=redmine socket

[Socket]
ListenStream=3000

[Install]
WantedBy=sockets.target
55 changes: 41 additions & 14 deletions puppet/modules/redmine/manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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',
Expand Down Expand Up @@ -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':
evgeni marked this conversation as resolved.
Show resolved Hide resolved
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"'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Foreman we also unset SSL client cert parameters. Is that not needed here because Redmine ignores those?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that was my assumption, nothing uses client auth here, so no need to unset.

'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:
Expand Down
10 changes: 10 additions & 0 deletions puppet/modules/redmine/templates/redmine.service.erb
Original file line number Diff line number Diff line change
@@ -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