From b1e4b7898cbc543f96d11ea8b30d019400646499 Mon Sep 17 00:00:00 2001 From: Alexander Meindl Date: Tue, 17 Dec 2024 18:20:00 +0100 Subject: [PATCH] Update to RocketChaat 7.1 and MongoDB 7.0 --- roles/mongodb/README.md | 1 - roles/mongodb/defaults/main.yml | 17 ++++++++++++++--- roles/mongodb/tasks/setup.yml | 4 ++-- roles/mongodb/templates/mongod.conf.j2 | 2 -- roles/mongodb/templates/mongod_init.conf.j2 | 2 -- roles/rocketchat/defaults/main.yml | 3 ++- roles/rocketchat/tasks/mongodb.yml | 3 ++- 7 files changed, 20 insertions(+), 12 deletions(-) diff --git a/roles/mongodb/README.md b/roles/mongodb/README.md index eafdb95..2a5f097 100644 --- a/roles/mongodb/README.md +++ b/roles/mongodb/README.md @@ -72,7 +72,6 @@ mongodb_storage_quota_enforced: false # Limits each database to a certain number mongodb_storage_quota_maxfiles: 8 # Number of quota files per DB mongodb_storage_smallfiles: false # Very useful for non-data nodes -mongodb_storage_journal_enabled: true # Enable journaling mongodb_storage_prealloc: true # Disable data file preallocation # WiredTiger Options diff --git a/roles/mongodb/defaults/main.yml b/roles/mongodb/defaults/main.yml index c2f760d..7f05e09 100644 --- a/roles/mongodb/defaults/main.yml +++ b/roles/mongodb/defaults/main.yml @@ -1,7 +1,20 @@ --- mongodb_package: mongodb-org -mongodb_version: '5.0' + +# Update to from 5 to 6 +# 1. Enable the repository for MongoDB-6.0. +# 2. To ensure 'featureCompatibilityVersion' is set to "5.0": +# db.adminCommand({getParameter: 1, featureCompatibilityVersion: 1}) +# To update 'featureCompatibilityVersion': +# db.adminCommand({setFeatureCompatibilityVersion: "5.0"}) +# 3. To shut down MongoDB: rs.stepDown() +# 4. Stop the service: systemctl stop mongod +# 5. Update MongoDB: apt upgrade* Ensure the following packages are in the updating list: +# mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools +# 6. Start MongoDB: systemctl start mongod + +mongodb_version: '7.0' mongodb_apt_url: http://repo.mongodb.org/apt/{{ ansible_distribution | lower }} mongodb_apt_suites: "{{ ansible_distribution_release }}/mongodb-org/{{ mongodb_version }}" @@ -72,8 +85,6 @@ mongodb_storage_engine: "wiredTiger" mongodb_storage_quota_enforced: false # Limits each database to a certain number of files mongodb_storage_quota_maxfiles: 8 # Number of quota files per DB mongodb_storage_smallfiles: false # Very useful for non-data nodes - -mongodb_storage_journal_enabled: true # Enable journaling mongodb_storage_prealloc: true # Enable data file preallocation mongodb_wiredtiger_directory_for_indexes: false diff --git a/roles/mongodb/tasks/setup.yml b/roles/mongodb/tasks/setup.yml index 3719a41..04cd212 100644 --- a/roles/mongodb/tasks/setup.yml +++ b/roles/mongodb/tasks/setup.yml @@ -34,8 +34,8 @@ - name: Check whether admin user is already exist ansible.builtin.command: > - mongo --quiet {{ '--ssl --host ' + mongodb_net_ssl_host if mongodb_net_ssl_mode == 'requireSSL' else '' }} -u {{ mongodb_user_admin_name }} \ - -p {{ mongodb_user_admin_password }} --port {{ mongodb_net_port }} --eval 'db.version()' admin + mongosh --quiet {{ '--ssl --host ' + mongodb_net_ssl_host if mongodb_net_ssl_mode == 'requireSSL' else '' }} -u {{ mongodb_user_admin_name }} \ + -p {{ mongodb_user_admin_password }} --port {{ mongodb_net_port }} --eval 'db.version()' admin register: mongodb_user_admin_check changed_when: false check_mode: false diff --git a/roles/mongodb/templates/mongod.conf.j2 b/roles/mongodb/templates/mongod.conf.j2 index 2d72045..2fad4db 100644 --- a/roles/mongodb/templates/mongod.conf.j2 +++ b/roles/mongodb/templates/mongod.conf.j2 @@ -57,8 +57,6 @@ storage: dbPath: {{ mongodb_storage_dbpath }} directoryPerDB: {{ mongodb_storage_dirperdb | to_nice_json }} engine: {{ mongodb_storage_engine }} - journal: - enabled: {{ mongodb_storage_journal_enabled | to_nice_json }} {% if mongodb_storage_engine == 'mmapv1' -%} mmapv1: quota: diff --git a/roles/mongodb/templates/mongod_init.conf.j2 b/roles/mongodb/templates/mongod_init.conf.j2 index 4ed7dcb..3cbf01d 100644 --- a/roles/mongodb/templates/mongod_init.conf.j2 +++ b/roles/mongodb/templates/mongod_init.conf.j2 @@ -19,8 +19,6 @@ storage: dbPath: {{ mongodb_storage_dbpath }} directoryPerDB: {{ mongodb_storage_dirperdb | to_nice_json }} engine: {{ mongodb_storage_engine }} - journal: - enabled: {{ mongodb_storage_journal_enabled | to_nice_json }} {% if mongodb_storage_engine == 'mmapv1' -%} mmapv1: quota: diff --git a/roles/rocketchat/defaults/main.yml b/roles/rocketchat/defaults/main.yml index 3c3e94a..e26c422 100644 --- a/roles/rocketchat/defaults/main.yml +++ b/roles/rocketchat/defaults/main.yml @@ -9,7 +9,7 @@ rocketchat_packages: rocketchat_dir: /srv/rocketchat rocketchat_application_path: '{{ rocketchat_dir }}/bundle' # "latest" implies latest stable here, can be "3.3.0", for example -rocketchat_version: 6.13.1 +rocketchat_version: 7.1.0 # rocketchat_tarball_remote: https://releases.rocket.chat/{{ rocketchat_version }}/download rocketchat_tarball_remote: https://cdn-download.rocket.chat/build/rocket.chat-{{ rocketchat_version }}.tgz rocketchat_tarball_fetch_timeout: 100 @@ -21,6 +21,7 @@ rocketchat_service_environment: [] # MongoDB settings # mongodb can be disabled for bulleyes update rocketchat_with_mongodb: true +rocketchat_with_init_mongodb_replica: true rocketchat_mongodb_server: 127.0.0.1 rocketchat_mongodb_port: 27017 rocketchat_mongodb_database: rocketchat diff --git a/roles/rocketchat/tasks/mongodb.yml b/roles/rocketchat/tasks/mongodb.yml index c621011..0f2fa94 100644 --- a/roles/rocketchat/tasks/mongodb.yml +++ b/roles/rocketchat/tasks/mongodb.yml @@ -7,12 +7,13 @@ - name: Ensure the MongoDB replSets have been initiated ansible.builtin.shell: >- - mongo --quiet --eval + mongosh --quiet --eval 'JSON.stringify(rs.initiate({_id:"{{ mongodb_replication_replset }}", members: [{"_id":1, "host": "{{ rocketchat_mongodb_server }}:{{ rocketchat_mongodb_port }}"}]}))' become: true become_user: "{{ mongodb_user | default('mongodb') }}" + when: rocketchat_with_init_mongodb_replica args: executable: /bin/bash register: repl_result