saltstack-formulas / mongodb-formula

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

fix(formula): all fixes for linux and macos #88

Closed noelmcloughlin closed 4 years ago

noelmcloughlin commented 4 years ago

PR progress checklist (to be filled in by reviewers)


What type of PR is this?

Primary type

Secondary type

Does this PR introduce a BREAKING CHANGE?

No.

Related issues and/or pull requests

Describe the changes you're proposing

Fix this on macos:

          ID: mongodb-service-running-prerequisites
    Function: cmd.run
        Name: echo never >/sys/kernel/mm/transparent_hugepage/enabled
      Result: False
     Comment: Command "echo never >/sys/kernel/mm/transparent_hugepage/enabled" run
     Started: 17:29:54.006148
    Duration: 15.253 ms
     Changes:
              ----------
              pid:
                  7739
              retcode:
                  1
              stderr:
                  /bin/sh: /sys/kernel/mm/transparent_hugepage/enabled: No such file or directory
              stdout:

Pillar / config required to test the proposed changes

Debug log showing how the proposed changes work

Documentation checklist

Testing checklist

Additional context

user@macbook LaunchAgents % sudo salt-call state.highstate --local
local:
----------
          ID: mongodb-config-usergroup-org.mongo.mongodb.mongod-install-usergroup-present
    Function: group.present
        Name: mongodb
      Result: True
     Comment: New group mongodb created
     Started: 00:07:06.550088
    Duration: 171.944 ms
     Changes:   
              ----------
              gid:
                  501
              members:
              name:
                  mongodb
              passwd:
                  *
----------
          ID: mongodb-config-usergroup-org.mongo.mongodb.mongod-install-usergroup-present
    Function: user.present
        Name: mongodb
      Result: True
     Comment: New user mongodb created
     Started: 00:07:06.723650
    Duration: 5036.676 ms
     Changes:   
              ----------
              fullname:
              gid:
                  20
              groups:
                  - _lpoperator
                  - com.apple.sharepoint.group.1
                  - com.apple.sharepoint.group.2
                  - com.apple.sharepoint.group.3
                  - com.apple.sharepoint.group.4
                  - com.apple.sharepoint.group.5
                  - com.apple.sharepoint.group.6
                  - everyone
                  - localaccounts
                  - mongodb
                  - staff
              home:
              name:
                  mongodb
              shell:
                  /bin/false
              uid:
                  503
----------
          ID: mongodb-install-prerequisites
    Function: pkg.installed
        Name: curl
      Result: True
     Comment: All specified packages are already installed
     Started: 00:07:11.773827
    Duration: 16202.361 ms
     Changes:   
----------
          ID: mongodb-install-prerequisites
    Function: pip.installed
        Name: pymongo
      Result: True
     Comment: All packages were successfully installed
     Started: 00:07:27.977164
    Duration: 7066.769 ms
     Changes:   
              ----------
              pymongo==3.10.1:
                  Installed
----------
          ID: mongodb-install-prerequisites
    Function: file.directory
        Name: /var/lib/mongodb
      Result: True
     Comment: Directory /var/lib/mongodb updated
     Started: 00:07:35.048337
    Duration: 8.012 ms
     Changes:   
              ----------
              /var/lib/mongodb:
                  New Dir
----------
          ID: mongodb-install-prerequisites
    Function: file.directory
        Name: /tmp/downloads
      Result: True
     Comment: Directory /tmp/downloads updated
     Started: 00:07:35.056731
    Duration: 2.914 ms
     Changes:   
              ----------
              /tmp/downloads:
                  New Dir
----------
          ID: mongodb-database-mongod-archive-install
    Function: file.directory
        Name: /usr/local/mongodb/mongod-4.2.6
      Result: True
     Comment: Directory /usr/local/mongodb/mongod-4.2.6 updated
     Started: 00:07:35.059972
    Duration: 3.09 ms
     Changes:   
              ----------
              /usr/local/mongodb/mongod-4.2.6:
                  New Dir
