Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 2s
132 lines
4.5 KiB
TypeScript
132 lines
4.5 KiB
TypeScript
import crypto from 'node:crypto';
|
|
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
|
|
import { License } from '@rocket.chat/license';
|
|
// import { Users } from '@rocket.chat/models';
|
|
import { Meteor } from 'meteor/meteor';
|
|
import semver from 'semver';
|
|
|
|
import { Info } from '../../app/utils/rocketchat.info';
|
|
import { showErrorBox, showSuccessBox, showWarningBox } from '../lib/logger/showBox';
|
|
import { getMongoInfo } from '../lib/utils/functions/getMongoInfo';
|
|
// import { i18n } from '../lib/i18n';
|
|
// import { isRunningMs } from '../lib/isRunningMs';
|
|
// import { sendMessagesToAdmins } from '../lib/sendMessagesToAdmins';
|
|
import { settings } from '../settings';
|
|
|
|
const exitIfNotBypassed = (ignore: string | undefined, errorCode = 1) => {
|
|
if (typeof ignore === 'string' && ['yes', 'true'].includes(ignore.toLowerCase())) {
|
|
return;
|
|
}
|
|
|
|
process.exit(errorCode);
|
|
};
|
|
|
|
const skipMongoDbDeprecationCheck =
|
|
['yes', 'true'].includes(String(process.env.SKIP_MONGODEPRECATION_CHECK).toLowerCase()) ||
|
|
process.env.TEST_MODE === 'true' ||
|
|
process.env.TEST_MODE === 'api' ||
|
|
process.env.NODE_ENV === 'development';
|
|
// const skipMongoDbDeprecationBanner = ['yes', 'true'].includes(String(process.env.SKIP_MONGODEPRECATION_BANNER).toLowerCase());
|
|
|
|
Meteor.startup(async () => {
|
|
const { mongoVersion, mongoStorageEngine } = await getMongoInfo();
|
|
|
|
const desiredNodeVersion = semver.clean(fs.readFileSync(path.join(process.cwd(), '../../.node_version.txt')).toString());
|
|
const parsedSemVer = semver.parse(desiredNodeVersion);
|
|
if (!parsedSemVer) {
|
|
console.error('Failed to parse desired Node.js version from .node_version.txt');
|
|
process.exit(1);
|
|
}
|
|
|
|
const desiredNodeVersionMajor = String(parsedSemVer.major);
|
|
|
|
return setTimeout(async () => {
|
|
let msg: string | string[] = [
|
|
`Rocket.Chat Version: ${Info.version}`,
|
|
` NodeJS Version: ${process.versions.node} - ${process.arch}`,
|
|
` MongoDB Version: ${mongoVersion}`,
|
|
` MongoDB Engine: ${mongoStorageEngine}`,
|
|
` Platform: ${process.platform}`,
|
|
` Process Port: ${process.env.PORT}`,
|
|
` Site URL: ${settings.get<string>('Site_Url')}`,
|
|
` Hashed Site URL: ${License.getHashedWorkspaceUrl()}`,
|
|
` OpenSSL Version: ${process.versions.openssl}`,
|
|
` FIPS Provider: ${crypto.getFips() ? 'Enabled' : 'Disabled'}`,
|
|
];
|
|
|
|
if (Info.commit?.hash) {
|
|
msg.push(` Commit Hash: ${Info.commit.hash.substr(0, 10)}`);
|
|
}
|
|
|
|
if (Info.commit?.branch) {
|
|
msg.push(` Commit Branch: ${Info.commit.branch}`);
|
|
}
|
|
|
|
msg = msg.join('\n');
|
|
|
|
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');
|
|
showErrorBox('SERVER ERROR', msg);
|
|
|
|
exitIfNotBypassed(process.env.BYPASS_NODEJS_VALIDATION);
|
|
}
|
|
|
|
const mongoSemver = semver.coerce(mongoVersion);
|
|
|
|
if (!mongoSemver || semver.satisfies(mongoSemver, '<7.0.0')) {
|
|
msg += ['', '', 'YOUR CURRENT MONGODB VERSION IS NOT SUPPORTED BY ROCKET.CHAT,', 'PLEASE UPGRADE TO VERSION 8.0 OR LATER'].join('\n');
|
|
showErrorBox('SERVER ERROR', msg);
|
|
|
|
exitIfNotBypassed(process.env.BYPASS_MONGO_VALIDATION);
|
|
}
|
|
|
|
showSuccessBox('SERVER RUNNING', msg);
|
|
|
|
// Deprecation
|
|
if (!skipMongoDbDeprecationCheck && semver.satisfies(semver.coerce(mongoVersion)!, '<8.0.0')) {
|
|
msg = [
|
|
`DEPRECATED: MONGODB VERSION ${mongoVersion}.`,
|
|
'SUPPORT FOR MONGODB <8.0 WILL BE REMOVED IN ROCKET.CHAT 9.0.0',
|
|
'PLEASE UPGRADE MONGODB TO VERSION 8.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';
|
|
|
|
// 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);
|
|
});
|