0

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).

1 Answers1

1

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.

halfer
  • 19,824
  • 17
  • 99
  • 186
Beppe C
  • 11,256
  • 2
  • 19
  • 41
  • Hi beppe I will give you and answer soon and I will make a draw about what I need to see if it's possible to deploy it on heroku, but basically it's the typical microservices architecture. – Gabriel García Garrido May 14 '20 at 23:21
  • It will be possible to create an api gateway that will be the only one with a port open and the rest of microservice as workers? in such way the api gateway is the only microservice which receives the request and redirects INTERNALLY to the others – Gabriel García Garrido Sep 09 '20 at 13:11
  • If you use Heroku I dont think it is possible, a worker has no connectivity (only running in the background) and Heroku doesnt distinguish between internal and external network. If you want to apply the Gateway pattern you might want to use Digital Ocean (it not free - cheap however - and you have control of which services are exposed) – Beppe C Sep 09 '20 at 15:28