We are building some microservices that we will likely be deploying using GAE and I am fairly new to GAE. I’ve done a lot of other development in my day, but this paradigm is a little different. I’m wondering if someone can provide some advice on the most common methodology to follow for development for services deployed using GAE. Specifically, do developers tend to do their coding locally, test the functionality out, and then deploy to GAE to test everything, or do they, make whatever small change to their code, and actually push it to GAE to test it? It seems like one would first build out the basic functionality of the service locally, and then once it is working go through and push it to GAE to make sure it is working since it seems it would be more difficult to debug when running on GAE. Just wondering what the typical model developers follow when building services to be deployed to GAE.
1 Answer
Apart from personal preferences there are a several things to take into consideration.
The runtime/environment (with slight variations across the supported languages) for each service matters:
- the 1st generation standard environment comes with a fairly decent local development server
- the 2nd generation standard environment has a rather limited development server, the official recommendation is to use standard language-specific development tools for local development
- the flexible environment is docker-based, local development can only use standard language-specific development tools
The performance of different portions of the GAE infra emulated locally can differ wildly (both up and down!) from the actual GAE one. Take the datastore for example: the IPC to the "server side" will typically be much faster locally than on GAE, but the "server side" itself can be much slower and won't scale anywhere close. The 1st gen development server can be configured to emulate collisions, but not contention. But in general the computing power/speed of today's laptops greatly exceed what (at least the standard environment) GAE instances can offer. Don't even think about checking anything performance/timing-critical locally. See https://stackoverflow.com/a/47467355/4495081.
Deployment time on the standard environment is decent, but on flexible it can be quite limiting for testing each and every tiny change on GAE. See https://stackoverflow.com/a/40218677/4495081.
Testing interaction between services locally can be a pain (unless using the 1st gen standard env dev server for all of them) as each one needs to be set up and executed locally in a different manner than they'll work on GAE.
Another area that may cause trouble locally, depending on the GCP services you use, would be access control/authentication/IAP/service accounts. Some services cannot be emulated locally, talking to the actual GCP service is necessary even for local development - for example firebase authentication.
What I do presently (using 1st gen standard env, local development is one of the reasons for that) is work as much as possible locally, but also deploy and test on my staging app regularly (at least daily), watching for unexpected differences. BTW, my recommendation is to do staging at app level, not service or service version levels, see https://stackoverflow.com/a/40193364/4495081 and https://stackoverflow.com/q/43218971/4495081.