----------
          ID: mongodb-database-mongod-archive-install
    Function: archive.extracted
        Name: /usr/local/mongodb/mongod-4.2.6
      Result: True
     Comment: https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.2.6.tgz extracted to /usr/local/mongodb/mongod-4.2.6/, due to absence of one or more files/dirs. Output was trimmed to 100 number of lines
     Started: 00:07:35.064606
    Duration: 8779.481 ms
     Changes:   
              ----------
              extracted_files:
                  - x THIRD-PARTY-NOTICES.gotools
                  - x README
                  - x THIRD-PARTY-NOTICES
                  - x MPL-2
                  - x LICENSE-Community.txt
                  - x bin/mongodump
                  - x bin/mongorestore
                  - x bin/mongoexport
                  - x bin/mongoimport
                  - x bin/mongostat
                  - x bin/mongotop
                  - x bin/bsondump
                  - x bin/mongofiles
                  - x bin/mongoreplay
                  - x bin/mongod
                  - x bin/mongos
                  - x bin/mongo
                  - x bin/install_compass
              updated ownership:
                  True
----------
          ID: mongodb-database-org.mongo.mongodb.mongod-install-service-directory
    Function: file.directory
        Name: /var/lib/mongodb/mongod
      Result: True
     Comment: Directory /var/lib/mongodb/mongod updated
     Started: 00:07:43.844720
    Duration: 3.192 ms
     Changes:   
              ----------
              /var/lib/mongodb/mongod:
                  New Dir
----------
          ID: mongodb-database-org.mongo.mongodb.mongod-install-service-launched
    Function: file.managed
        Name: /Library/LaunchAgents/org.mongo.mongodb.mongod.plist
      Result: True
     Comment: File /Library/LaunchAgents/org.mongo.mongodb.mongod.plist updated
     Started: 00:07:43.848622
    Duration: 20.039 ms
     Changes:   
              ----------
              diff:
                  New file
              mode:
                  0644
----------
          ID: mongodb-config-file-etc-file-directory
    Function: file.directory
        Name: /etc/mongodb
      Result: True
     Comment: The directory /etc/mongodb is in the correct state
     Started: 00:07:43.868958
    Duration: 1.227 ms
     Changes:   
----------
          ID: mongodb-config-file-org.mongo.mongodb.mongod-file-managed
    Function: file.managed
        Name: /etc/mongodb/mongod.conf
      Result: True
     Comment: File /etc/mongodb/mongod.conf updated
     Started: 00:07:43.870544
    Duration: 2224.649 ms
     Changes:   
              ----------
              diff:
                  New file
              group:
                  mongodb
              mode:
                  0644
              user:
                  mongodb
----------
          ID: mongodb-config-install-mongod-environ_file
    Function: file.managed
        Name: /etc/default/mongod.sh
      Result: True
     Comment: File /etc/default/mongod.sh updated
     Started: 00:07:46.095520
    Duration: 55.577 ms
     Changes:   
              ----------
              diff:
                  New file
              group:
                  staff
              mode:
                  0640
              user:
                  user
----------
          ID: mongodb-config-alternatives-install-notification
    Function: test.show_notification
      Result: True
     Comment: Note: The linux alternatives state is not applicable for MacOS
     Started: 00:07:46.151255
    Duration: 0.681 ms
     Changes:   
----------
          ID: mongodb-service-running-database-org.mongo.mongodb.mongod-install-datapath
    Function: file.directory
        Name: /var/lib/mongodb/mongod
      Result: True
     Comment: unless condition is true
     Started: 00:07:46.152192
    Duration: 20.008 ms
     Changes:   
----------
          ID: mongodb-service-running-database-org.mongo.mongodb.mongod-install-syslogpath
    Function: file.directory
        Name: /var/log/mongodb
      Result: True
     Comment: The directory /var/log/mongodb is in the correct state
     Started: 00:07:46.172832
    Duration: 2.51 ms
     Changes:   
----------
          ID: mongodb-service-running-database-org.mongo.mongodb.mongod-install-syslogfile
    Function: file.managed
        Name: /var/log/mongodb/mongod.log
      Result: True
     Comment: Empty file
     Started: 00:07:46.176130
    Duration: 3.109 ms
     Changes:   
              ----------
              mode:
                  0775
              new:
                  file /var/log/mongodb/mongod.log created
              user:
                  mongodb
----------
          ID: mongodb-service-running-database-org.mongo.mongodb.mongod-install-logrotate
    Function: file.managed
        Name: /etc/logrotate.d/mongodb_mongod
      Result: True
     Comment: unless condition is true
     Started: 00:07:46.179387
    Duration: 18.436 ms
     Changes:   
