kalisio / feathers-distributed

Distribute your Feathers services as microservices

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Initialization delay before starting cote

claustres opened this issue · comments

Steps to reproduce

Deploy 2 apps with a healthcheck bound to the server API on a Docker swarm using a Redis discovery.

Expected behavior

Cote should be able to initialize.

Actual behavior

Cote is not able to initialize correctly and raises unhandled error. It seems that until the healthcheck has passed the container hostname are not routable so that when an app is advertised we get errors like Error: getaddrinfo ENOTFOUND 28c5d24e6d1e 28c5d24e6d1e:10000 in the other app (28c5d24e6d1e is the container ID which is also the hostname of the advertised app in the docker overlay network).

However, for the healthcheck to succeed the app needs to be launched, which also launches cote, which then tries to resolve names using DNS, a serpent biting its own tail !

A way to solve this could be to update the architecture so that we can add a small delay before initializing cote so that we ensure the healthcheck has passed.

System configuration

Module versions (especially the part that's not working): 0.6

NodeJS version: 8.16

Operating System: Linux debian

Tested on staging environment.