Google App Engine-前端和后端Web开发 [英] Google App Engine - Front and Backend Web Development

查看:166
本文介绍了Google App Engine-前端和后端Web开发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在许多专用主机上管理VM集群,以提供apache,nginx以及节点实时和开发服务器.当然,这需要持续且费时的维护,以确保安全性和可靠性.我发现要花更多的时间在这个平台上,然后再编写新的激动人心的项目.因此,我一直在研究Google App Engine,以消除管理任何VM的需要,但我一直在努力寻找如何使其对我有效的方法!

目前,我发现自己主要在Angular(v4-5)中开发前端,而在nodejs中开发后端.我的开发Nginx服务器为我的角度应用程序提供了动力,并路由到ng-serve和运行我的节点应用程序的单独的vm.我使用PM2来管理两台服务器上的应用.

这很好用!我可以在本地编写代码,通过rsync脚本将更改推送到服务器,应用重新启动并更新更改.更重要的是,我可以在前端和后端之间有效地编码!准备好后,我可以轻松地将代码轻松切换到实时服务器-很好!

这就是我在努力的地方...

我似乎无法在一个App Engine项目中开发前端代码和后端代码的版本.

这可能吗?我将如何部署/发布这两个方面?

我最好有两个项目,例如example.com& api.example.com?如果是这样,我在开发时可以让两个项目互相交谈吗?

我已经并且可以在App Engine中创建一个angular/nodejs应用,但是我无法在此托管服务中使用前端和后端开发的基础知识.

我想使用App Engine的强大功能,例如版本控制,轻松扩展以及重要的应用程序和更新部署.另外,将我所有的网站(包括一些旧版本的PHP网站)移至App Engine.

任何有关此问题的帮助将不胜感激.谢谢!

解决方案

按照@ Yandrak3的建议,不支持Node. .js 作为运行时环境.但是,在部署到 App Engine Flexible 时,请记住微服务架构.. >

在后端和前端
Frontend backend 不再用于描述App Engine应用程序的表示层和数据访问层.该文档中唯一的参考是此处. (VM)实例管理服务已配置为这里.请记住,后一个文档位于App Engine标准文档中,并且包含基本扩展功能,该功能在App Engine Flexible环境中不可用.

关于服务和版本控制
就您而言,您的应用程序的 frontend backend 模块将成为App Engine Flex中的两个独立服务.对于每个服务,您可以部署多个版本. 此处进行了解释.
服务之间的通信,您 frontend backend 之间的这种情况可以通过它们之间的HTTP请求来完成.
如果下一个问题是来自用户的HTTP请求如何到达服务(或服务)的适当版本,请检查部署多种服务,您将使用相同的命令,并且将通过每个部署和服务将它们分开传入的配置文件, app.yaml .

您的问题需要回答的概念范围非常广泛(和深).希望这个答案很好.

I currently manage a cluster of VMs on a number of dedicated hosts to provide apache, nginx and node live and development servers. 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!

Currently I find myself developing mostly in Angular (v4-5) for my frontend and nodejs for backend. My development nginx server powers my angular apps and routing to ng-serve and to a separate vm that runs my node apps. I use PM2 to manage the apps on both servers.

This works great! I can code locally push my changes via an rsync script to the servers, the app restarts and changes updated. 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.

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

I'd like to use the great features of the App Engine such as versioning, easy scaling and importantly deployment of apps and updates. Also, to move all my websites including some older ones in PHP to the App Engine.

Any help surrounding this would be much appreciated. Thanks!

解决方案

As @Yandrak3 suggested, a microservices architecture is what you need. But keep in mind that that document relates to the App Engine Standard environment which does not support Node.js as a runtime environment. But keep the microservices architecture in mind when deploying to 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. 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.
The reason for this is that automatic scaling is one of App Engine's

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.

On services and versioning
In your case, your frontend and backend modules of your application will become two separate services in 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.
If the next question is how HTTP requests from users reach the appropriate version of a service (or a service), check this document.
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.

Your question requires a response with a pretty wide (and deep) spectrum of concepts. Hopefully, this answer is good to start with.

这篇关于Google App Engine-前端和后端Web开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