I am deploying consul on a baremetal environment and before jumping in I have a question.
What is a Service ?
Considering I have an Application named “App-1” with a frontend, backend and a database. What is the best practice for registering it ?
Do I group everything under “App-1” ?
--------- | frontend
--------- | backend
--------- | database
or do I register service independently ?
-------------- | frontend
-------------- | database
A service is a thing that a human or other piece of code wants to look up the location of, and connect to.
“Please find me a frontend to connect to” makes sense.
“Please find me a frontend, backend or database to connect to, I don’t care which” does not make sense.
Therefore “app-1-frontend” is a good service name, and “app-1” is a bad one.
Thanks for your answers.
Service’s ID should be app-1-frontend. I’m ok with this.
But what should be the name of it ?
Should it be app-1 with every instance of frontend, backend and database under it ?
Or should I have three different service name (app-1-frontend, app-1-backend, app-1-database) ?
Just find out that consul’s DNS is using Service Name and not ID.
I understand what you mean now, a service called “app-1” is useless cause it will return the frontend, backend and database.