saltstack-formulas / mongodb-formula

http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
31 stars 121 forks source link

[BUG] Issue with Systemd service unit. Possibly only effects newer versions of MongoDB #90

Open ShaunMaher opened 3 years ago

ShaunMaher commented 3 years ago

Your setup

Formula commit hash / release tag

6977ccf28acd7b7826056572faed0ee6dcfe01f7

Versions reports (master & minion)

Pillar / config used

wanted:
  database:
    - mongod
    - shell
pkg:
  deps:
    - python3-pip
  database:
    mongod:
      version: 4.4.1
      use_upstream: 'archive'
      config:
        storage:
          dbPath: /var/lib/mongodb/mongod

Bug details

Describe the bug

I'm attempting to install a reasonably standard installation of MongoDB on Ubuntu 20.04 using this formula (obviously).

Unless I'm mistaken, with MongoDB 4.4.1 (the latest version at the time of writing), is not using the conf file that this formula creates in /etc/mongodb/mongod.conf. The symptom it presents is the daemon failing to start and the following error in the system journal:

"NonExistentPath: Data directory /data/db not found. Create the missing directory or specify another path using (1) the --dbpath command line option, or (2) by adding the 'storage.dbPath' option in the configuration file."

If you edit the systemd unit file in /lib/systemd/system/mongod.service and change the ExecStart= line to the following, it works:

ExecStart=/usr/local/mongodb/mongod-4.4.1/bin/mongod -f /etc/mongodb/mongod.conf

I'm happy to create a PR that adds the command line argument but I'm not sure of:

Steps to reproduce the bug

Expected behaviour

Attempts to fix the bug

Additional context

noelmcloughlin commented 3 years ago

Looks like all Linux is impacted: https://github.com/saltstack-formulas/mongodb-formula/blob/751adb70ae8056d90cde04c9460ae6cf5c2af3b7/mongodb/install.sls#L225