I'm structuring my GAE (flex) project as a number of services:
- my-project/
- services/
- service_1/
- service_1.yaml
- service_2/
- service_2.yaml
I would now like to share some code between the services. Ideally, I'd like to have a my-project/lib/
and symlink this to the services:
my-project/services/service_1/lib -> ../../lib
my-project/services/service_2/lib -> ../../lib
But gcloud app deploy
(which I'm running from a service directory, where the yaml
file is) ignores the symlink (I checked the tgz
file before it got uploaded got GAE for deployment and lib/
isn't there).
So, is there any way to share the lib/
code (apart from pulling it into it's own library and installing with pip
)?
The method of sharing code across services using symlinks might not be applicable to the flex environment, which is docker-based. This suspicion is based on the last table row from Troubleshooting Custom Runtimes:
Issue
- Some files are not included in my application.
Solutions
- Docker does not follow symlinks when added by your source tree or your packaging system to the base image, so any source files outside
of your applications directory that are referenced by symlinks in your
source tree will not be copied into your application.
Also - dependencies in the flex environment are supposed to be based on a requirements.txt
file used to build the dockerfile at deployment time, not on vendoring in libraries by pip
installing them into the lib
dir which is the standard environment way.