Microservices

Zemata has three internet-facing UIs with ambitious SLOs*. To achieve high availability, we will be deploying each UI as a separate service on Google's Appengine. Decoupling services has many advantages, amongst them, is increasing the speed of code execution. Another advantage is code isolation; service independence means that when one of our services goes down, it doesn't affect other services, thus failing gracefully. For example, if the Editor's UI becomes unavailable, Zemata's users should still have access to the content and search services.

Deploying code to GAE is only possible with a configuration "app.yaml" file. Placed in the app's root directory, this file specifies the runtime environment for our app. It describes the deployment for a specific version of a service in GAE.

App versions, Memory, Storage, Environment Variables, Container images etc., are some of the things that we can configure in our YAML file. Because our app is simple, just returning one line of text, the app.yaml file for our default service (content delivery UI) looks like this:

runtime: python39

Our app can now be deployed with one command in Cloud Shell.

gcloud app deploy

Location

Before our app goes live, an interactive prompt asking for the preferred location will need attending. Google Cloud Region picker is a service used for selecting GCP regions based on a number of criteria. In our case we want to optimize for latency

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/e5ebf263-dd0e-4123-b3f7-d1ba361b2f99/Annotation_2021-05-09_153546.png

A service name must be specified in the configuration file for other services to be deployed. The best practice is to have separate configuration files for each service as well as their versions. E.g. the configuration file for our editor's UI is named editorui.yaml and looks like this:

runtime: python37
service: editorui