I have a one big monolith application, and now its time to separate some modules to micro services! I read a lot about pub/sub and microservices in Google docs, but can't find answers to my questions:
- How app.yaml file looks like for my module(microservice)?
- How app.yaml looks like for my app?(I mean, with microservice)
- Where I need to declare this module - in application app.yaml or in both app.yaml?
- How can I use single datastore with my app and my module?
My app.yaml now looks like:
application: my-application
version: 1
runtime: python27
api_version: 1
threadsafe: true
with some credentials and libs.
Waiting for your answers!
A monolithic app is really an app with a single module/service (the default one). The
app.yaml
config for such app (like the one you shown) is really the default module's config file - there is no "per-app" such config. The modules are "tied" together into one specific app by this line in their respective<module>.yaml
:In a multi-module app each module has its own
<module>.yaml
config file (the name doesn't have to beapp.yaml
, it actually has to be different if the module code share the same dir - but I'd stick with the recommended directory structure - one module per app subdirectory).See this Q&A (which also contains some examples): Can a default service/module in a Google App Engine app be a sibling of a non-default one in terms of folder structure?
The default module name can/should not be set. All other module names are configured in the respective
<module>.yaml
files, like this:All modules in the same app share the same datastore (thus the same
index.html
file).Note that other config files are also app-level configs, thus really shared by all modules (or just the default module, which is the one executing the cron service, for example), I'd place them as recommended in the app's top level dir:
cron.yaml
,dispatch.yaml
,queue.yaml
.