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

chore: makes instance-status works along with Moleculer lifecyle #34134

Merged
merged 16 commits into from
Dec 17, 2024

Conversation

ricardogarim
Copy link
Contributor

@ricardogarim ricardogarim commented Dec 6, 2024

Proposed changes (including videos or screenshots)

This PR removes the use of MongoDB Change Streams on instance-status package. The removal of Change Stream items is part of an initiative started earlier this year, but resources related to instance-status were still pending.

instance-status is responsible for ensuring the connection and heartbeat between instances in a multi-instance monolithic Rocket.Chat deployment.

Since the Moleculer framework is already in use, we moved the lifecycle management of connections to it, such as node initialization, listing, etc.

As a result, it is no longer necessary to ping MongoDB and wait for a Change Stream notification to interpret a given node as valid.

The same timeout and heartbeat interval rules have been added to Moleculer:

  • heartbeatInterval: process.env.MULTIPLE_INSTANCES_PING_INTERVAL || 10
  • heartbeatTimeout: process.env.MULTIPLE_INSTANCES_EXPIRE || Math.ceil((defaultPingInterval * 3) / 60) * 60

Issue(s)

Steps to test or reproduce

To validate these changes, you will need to run a multi-instance monolithic Rocket.Chat deployment.

Navigate to the apps/meteor directory and run the following command to start the first instance:

cd apps/meteor
TEST_MODE=true CI=true DISABLE_DB_WATCHERS=true meteor

Navigate to the build directory and execute the following:

cd ./apps/meteor/.meteor/local/build
cd .. && cd build && MONGO_URL=mongodb://localhost:3001/meteor INSTANCE_IP=localhost ROOT_URL=http://localhost:3000 PORT=3030 TEST_MODE=true DB_WATCHERS_DISABLED=true node main.js

This setup runs multi-instance communication using the TCP transporter. If you prefer to use NATS, you’ll need to include the NATS_TRANSPORTER environment variable. However, the changes primarily affect TCP connections.

Further comments

Copy link
Contributor

dionisio-bot bot commented Dec 6, 2024

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

Copy link
Contributor

github-actions bot commented Dec 6, 2024

PR Preview Action v1.4.8
🚀 Deployed preview to https://RocketChat.github.io/Rocket.Chat/pr-preview/pr-34134/
on branch gh-pages at 2024-12-17 15:55 UTC

Copy link

codecov bot commented Dec 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.83%. Comparing base (1a11303) to head (adb41b3).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop   #34134   +/-   ##
========================================
  Coverage    75.83%   75.83%           
========================================
  Files          511      511           
  Lines        22171    22171           
  Branches      5397     5397           
========================================
  Hits         16813    16813           
  Misses        4710     4710           
  Partials       648      648           
Flag Coverage Δ
unit 75.83% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Copy link

changeset-bot bot commented Dec 6, 2024

⚠️ No Changeset found

Latest commit: adb41b3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ricardogarim ricardogarim added this to the 7.2.0 milestone Dec 9, 2024
@ricardogarim ricardogarim marked this pull request as ready for review December 9, 2024 11:11
@ricardogarim ricardogarim requested review from a team as code owners December 9, 2024 11:11
@ricardogarim ricardogarim added the stat: QA assured Means it has been tested and approved by a company insider label Dec 17, 2024
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Dec 17, 2024
@kodiakhq kodiakhq bot merged commit 7edc3db into develop Dec 17, 2024
49 checks passed
@kodiakhq kodiakhq bot deleted the chore/instance-status-out-of-db-watcher branch December 17, 2024 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants