Do I need to define datastore-indexes in every microservice(module) which uses it or just in root application?

眉间皱痕 提交于 2019-12-02 03:13:53

The datastore index configuration is one of the several app-level configurations, shared by all services/modules in the app and which can be deployed independently from the services themselves. In fact it's recommended to first deploy the indexes configuration, let GAE get those in Serving state (which may take a good while, depending on the number of entities that need to be indexed) and only after that deploy the app code needing those indexes.

For deployment on GAE purpose it doesn't really matter if the index configuration is located in a particular service or in the root of the application, as long as it's deployed from that location.

However the local development server may have trouble running a particular service without the index configuration in that server's directory - I suspect that's what causes you grief. To address this in the DRY spirit my preference is to have a master copy of the configuration file in the app root directory and symlinks pointing to it into each of the services directories.

Things get a bit more complicated because the Java GAE uses the datastore-indexes.xml configuration file while the other languages use the index.yaml file, with different formats. Java also supports the index.yaml file, but I'm not certain if that's equally well supported in the development server, IDEs and/or other local development tools.

If all your modules are Java-based you should be OK. But if you have a mix of languages you'll probably have to try to share an index.yaml equivalent.

If that doesn't work and you're forced to use both files, each symlinked into the respective language service dirs, you'll have to make sure the index configs in the 2 files are consistent, otherwise you risk breaking some of the services.

Potentially of interest: Can a default service/module in a Google App Engine app be a sibling of a non-default one in terms of folder structure?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!