Multitple RC instances with docker-compose

Description

Hi!
After migration from multi-instance manual (from zip) to multi-docker scheme - got problems with RC notification and sound playing (when new message comes).

Some research:
When user1 send message to user2 connected on same NODEJS backend - evething work correct.
But when users connected to different nodejs-backend - sounds and notification does not work

How to solve problem ? Any suggestions to check config rocket\docker\mongo\oplog ?

Server Setup Information

  • Version of Rocket.Chat Server: 3.12.1
  • Operating System: Ubuntu 20
  • Deployment Method: docker
  • Number of Running Instances: 8
  • DB Replicaset Oplog: Enabled rs01
  • NodeJS Version: 12.18.4 - x64
  • MongoDB Version: 4.0.21
  • Proxy: nginx
  • Firewalls involved: no

Any additional Information

Docker-compose
version: ‘3.3’

services:
  mongo:
    image: mongo:4.0.21
    restart: unless-stopped
    volumes:
     - /var/lib/mongodb:/data/db
     - /mnt/backup:/mnt/backup
    command: mongod --smallfiles --oplogSize 990 --replSet rs01 --storageEngine=wiredTiger


  rocketchat1:
    image: rocketchat/rocket.chat:3.12.1
    command: >
      bash -c
        "for i in `seq 1 30`; do
          node main.js &&
          s=$$? && break || s=$$?;
          echo \"Tried $$i times. Waiting 5 secs...\";
          sleep 5;
        done; (exit $$s)"
    restart: unless-stopped
    volumes:
     - /mnt/rocketchat/share:/app/uploads
    environment:
      - PORT=3001
      - ROOT_URL=http://localhost:3001
      - MONGO_URL=mongodb://mongo:27017/rocketchat?replicaSet=rs01
      - MONGO_OPLOG_URL=mongodb://mongo:27017/local?replicaSet=rs01
    depends_on:
      - mongo
    ports:
      - "127.0.0.1:3001:3001"

  rocketchat2:
    image: rocketchat/rocket.chat:3.12.1
    command: >
      bash -c
        "for i in `seq 1 30`; do
          node main.js &&
          s=$$? && break || s=$$?;
          echo \"Tried $$i times. Waiting 5 secs...\";
          sleep 5;
        done; (exit $$s)"
    restart: unless-stopped
    volumes:
     - /mnt/rocketchat/share:/app/uploads
    environment:
      - PORT=3002
      - ROOT_URL=http://localhost:3002
      - MONGO_URL=mongodb://mongo:27017/rocketchat?replicaSet=rs01
      - MONGO_OPLOG_URL=mongodb://mongo:27017/local?replicaSet=rs01
    depends_on:
      - mongo
    ports:
      - "127.0.0.1:3002:3002"

and etc...

NGINX:
upstream backend {
server 127.0.0.1:3001;
server 127.0.0.1:3002;
server 127.0.0.1:3003;
server 127.0.0.1:3004;
server 127.0.0.1:3005;
server 127.0.0.1:3006;
server 127.0.0.1:3007;
server 127.0.0.1:3008;
}

server {
        listen MY_PUBLIC_IP:80 default_server;
        server_name *.domain.my;

        location / {
           rewrite ^(.*) https://rocket.domain.my permanent;
       }
}

server {
        listen MY_PUBLIC_IP:443 default_server ssl;
        server_name rocket.domain.my;

        ssl on;
        ssl_certificate /etc/nginx/ssl.crt/domain.my.crt;
        ssl_certificate_key /etc/nginx/ssl.key/domain.my.key;
        include ssl.conf;

        location / {
                proxy_pass http://backend;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_set_header Host $http_host;

                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forward-Proto https;
                proxy_set_header X-Nginx-Proxy true;

                proxy_redirect off;
        }
}

Solved by specifiy ENV var INSTANCE_IP=rocketchatX .

  rocketchat1:
    image: rocketchat/rocket.chat:3.12.1
    command: >
      bash -c
        "for i in `seq 1 30`; do
          node main.js &&
          s=$$? && break || s=$$?;
          echo \"Tried $$i times. Waiting 5 secs...\";
          sleep 5;
        done; (exit $$s)"
    restart: unless-stopped
    volumes:
     - /mnt/rocketchat/share:/app/uploads
    environment:
      - PORT=3000
      - INSTANCE_IP=rocketchat1
      - ROOT_URL=http://rocket.domain.my
      - MONGO_URL=mongodb://mongo:27017/rocketchat?replicaSet=rs01
      - MONGO_OPLOG_URL=mongodb://mongo:27017/local?replicaSet=rs01
    depends_on:
      - mongo
    ports:
      - "127.0.0.1:3001:3000"

  rocketchat2:
    image: rocketchat/rocket.chat:3.12.1
    command: >
      bash -c
        "for i in `seq 1 30`; do
          node main.js &&
          s=$$? && break || s=$$?;
          echo \"Tried $$i times. Waiting 5 secs...\";
          sleep 5;
        done; (exit $$s)"
    restart: unless-stopped
    volumes:
     - /mnt/rocketchat/share:/app/uploads
    environment:
      - PORT=3000
      - INSTANCE_IP=rocketchat2
      - ROOT_URL=http://rocket.domain.my
      - MONGO_URL=mongodb://mongo:27017/rocketchat?replicaSet=rs01
      - MONGO_OPLOG_URL=mongodb://mongo:27017/local?replicaSet=rs01
    depends_on:
      - mongo
    ports:
      - "127.0.0.1:3002:3000"