Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BREAK] Remove support of MongoDB 3.2 and deprecate MongoDB 3.4 #15199

Merged
merged 5 commits into from
Aug 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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