Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 438
crocsinsocks Avatar asked Jan 03 '18 12:01

crocsinsocks


People also ask

Which programming environment is used for Google App Engine?

js, Java, Ruby, C#, Go, Python, or PHP. A fully managed environment lets you focus on code while App Engine manages infrastructure concerns. Use Cloud Monitoring and Cloud Logging to monitor the health and performance of your app and Cloud Debugger and Error Reporting to diagnose and fix bugs quickly.

What is Google App Engine used for?

App Engine is a fully managed, serverless platform for developing and hosting web applications at scale. You can choose from several popular languages, libraries, and frameworks to develop your apps, and then let App Engine take care of provisioning servers and scaling your app instances based on demand.

What is the difference between Google App Engine and Google Compute Engine?

Google App Engine is a Platform as a Service (PaaS) solution that makes deployment easier. On the other hand, the Google Compute Engine is an Infrastructure as a Service (IaaS) tool.


1 Answers

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.

like image 106
Tudormi Avatar answered Oct 13 '22 21:10

Tudormi