----------
          ID: mongodb-service-running-database-org.mongo.mongodb.mongod-unmasked
    Function: service.unmasked
        Name: org.mongo.mongodb.mongod
      Result: True
     Comment: onlyif condition is false
     Started: 00:07:46.198517
    Duration: 19.562 ms
     Changes:   
----------
          ID: mongodb-service-running-database-org.mongo.mongodb.mongod
    Function: cmd.run
        Name: launchctl load /Library/LaunchAgents/org.mongo.mongodb.mongod.plist || true
      Result: True
     Comment: Command "launchctl load /Library/LaunchAgents/org.mongo.mongodb.mongod.plist || true" run
     Started: 00:07:46.219256
    Duration: 22.091 ms
     Changes:   
              ----------
              pid:
                  55832
              retcode:
                  0
              stderr:
              stdout:
----------
          ID: mongodb-service-running-database-org.mongo.mongodb.mongod
    Function: cmd.run
        Name: launchctl start org.mongo.mongodb.mongod
      Result: True
     Comment: Command "launchctl start org.mongo.mongodb.mongod" run
     Started: 00:07:46.242194
    Duration: 12.465 ms
     Changes:   
              ----------
              pid:
                  55835
              retcode:
                  0
              stderr:
              stdout:

Summary for local
-------------
Succeeded: 21 (changed=14)
Failed:     0
-------------
Total states run:     21
Total run time:   39.675 s

user@macbook LaunchAgents % mongo
MongoDB shell version v4.2.6
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("5299e069-4ccb-4d29-8eb1-81a2e1ff0adc") }
MongoDB server version: 4.2.6
Server has startup warnings: 
2020-07-23T00:07:47.608+0100 I  CONTROL  [initandlisten] 
2020-07-23T00:07:47.608+0100 I  CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2020-07-23T00:07:47.608+0100 I  CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2020-07-23T00:07:47.608+0100 I  CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2020-07-23T00:07:47.608+0100 I  CONTROL  [initandlisten] 
2020-07-23T00:07:47.608+0100 I  CONTROL  [initandlisten] ** WARNING: This server is bound to localhost.
2020-07-23T00:07:47.608+0100 I  CONTROL  [initandlisten] **          Remote systems will be unable to connect to this server. 
2020-07-23T00:07:47.608+0100 I  CONTROL  [initandlisten] **          Start the server with --bind_ip <address> to specify which IP 
2020-07-23T00:07:47.608+0100 I  CONTROL  [initandlisten] **          addresses it should serve responses from, or with --bind_ip_all to
2020-07-23T00:07:47.608+0100 I  CONTROL  [initandlisten] **          bind to all interfaces. If this behavior is desired, start the
2020-07-23T00:07:47.608+0100 I  CONTROL  [initandlisten] **          server with --bind_ip 127.0.0.1 to disable this warning.
2020-07-23T00:07:47.608+0100 I  CONTROL  [initandlisten] 
---
Enable MongoDB's free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).

The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.

To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---

undefined:[4.2.6] > exit
bye
pull-assistant[bot] commented 4 years ago
Score: 0.91

Best reviewed: commit by commit


Optimal code review plan (2 warnings)

fix(macos): hugepages in linux kernel only
> `mongodb/service/running.sls` 75% changes removed in fix(macos): launchct...
     refactor(jinja): depreciate/replacer two variable names      chore(conditional): check if linux
fix(config): rename config file to .conf
> `mongodb/install.sls` 50% changes removed in chore(limits): incre... > `mongodb/clean.sls` 67% changes removed in fix(macos): launchct...
     fix(macos): launchctl and plist fixes      chore(limits): increase default limits on macos      fix(linux): fixup linux ci/cd

Powered by Pull Assistant. Last update 25a6883 ... b002965. Read the comment docs.

noelmcloughlin commented 4 years ago

Break into smaller PRs:
https://github.com/saltstack-formulas/mongodb-formula/pull/89

noelmcloughlin commented 4 years ago

Selfie merging as open for three weeks - ci passing

saltstack-formulas-travis commented 4 years ago

:tada: This PR is included in version 1.0.1 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: