Service Fails on RH8 Due to Updated Systemd Forking Configuration #667
Description
Affected Puppet, Ruby, OS and module versions/distributions
- Puppet:7.23
- Ruby:
- Distribution: Red Hat 8
- Module version: puppet-mongodb-4.2.0
How to reproduce (e.g Puppet code you use)
class { 'mongodb::globals':
manage_package_repo => false,
server_package_name => 'mongodb-org-server',
user => 'mongod',
group => 'mongod',
} ->
class { 'mongodb::server':
bind_ip => ['127.0.0.1'],
dbpath => '/srv/mongodb',
dbpath_fix => true,
}
selinux::port { 'mongodb':
ensure => 'present',
seltype => 'mongod_port_t',
protocol => 'tcp',
port => 27017,
}
What are you seeing
Since the most recent mongodb 6 rpm on RHEL8 (mongodb-org-server-6.0.5-1.el8.x86_64), the default forking configuration has changed in mongod.conf to permit systemd to fully manage this by removing the lines below from the systemd unit file
PIDFile=/var/run/mongodb/mongod.pid
Type=forking
Where mongod.conf file is managed puppet-mongodb-4.2.0, the lines below remained in mongod.conf, causing the service to fail post-upgrade.
processManagement:
fork: true
pidFilePath: /var/run/mongodb/mongod.pid
I managed to make it work by either:
- Changing 'fork: true' to 'fork:false' in the config file and modifying the $pidfilepath variable under the RedHat block in the case statement in manifests/params.pp around line 50, changing it from '/var/run/mongodb/mongod.pid' to undef
OR - Adding the lines below back in to the systemd unit file
PIDFile=/var/run/mongodb/mongod.pid
Type=forking
What behaviour did you expect instead
The default value for the $fork parameter should probably now be set to false in class mongodb::params for RHEL8 and possibly for other Enterpise Linux 8 based distributions.
Alternatively puppet-mongodb-4.2.0 should probably now manage the systemd unit file for mongdb to ensure the lines below are present, so that it will continue to work with the resultant mongd.conf file as it stands:
PIDFile=/var/run/mongodb/mongod.pid
Type=forking
Output log
Any additional information you'd like to impart
I have observed this breaking change since upgrading from mongodb-org-server-6.0.4-1.el8.x86_64 to mongodb-org-server-6.0.5-1.el8.x86_64 on Red Hat 8