Closed theslyone closed 6 years ago
Hello @theslyone
First off, thanks and congrats on the first part! Most folks probably don't get that far.
If I understand your last question the answer might be that a Docker swarm uses a service mesh to map IPs/Ports. That allows you to run multiple instances of the hello-service on a single machine despite that each is using the same port. And if you use a random port for your hello-service hydra will bind to a random port and report that one to Redis. So traffic arriving through hydra-router will use the registered hello-service instance data to route. Both cases work great.
https://docs.docker.com/engine/swarm/ingress/
Regarding your problem of not being able to reach a hello-service endpoint: are you saying you can't reach: http://{hydrarouter}/v1/hello/{endpoint} or have you altered the routes in anyway?
Hi @cjus ,
Thank you for that clarification.
I simply pulled and deployed the demo hello-service from cjus/hello-service:0.0.2 into the worker nodes in the docker swarm. The hydra router is configured to listen on port 80 and http://{hydrarouter}/v1/router/list/services for example successfully lists the hydra router and hello-service but any endpoint on the hello-service for example http://{hydrarouter}/v1/hello/{endpoint} always returns a 404.
I have also pushed a config.json for hello-service:0.0.2 into my redis instance already but the hydra router is definitely not routing requests through.
The cjus/hello-service:0.0.2 container is pretty old. There are much newer versions available: https://hub.docker.com/r/cjus/hello-service/tags/
A service root path /v1/hello
has special meaning in hydrarouter. It's the endpoint where a website can be served from. Can you try a newer hello-service container?
Here are some of the test routes available: https://github.com/cjus/hello-service/blob/master/routes/hello-v1-routes.js
Issue resolved, many thanks.
I hadn't configured UDP access for communication among nodes in the aws docker-machine security group.
Hi there,
Excellent work here, i have followed the https://community.risingstack.com/using-docker-swarm-for-deploying-nodejs-microservices/ guide and currently have hydra-router and the hello-service running in a docker cluster on aws.
All routes on the hydra-router give response as required but a request to any of the hello-service endpoint doesn't get through for reasons i'm not quite sure of. I have checked the docker logs to ensure that the services are indeed running without error. The docker image cjus/hello-service:0.0.2 exposes port 5000 by default and i'm not certain how the dynamic servicePort in the hello-service config file is accessible if the container doesn't expose this explicitly.
Please kindly advice, thank you.