如何正确地将前端应用部署到GCE(Google Compute Engine)?

huangapple go评论95阅读模式
英文:

How to deploy frontend application to GCE properly?

问题

这里的问题是:我有一个由前端部分(使用VueJS编写)和后端部分(使用Go编写的API服务)组成的Web应用程序。

在GCE上部署这种类型的应用程序的最简单和正确的方法是什么?Web应用程序必须能够提供HTTPS服务。

在AWS世界中,我可以将前端部分部署到支持HTTPS的S3上,然后将Go API部署到ElasticBeanstalk上,例如。在GCE世界中,有Cloud Storage Standard,它也支持提供静态内容(因此我可以将VueJS部分部署到那里),但它不支持HTTPS。

还有Firebase,它支持HTTPS,但我只能使用Google Cloud Functions作为后端部分,这意味着整个后端部分必须重新设计。

有什么解决这个问题的模式吗?或者也许我完全错了,需要以不同的方式来看待它?

英文:

Here's the problem: I have a web application consisting of frontend part (written in VueJS) and backend part (API service written in Go).

What's the simplest and proper way to deploy such kind of application to GCE? The web application must be able to serve HTTPS.

In AWS world I could deploy frontend part to S3 (which supports HTTPS) and then deploy Go API to ElasticBeanstalk, for example. In GCE world there is Cloud Storage Standard that also supports serving static content (so I can deploy my VueJS part there), but it does not support HTTPS.

There is also Firebase, that supports HTTPS, but the only backend part I can use with that is Google Cloud Functions which means the whole backend part must be reworked.

Any idea what pattern I can use here to solve the problem? Or maybe I'm totally wrong and need to take a different look at it?

答案1

得分: 0

Firebase是在Google基础设施上部署前端的最简单方法。它会为您处理证书的提供,因此您可以直接获得HTTPS。我不确定您为什么认为Cloud Functions是您唯一可以与之配合使用的后端。您可以使用任何您喜欢的后端,包括Amazon的ElasticBeanstalk。我同时使用Firebase前端和App Engine以及Compute Engine后端。

您也可以按照“旧的方式”(当App Engine是Google唯一的云服务提供时)进行部署,将前端部署到App Engine上;它可以很好地处理静态内容。

没有一种单一正确的方法。您有很多选择,选择一种服务来提供前端内容并不会限制您选择运行后端的选择。

英文:

Firebase is the simplest way to deploy your frontend on Google's infrastructure. It handles certificate provisioning for you, so you get HTTPS out of the box. I'm not sure why you think Cloud Functions is the only backend you can use with it. You can use any backend you like, including Amazon's ElasticBeanstalk. I use both App Engine and Compute Engine backends with a Firebase frontend.

You could also do it the "old way" (how it was done when App Engine was Google's only cloud offering), and deploy your frontend to App Engine; it handles static content just fine.

There's not a single right way to do it. Your options are vast, and choosing one service to serve your frontend content in no way limits your choice for running your backend.

huangapple
  • 本文由 发表于 2017年7月16日 12:50:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/45125118.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定