From 828cf798cf0528b43a779318df208031f858ed05 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Wed, 14 May 2025 16:14:13 -0300 Subject: [PATCH] chore!: remove mongo 5/6 support (#35961) Co-authored-by: Diego Sampaio --- .changeset/gold-keys-compare.md | 4 + .github/workflows/ci-test-e2e.yml | 2 +- .github/workflows/ci.yml | 8 +- apps/meteor/server/startup/serverRunning.js | 86 ++++++++++----------- 4 files changed, 52 insertions(+), 48 deletions(-) create mode 100644 .changeset/gold-keys-compare.md diff --git a/.changeset/gold-keys-compare.md b/.changeset/gold-keys-compare.md new file mode 100644 index 00000000000..452169781c0 --- /dev/null +++ b/.changeset/gold-keys-compare.md @@ -0,0 +1,4 @@ +--- +"@rocket.chat/meteor": major +--- +Removes support of MongoDB versions 5.x and 6.x diff --git a/.github/workflows/ci-test-e2e.yml b/.github/workflows/ci-test-e2e.yml index 55af331e9bb..ad46ee31b2b 100644 --- a/.github/workflows/ci-test-e2e.yml +++ b/.github/workflows/ci-test-e2e.yml @@ -253,7 +253,7 @@ jobs: if: inputs.type == 'ui' && always() uses: actions/upload-artifact@v5 with: - name: playwright-test-trace-${{ inputs.release }}-${{ matrix.mongodb-version }}-${{ matrix.shard }} + name: playwright-test-trace-${{ inputs.release }}-${{ matrix.mongodb-version }}-${{ matrix.shard }}${{ inputs.db-watcher-disabled == 'true' && '-no-watcher' || '' }} path: ./apps/meteor/tests/e2e/.playwright* include-hidden-files: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index caa101124eb..8ae12a02ee7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -158,7 +158,7 @@ jobs: fi; curl -H "Content-Type: application/json" -H "X-Update-Token: $UPDATE_TOKEN" -d \ - "{\"nodeVersion\": \"${{ needs.release-versions.outputs.node-version }}\", \"denoVersion\": \"${{ needs.release-versions.outputs.deno-version }}\", \"compatibleMongoVersions\": [\"5\", \"6\", \"7\", \"8\"], \"commit\": \"$GITHUB_SHA\", \"tag\": \"$RC_VERSION\", \"branch\": \"$GIT_BRANCH\", \"artifactName\": \"$ARTIFACT_NAME\", \"releaseType\": \"draft\", \"draftAs\": \"$RC_RELEASE\"}" \ + "{\"nodeVersion\": \"${{ needs.release-versions.outputs.node-version }}\", \"denoVersion\": \"${{ needs.release-versions.outputs.deno-version }}\",\"compatibleMongoVersions\": [\"8.2\"], \"commit\": \"$GITHUB_SHA\", \"tag\": \"$RC_VERSION\", \"branch\": \"$GIT_BRANCH\", \"artifactName\": \"$ARTIFACT_NAME\", \"releaseType\": \"draft\", \"draftAs\": \"$RC_RELEASE\"}" \ https://releases.rocket.chat/update packages-build: @@ -543,7 +543,7 @@ jobs: release: ee transporter: 'nats://nats:4222' enterprise-license: ${{ needs.release-versions.outputs.enterprise-license }} - mongodb-version: "['5.0', '8.2']" + mongodb-version: "['8.2']" coverage: '8.2' node-version: ${{ needs.release-versions.outputs.node-version }} deno-version: ${{ needs.release-versions.outputs.deno-version }} @@ -565,7 +565,7 @@ jobs: enterprise-license: ${{ needs.release-versions.outputs.enterprise-license }} shard: '[1, 2, 3, 4, 5]' total-shard: 5 - mongodb-version: "['5.0']" + mongodb-version: "['8.2']" node-version: ${{ needs.release-versions.outputs.node-version }} deno-version: ${{ needs.release-versions.outputs.deno-version }} lowercase-repo: ${{ needs.release-versions.outputs.lowercase-repo }} @@ -963,7 +963,7 @@ jobs: fi; curl -H "Content-Type: application/json" -H "X-Update-Token: $UPDATE_TOKEN" -d \ - "{\"nodeVersion\": \"${{ needs.release-versions.outputs.node-version }}\", \"denoVersion\": \"${{ needs.release-versions.outputs.deno-version }}\", \"compatibleMongoVersions\": [\"5\", \"6\", \"7\", \"8\"], \"commit\": \"$GITHUB_SHA\", \"tag\": \"$RC_VERSION\", \"branch\": \"$GIT_BRANCH\", \"artifactName\": \"$ARTIFACT_NAME\", \"releaseType\": \"$RC_RELEASE\"}" \ + "{\"nodeVersion\": \"${{ needs.release-versions.outputs.node-version }}\", \"denoVersion\": \"${{ needs.release-versions.outputs.deno-version }}\", \"compatibleMongoVersions\": [\"8.2\"], \"commit\": \"$GITHUB_SHA\", \"tag\": \"$RC_VERSION\", \"branch\": \"$GIT_BRANCH\", \"artifactName\": \"$ARTIFACT_NAME\", \"releaseType\": \"$RC_RELEASE\"}" \ https://releases.rocket.chat/update # Makes build fail if the release isn't there diff --git a/apps/meteor/server/startup/serverRunning.js b/apps/meteor/server/startup/serverRunning.js index 7a1233bd29c..48ea4426f39 100644 --- a/apps/meteor/server/startup/serverRunning.js +++ b/apps/meteor/server/startup/serverRunning.js @@ -1,17 +1,17 @@ import fs from 'fs'; import path from 'path'; -import { Users } from '@rocket.chat/models'; +// import { Users } from '@rocket.chat/models'; import { Meteor } from 'meteor/meteor'; import semver from 'semver'; import { settings } from '../../app/settings/server'; import { Info } from '../../app/utils/rocketchat.info'; import { getMongoInfo } from '../../app/utils/server/functions/getMongoInfo'; -import { i18n } from '../lib/i18n'; +// import { i18n } from '../lib/i18n'; import { isRunningMs } from '../lib/isRunningMs'; -import { showErrorBox, showWarningBox, showSuccessBox } from '../lib/logger/showBox'; -import { sendMessagesToAdmins } from '../lib/sendMessagesToAdmins'; +import { showErrorBox, showSuccessBox } from '../lib/logger/showBox'; +// import { sendMessagesToAdmins } from '../lib/sendMessagesToAdmins'; const exitIfNotBypassed = (ignore, errorCode = 1) => { if (typeof ignore === 'string' && ['yes', 'true'].includes(ignore.toLowerCase())) { @@ -21,8 +21,8 @@ const exitIfNotBypassed = (ignore, errorCode = 1) => { process.exit(errorCode); }; -const skipMongoDbDeprecationCheck = ['yes', 'true'].includes(String(process.env.SKIP_MONGODEPRECATION_CHECK).toLowerCase()); -const skipMongoDbDeprecationBanner = ['yes', 'true'].includes(String(process.env.SKIP_MONGODEPRECATION_BANNER).toLowerCase()); +// const skipMongoDbDeprecationCheck = ['yes', 'true'].includes(String(process.env.SKIP_MONGODEPRECATION_CHECK).toLowerCase()); +// const skipMongoDbDeprecationBanner = ['yes', 'true'].includes(String(process.env.SKIP_MONGODEPRECATION_BANNER).toLowerCase()); Meteor.startup(async () => { const { oplogEnabled, mongoVersion, mongoStorageEngine } = await getMongoInfo(); @@ -78,8 +78,8 @@ Meteor.startup(async () => { exitIfNotBypassed(process.env.BYPASS_NODEJS_VALIDATION); } - if (semver.satisfies(semver.coerce(mongoVersion), '<5.0.0')) { - msg += ['', '', 'YOUR CURRENT MONGODB VERSION IS NOT SUPPORTED BY ROCKET.CHAT,', 'PLEASE UPGRADE TO VERSION 5.0 OR LATER'].join('\n'); + if (semver.satisfies(semver.coerce(mongoVersion), '<7.0.0')) { + msg += ['', '', 'YOUR CURRENT MONGODB VERSION IS NOT SUPPORTED BY ROCKET.CHAT,', 'PLEASE UPGRADE TO VERSION 7.0 OR LATER'].join('\n'); showErrorBox('SERVER ERROR', msg); exitIfNotBypassed(process.env.BYPASS_MONGO_VALIDATION); @@ -88,42 +88,42 @@ Meteor.startup(async () => { showSuccessBox('SERVER RUNNING', msg); // Deprecation - if (!skipMongoDbDeprecationCheck && semver.satisfies(semver.coerce(mongoVersion), '<6.0.0')) { - msg = [ - `YOUR CURRENT MONGODB VERSION (${mongoVersion}) IS DEPRECATED.`, - 'IT WILL NOT BE SUPPORTED ON ROCKET.CHAT VERSION 8.0.0 AND GREATER,', - 'PLEASE UPGRADE MONGODB TO VERSION 6.0 OR GREATER', - ].join('\n'); - showWarningBox('DEPRECATION', msg); + // if (!skipMongoDbDeprecationCheck && semver.satisfies(semver.coerce(mongoVersion), '<7.0.0')) { + // msg = [ + // `YOUR CURRENT MONGODB VERSION (${mongoVersion}) IS DEPRECATED.`, + // 'IT WILL NOT BE SUPPORTED ON ROCKET.CHAT VERSION 8.0.0 AND GREATER,', + // 'PLEASE UPGRADE MONGODB TO VERSION 6.0 OR GREATER', + // ].join('\n'); + // showWarningBox('DEPRECATION', msg); - const id = `mongodbDeprecation_${mongoVersion.replace(/[^0-9]/g, '_')}`; - const title = 'MongoDB_Deprecated'; - const text = 'MongoDB_version_s_is_deprecated_please_upgrade_your_installation'; - const link = 'https://go.rocket.chat/i/mongodb-deprecated'; + // const id = `mongodbDeprecation_${mongoVersion.replace(/[^0-9]/g, '_')}`; + // const title = 'MongoDB_Deprecated'; + // const text = 'MongoDB_version_s_is_deprecated_please_upgrade_your_installation'; + // const link = 'https://go.rocket.chat/i/mongodb-deprecated'; - if (!(await Users.bannerExistsById(id))) { - if (skipMongoDbDeprecationBanner || process.env.TEST_MODE) { - return; - } - sendMessagesToAdmins({ - msgs: async ({ adminUser }) => [ - { - msg: `*${i18n.t(title, adminUser.language)}*\n${i18n.t(text, { postProcess: 'sprintf', sprintf: [mongoVersion] }, adminUser.language)}\n${link}`, - }, - ], - banners: [ - { - id, - priority: 100, - title, - text, - textArguments: [mongoVersion], - modifiers: ['danger'], - link, - }, - ], - }); - } - } + // if (!(await Users.bannerExistsById(id))) { + // if (skipMongoDbDeprecationBanner || process.env.TEST_MODE) { + // return; + // } + // sendMessagesToAdmins({ + // msgs: async ({ adminUser }) => [ + // { + // msg: `*${i18n.t(title, adminUser.language)}*\n${i18n.t(text, { postProcess: 'sprintf', sprintf: [mongoVersion] }, adminUser.language)}\n${link}`, + // }, + // ], + // banners: [ + // { + // id, + // priority: 100, + // title, + // text, + // textArguments: [mongoVersion], + // modifiers: ['danger'], + // link, + // }, + // ], + // }); + // } + // } }, 100); });