简体   繁体   English

将多服务应用程序部署到云提供商

[英]Deploying a multi-service app to a cloud provider

There are several tutorials on how to deploy a containerized service to the cloud: AWS, Google Cloud Platform, Heroku, and many others all have nice tutorials on how to do this.有几个关于如何将容器化服务部署到云的教程:AWS、谷歌云平台、Heroku 和许多其他人都有关于如何做到这一点的很好的教程。

However, most real-world apps are made of two or more services (for example a database + a web server), rather than just one service.然而,大多数现实世界的应用程序是由两个或多个服务组成的(例如一个数据库 + 一个 web 服务器),而不仅仅是一个服务。

Is it bad practice to deploy the various services of a multi-service app to different clusters (eg deploy the database to a GKE cluster, and the web server to another GKE cluster)?将多服务应用程序的各种服务部署到不同的集群是不好的做法(例如,将数据库部署到 GKE 集群,将 web 服务器部署到另一个 GKE 集群)? I'm asking this because I am finding it very difficult to deploy a simple web app to a single cluster, while I was expecting that once I set up my Dockerfile s and docker-compose.yml everything would work out-of-the-box (as advertised by the documentations of Docker Compose and Kubernetes) and I would be able to have a small cluster with 1 container for my database and 1 container for my web server.我问这个是因为我发现很难将简单的 web 应用程序部署到单个集群,而我期待一旦我设置了Dockerfile和 ZBAEDB53E845AE71F13945FCC00572AE- docker-compose.yml一切都会正常工作。正如 Docker Compose 和 Kubernetes 的文档所宣传的那样),我将能够拥有一个小型集群,其中有 1 个容器用于我的数据库,1 个容器用于我的 web 服务器。

So my questions are:所以我的问题是:

  • Is it bad practice to deploy the various services of a multi-service app to different clusters?将多服务应用程序的各种服务部署到不同的集群是不好的做法吗?
  • What is, in general, the de-facto standard way to deploy a web app with a database and a web server to the cloud?一般来说,将带有数据库和 web 服务器的 web 应用程序部署到云的事实上的标准方法是什么? What are the easiest tools to achieve this?实现这一目标的最简单工具是什么?
  • Practically, what is the simplest way I can deploy a React + Express + MongoDB app to any cloud provider with a free-tier account?实际上,我可以将 React + Express + MongoDB 应用程序部署到任何具有免费层帐户的云提供商的最简单方法是什么?

Deploying multiple services (AKA applications) that shares some logic between them on the same cluster/namespace is actually the best practice.在同一个集群/命名空间上部署多个共享逻辑的服务(AKA 应用程序)实际上是最佳实践。 I am not sure why you find it difficult, but you could take a container orchestrator platform, such as Kubernetes and deploy as many applications as you want - in the same project on the same cluster.我不确定您为什么会觉得困难,但您可以使用容器编排平台,例如 Kubernetes,并在同一个集群上的同一个项目中部署任意数量的应用程序。

I would recommend getting into a cloud platfrom that serves a Container Orchestrator such as Google Container Engine of Google Cloud Platform (or any other cloud platform you want) and start exploring around.我建议进入一个为容器编排器提供服务的云平台,例如 Google Cloud Platform 的 Google Container Engine(或您想要的任何其他云平台)并开始探索。 You can also read about containers overall or Kubernetes .您还可以阅读有关容器整体或Kubernetes的信息。

So, practically speaking, I would probably create MongoDB and the express app inside the same namespace (and every other service or application related to the project on another container within the same namespace).因此,实际上,我可能会在同一命名空间内创建 MongoDB 和 express 应用程序(以及在同一命名空间内的另一个容器上与项目相关的所有其他服务或应用程序)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM