How to deploy microservices on Heroku

吃可爱长大的小学妹 提交于 2019-11-29 22:29:58
rdegges

Heroku is a very simple Platform-as-a-Service company. The way Heroku works is very straightforward:

  • You have multiple projects (services) in Git repos.
  • You create a Heroku app for each project (each Git repo).
  • You then push your code from each Git repo to their respective Heroku app.
  • Heroku assigns you a public URL for each app you have.
  • If each of your services is now running on Heroku, they can send API requests to each other over public HTTPs.

Now -- regarding your question about service oriented architecture on Heroku.

If you're doing SOA on Heroku, you'll need to have each service talk publicly with each other over HTTPS. This is the typical 'pattern'.

Because Heroku provides free SSL for each application, and each application is on the same Amazon region -- talking back-and-fourth between your services over HTTPs is very fast + secure.

Each Heroku app has automatic load balancing, so no need to worry about load balancers.

The next option here (if you don't want to follow the typical patterns) is to use something like RabbitMQ or Amazon SQS (a queueing service), and share 'messages' between your different services.

In this pattern, you would still have one Heroku app for each service, but instead of communicating with each other over HTTPs, you would instead communicate with your other services through a queueing protocol like Rabbit or SQS. This has some speed benefits.

In regards to authentication services, there are several providers you can use to provide this functionality. The most popular one I know of is Stormpath. If you look through the Heroku addon marketplace, you can find others as well.

Finally, for database stuff: you can use any Database provider you want. The most popular one is likely Heroku Postgres. It's a hosted version of PostgreSQL that's very reliable / easy to use.

You can either share one database amongst ALL your services, or you can have one databases per service. Either strategy will work fine.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!