dashersw / cote

A Node.js library for building zero-configuration microservices.

Home Page:http://cote.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Discovery not working

ne0c0de opened this issue · comments

Hi,

I'm using cote on my native nodejs project which is working without any docker or kubernetes (just running it with pm2 on Ubuntu 18)

It's working as normal in AWS EC2 servers but when I tried to start same process with some version node_modules version on Vultr cloud servers, the services is not connecting to each other (Requested and Responders aren't matched.)

this is result of ifconfig command on Vultr machine:

enp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet aa.bb.ccc.ddd  netmask 255.255.254.0  broadcast aa.bb.ccc.255
        inet6 fd80::5400:3df:fdfb:39dc  prefixlen 64  scopeid 0x20<link>
        ether 56:00:03:fd:39:dc  txqueuelen 1000  (Ethernet)
        RX packets 2848909  bytes 1289495098 (1.2 GB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2950638  bytes 235336699 (235.3 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp6s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1450
        inet xx.yy.zzz.qq  netmask 255.255.240.0  broadcast xx.yy.aaa.255
        inet6 fd80::5800:3df:fdfb:39dc  prefixlen 64  scopeid 0x20<link>
        ether 5a:00:03:fd:39:dc  txqueuelen 1000  (Ethernet)
        RX packets 11  bytes 830 (830.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 23  bytes 1706 (1.7 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 2187997  bytes 620515769 (620.5 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2187997  bytes 620515769 (620.5 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp1s0 is public interface
enp6s0 is private (internal) interface

I tried to use cote like this:

const cote = require('cote')({ broadcast: 'xx.yy.zzz.qq' }) // with internal ip

But with this case only 2 process is connecting each other (whereas my project has 5 different process which each of them connecting to another one with different Requester-Responsed relationship) and it's only working if I start responded first and requester after.

What kind of problem is this?

Also I will appreciate if someone can explain me what I need to write for broadcast or multicast properties if I want to use them (internal ip, subnet or broadcast (where I think that it will be router ip))

Thanks

I tried almost all options but didn't get success and finally i switch to redis mode to get all process working...

Try updating these variables in your .env file

COTE_DISCOVERY_REDIS_HOST=redis
COTE_DISCOVERY_REDIS_URL=redis://your-redis-url
COTE_DISCOVERY_REDIS_PORT=6379
DISCOVERY_HOSTNAME=your-public-IPV4-address.