Skip to content

Commit

Permalink
[BREAK] Remove support of MongoDB 3.2 and deprecate MongoDB 3.4 (#15199)
Browse files Browse the repository at this point in the history
  • Loading branch information
sampaiodiego committed Aug 19, 2019
1 parent f36c2bd commit 56b01a7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
15 changes: 3 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
<<: *defaults
docker:
- image: circleci/node:8.11-stretch
- image: mongo:3.2
- image: mongo:3.4

steps:
- checkout
Expand Down Expand Up @@ -184,13 +184,6 @@ jobs:
path: /tmp/build


test-with-oplog-mongo-3-2:
<<: *test-with-oplog
docker:
- image: *test-docker-image
- image: mongo:3.2
command: [mongod, --noprealloc, --smallfiles, --replSet=rs0]

test-with-oplog-mongo-3-4:
<<: *test-with-oplog
docker:
Expand Down Expand Up @@ -446,25 +439,23 @@ workflows:
filters:
tags:
only: /^[0-9]+\.[0-9]+\.[0-9]+(?:-(?:rc|beta)\.[0-9]+)?$/
- test-with-oplog-mongo-3-2: &test-mongo
- test-with-oplog-mongo-3-4: &test-mongo
requires:
- build
filters:
tags:
only: /^[0-9]+\.[0-9]+\.[0-9]+(?:-(?:rc|beta)\.[0-9]+)?$/
- test-with-oplog-mongo-3-4: &test-mongo-no-pr
- test-with-oplog-mongo-3-6: &test-mongo-no-pr
requires:
- build
filters:
branches:
only: develop
tags:
only: /^[0-9]+\.[0-9]+\.[0-9]+(?:-(?:rc|beta)\.[0-9]+)?$/
- test-with-oplog-mongo-3-6: *test-mongo-no-pr
- test-with-oplog-mongo-4-0: *test-mongo
- deploy:
requires:
- test-with-oplog-mongo-3-2
- test-with-oplog-mongo-3-4
- test-with-oplog-mongo-3-6
- test-with-oplog-mongo-4-0
Expand Down
22 changes: 15 additions & 7 deletions server/startup/serverRunning.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ import { settings } from '../../app/settings';
import { Info, getMongoInfo } from '../../app/utils';
import { Roles, Users } from '../../app/models/server';

const exitIfNotBypassed = (ignore, errorCode = 1) => {
if (typeof ignore === 'string' && ['yes', 'true'].includes(ignore.toLowerCase())) {
return;
}

process.exit(errorCode);
};

Meteor.startup(function() {
const { oplogEnabled, mongoVersion, mongoStorageEngine } = getMongoInfo();

Expand Down Expand Up @@ -42,28 +50,28 @@ Meteor.startup(function() {
msg += ['', '', 'OPLOG / REPLICASET IS REQUIRED TO RUN ROCKET.CHAT, MORE INFORMATION AT:', 'https://go.rocket.chat/i/oplog-required'].join('\n');
SystemLogger.error_box(msg, 'SERVER ERROR');

return process.exit(1);
exitIfNotBypassed(process.env.BYPASS_OPLOG_VALIDATION);
}

if (!semver.satisfies(process.versions.node, desiredNodeVersionMajor)) {
msg += ['', '', 'YOUR CURRENT NODEJS VERSION IS NOT SUPPORTED,', `PLEASE UPGRADE / DOWNGRADE TO VERSION ${ desiredNodeVersionMajor }.X.X`].join('\n');
SystemLogger.error_box(msg, 'SERVER ERROR');

return process.exit(1);
exitIfNotBypassed(process.env.BYPASS_NODEJS_VALIDATION);
}

if (!semver.satisfies(semver.coerce(mongoVersion), '>=3.2.0')) {
msg += ['', '', 'YOUR CURRENT MONGODB VERSION IS NOT SUPPORTED,', 'PLEASE UPGRADE TO VERSION 3.2 OR LATER'].join('\n');
if (!semver.satisfies(semver.coerce(mongoVersion), '>=3.4.0')) {
msg += ['', '', 'YOUR CURRENT MONGODB VERSION IS NOT SUPPORTED,', 'PLEASE UPGRADE TO VERSION 3.4 OR LATER'].join('\n');
SystemLogger.error_box(msg, 'SERVER ERROR');

return process.exit(1);
exitIfNotBypassed(process.env.BYPASS_MONGO_VALIDATION);
}

SystemLogger.startup_box(msg, 'SERVER RUNNING');

// Deprecation
if (!semver.satisfies(semver.coerce(mongoVersion), '>=3.4.0')) {
msg = [`YOUR CURRENT MONGODB VERSION (${ mongoVersion }) IS DEPRECATED.`, 'IT WILL NOT BE SUPPORTED ON ROCKET.CHAT VERSION 2.0.0 AND GREATER,', 'PLEASE UPGRADE MONGODB TO VERSION 3.4 OR GREATER'].join('\n');
if (!semver.satisfies(semver.coerce(mongoVersion), '>=3.6.0')) {
msg = [`YOUR CURRENT MONGODB VERSION (${ mongoVersion }) IS DEPRECATED.`, 'IT WILL NOT BE SUPPORTED ON ROCKET.CHAT VERSION 4.0.0 AND GREATER,', 'PLEASE UPGRADE MONGODB TO VERSION 3.6 OR GREATER'].join('\n');
SystemLogger.deprecation_box(msg, 'DEPRECATION');

const id = `mongodbDeprecation_${ mongoVersion.replace(/[^0-9]/g, '_') }`;
Expand Down

0 comments on commit 56b01a7

Please sign in to comment.