[英]Google App Engine - Front and Backend Web Development
I currently manage a cluster of VMs on a number of dedicated hosts to provide apache, nginx and node live and development servers. 我目前在许多专用主机上管理一组VM,以提供apache,nginx和节点实时和开发服务器。 This of course requires constant and time consuming maintenance to ensure security and reliability.
这当然需要持续且耗时的维护以确保安全性和可靠性。 I've found more time is spent looking after this platform then coding new and exciting projects.
我发现花更多的时间来处理这个平台,然后编写新的令人兴奋的项目。 So I've been looking into the Google App Engine to remove the need of managing any VMs but I'm struggling to work out how to get it to function for me!
因此,我一直在研究Google App Engine,以消除管理任何虚拟机的需要,但我正在努力找出如何让它为我的功能!
Currently I find myself developing mostly in Angular (v4-5) for my frontend and nodejs for backend. 目前我发现自己主要在Angular(v4-5)开发我的前端和nodejs用于后端。 My development nginx server powers my angular apps and routing to ng-serve and to a separate vm that runs my node apps.
我的开发nginx服务器支持我的角度应用程序和路由到ng-serve以及运行我的节点应用程序的单独vm。 I use PM2 to manage the apps on both servers.
我使用PM2来管理两台服务器上的应用程序。
This works great! 这很棒! I can code locally push my changes via an rsync script to the servers, the app restarts and changes updated.
我可以在本地编写代码,通过rsync脚本将我的更改推送到服务器,应用程序重新启动并更新更新。 More importantly, I can affectively code between the front and backend!
更重要的是,我可以在前端和后端之间进行情感编码! When ready I can comfortably switch the code to the live servers with little effort - nice!
准备好后,我可以轻松地将代码轻松切换到实时服务器 - 很好!
This is where I am struggling... 这是我在努力的地方......
I can't seem to work how I would develop and publish versions of both the front and backend code in one App Engine project. 我似乎无法工作如何在一个App Engine项目中开发和发布前端和后端代码的版本。
Is this possible? 这可能吗? How would I go about deploying/publishing both aspects?
我将如何部署/发布这两个方面?
Would I be better having two projects such as example.com & api.example.com? 我会更好地拥有两个项目,例如example.com和api.example.com吗? If so, can I get the two projects to talk to one another when developing?
如果是这样,我可以让两个项目在开发时互相交流吗?
I have and can create a angular/nodejs app in the App Engine but I can't work the basics of front and backend development in this managed service. 我已经可以在App Engine中创建一个angular / nodejs应用程序,但我无法在此托管服务中使用前端和后端开发的基础知识。
I'd like to use the great features of the App Engine such as versioning, easy scaling and importantly deployment of apps and updates. 我想使用App Engine的强大功能,例如版本控制,轻松扩展以及重要的应用程序和更新部署。 Also, to move all my websites including some older ones in PHP to the App Engine.
此外,将我的所有网站(包括PHP中的一些旧网站)移至App Engine。
Any help surrounding this would be much appreciated. 任何有关这方面的帮助将非常感激。 Thanks!
谢谢!
As @Yandrak3 suggested, a microservices architecture is what you need. 正如@ Yandrak3所建议的那样, 微服务架构就是您所需要的。 But keep in mind that that document relates to the App Engine Standard environment which does not support Node.js as a runtime environment.
但请记住,该文档与App Engine标准环境有关,该环境不支持Node.js作为运行时环境。 But keep the microservices architecture in mind when deploying to App Engine Flexible .
但在部署到App Engine Flexible时,请牢记微服务架构。
On backend and frontend 在后端和前端
Frontend and backend are no longer used to describe the presentation layer and the data access layer of an App Engine application. 前端和后端不再用于描述App Engine应用程序的表示层和数据访问层。 The only reference in the documentation is here .
文档中唯一的参考是这里 。 The (VM) instances managing a service of your app which are configured with automatic scaling are considered part of the frontend infrastructure, while the ones configured with manual scaling are considered backend infrastructure .
管理应用程序服务的(VM)实例配置为自动扩展,被视为前端基础架构的一部分,而配置了手动扩展的服务器被视为后端基础架构 。
The reason for this is that automatic scaling is one of App Engine's 原因是自动缩放是App Engine的一种
great features [...] easy scaling,
功能强大,易于扩展,
automatically presenting your app's frontend in a manner scaled with the number of external requests incoming to your app. 以与传入您应用的外部请求数量相称的方式自动显示您应用的前端。
Manual scaling is more suited for backend operations , where you might want to run operations dependant on the state of the memory over time , or other scenarios. 手动扩展更适合后端操作 ,您可能希望根据内存状态随时间或其他方案运行操作。 You can find some more information on scaling types here .
您可以在此处找到有关缩放类型的更多信息。 Keep in mind that this latter document is under App Engine Standard documentation and it includes basic scaling, a feature not available in the App Engine Flexible environment.
请记住,后一个文档属于App Engine标准文档,它包括基本扩展,这是App Engine Flexible环境中没有的功能。
On services and versioning 关于服务和版本控制
In your case, your frontend and backend modules of your application will become two separate services in App Engine Flex. 在您的情况下,您的应用程序的前端和后端模块将成为App Engine Flex中的两个独立服务。 For each service you can deploy multiple versions.
对于每个服务,您可以部署多个版本。 More, explained here .
更多, 在这里解释。
Communication between services , in this case between your frontend and backend , can be done through HTTP requests between them. 服务之间的通信 ,在这种情况下,在您的前端和后端之间,可以通过它们之间的HTTP请求来完成。
If the next question is how HTTP requests from users reach the appropriate version of a service (or a service), check this document . 如果下一个问题是来自用户的HTTP请求如何到达适当版本的服务(或服务),请查看此文档 。
To deploy multiple services , you will use the same commands and you will separate each deployment and service through their afferent configuration file, app.yaml
. 要部署多个服务 ,您将使用相同的命令 ,并通过其传入配置文件
app.yaml
将每个部署和服务分开。
Your question requires a response with a pretty wide ( and deep ) spectrum of concepts. 您的问题需要具有相当广泛( 和深入 )概念的响应。 Hopefully, this answer is good to start with.
希望这个答案很好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.