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

Service Fails on RH8 Due to Updated Systemd Forking Configuration #667

Open
acooke91 opened this issue Apr 19, 2023 · 2 comments
Open

Service Fails on RH8 Due to Updated Systemd Forking Configuration #667

acooke91 opened this issue Apr 19, 2023 · 2 comments

Comments

@acooke91
Copy link

acooke91 commented Apr 19, 2023

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:

  1. 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
  2. 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

@acooke91
Copy link
Author

acooke91 commented May 30, 2023

To add to this,

The rpm-supplied config file in mongodb 6.0.5 drops the lines below from the config file:
fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile

The puppet module always sets the pidfilepath param to /var/run/mongodb/mongod.pid on redhat systems though, and the template file mongodb.conf.2.6.erb adds the below, resulting in a broken configuration for mongodb 6.0.5 onwards

<% if @fork or @pidfilepath -%>
processManagement:
<%- if @fork -%>
fork: <%= @fork %>
<%- end -%>
<%- if @pidfilepath -%>
pidFilePath: <%= @pidfilepath %>
<%- end -%>
<% end -%>

witjoh pushed a commit to witjoh/puppet-mongodb that referenced this issue Jul 18, 2023
witjoh pushed a commit to witjoh/puppet-mongodb that referenced this issue Jan 10, 2024
witjoh pushed a commit to witjoh/puppet-mongodb that referenced this issue Jan 11, 2024
witjoh pushed a commit to witjoh/puppet-mongodb that referenced this issue Jan 20, 2024
witjoh pushed a commit to witjoh/puppet-mongodb that referenced this issue Feb 12, 2024
witjoh pushed a commit to witjoh/puppet-mongodb that referenced this issue Feb 20, 2024
@h-haaks
Copy link
Member

h-haaks commented Apr 29, 2024

@acooke91 could you verify if this is solved by the 6.0.0 release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants