Issue
I would like to know if it is possible to deploy several "web dynos" microservices (spring boot apps) in the same app in heroku.
I have an app that is compose by several microservices and they also "talk" each others. I was able to deploy a docker container in heroku naming it as "web", there is a post where I solve it:
Heroku docker spring boot image error 503 H14
now the problem is that if I only can deploy one web dynos in a app, i have to create several apps to deploy one of each microservice. One of the microservice is the api gateway that is the only one that must be exposes to internet (I have read something about workers that can run in the same app but are not exposed or something like that, I dont have understood this behaiviour)
If it is not possible another problem is that my microservices connect to the database with the environment property that heroku creates in each app so I will have to manually write in each microservice the URL of the another app database instead of the automatic connection that I have code And it perfecty works for the microservice that is deploy in the app with the database.
Another question if it is not possible is, can I send request for one service to another by using a name or something like that as kubernetes does?
Thank you in advance and sorry for my english (I am spanish).
Solution
Yes, one HTTP port per web process so each service is one Heroku application, no workaround here
Workers are background jobs which do not require external connectivity (ie fetch from a queue, do the work, write result somewhere), so in your case it doesn't work as the service need to talk to each other (even if only internally)
About databases: if this is an Heroku-managed DB (or Redis) I believe the URL is then injected automatically by Heroku as Config Val, in this case all services can use the same one.
About services connectivity: once you deploy a service Heroku assigns a dedicate URL(ie https://{appName}.herokuapp.com/). It doesn't change it so you can use this as host for the REST calls.
Answered By - Beppe C
Answer Checked By - Mary Flores (JavaFixing Volunteer)