Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App engine ignores symlinks to directories

I'm creating an app which runs on Google's App Engine with the custom flex environment. This app uses several (relative) symlinks which point to other directories in the project. But somehow those symlinks are ignored when I deploy the app.

It seems that the gcloud tool sends the source context (which is, all the files in my project) to the google container builder before building and deploying the app:

$ gcloud --project=my-project --verbosity=info app deploy
(...)
Beginning deployment of service [default]...
Building and pushing image for service [default]
INFO: Uploading [/tmp/tmpZ4Jha_/src.tgz] to [eu.gcr.io/my-project/appengine/default.20171212t160803:latest]
Started cloud build [some-uid].

If I extract the contents of the .tgz file I can see that all the files and directories in the project are there. Except for symlinks pointing to directories (symlinks to files are included though). So the source context is missing all the symlinks to directories.

Not using symlinks is not an option, so does anybody know how to include symlinks to directories in the source context send to google?

Although I don't think it's relevant, here are the contents of the app.yaml:

env: flex
runtime: custom

runtime_config:
  document_root: docroot

manual_scaling:
  instances: 1

resources:
  cpu: 2
  memory_gb: 2
  disk_size_gb: 10
like image 737
Wessel van der Linden Avatar asked Dec 12 '17 15:12

Wessel van der Linden


1 Answers

I've worked around this by deploying my python cloud functions from a temp directory, and using tar (on a Mac) to include files inside symlinked directories:

  tar hc --exclude='__pycache__' {name} | tar x -C {tmpdirname}
like image 178
Steve Alexander Avatar answered Oct 23 '22 14:10

Steve Alexander