Why subfolders are not deployed to Google App Engi

2019-09-16 12:47发布

I am developing nodejs web app and trying to run it in the Google cloud.

Only files in the root folder get deployed to Google App Engine using gcloud app deploy command. The appengine/express sample app depends on subfolders and doesn't work when deployed

Steps to reproduce:

  1. create simple app with package.json, app.yaml, app.js
  2. create some folders, put some files in them
  3. install gcloud, run gcloud app deploy from application folder
  4. if you required any local modules located in a subfolder, deployment will fail
  5. if your deployment was successful, go to google cloud console, app engine, versions, click on number in Instances column - you will see a list of instances, on the right click ssh.
  6. in the ssh console run "container_exec gaeapp /bin/bash", then "cd app", then "ls"
  7. you will see that no folders were deployed with the application

Is this a problem with the environment, gcloud utility or am I doing something wrong?

1条回答
一夜七次
2楼-- · 2019-09-16 13:31

gcloud app deploy respects two lists of subfolders to skip when uploading files:

  1. Any .dockerignore file in the directory. With the nodejs runtime, one is created for you containing the following entries:

    node_modules
    .dockerignore
    Dockerfile
    npm-debug.log
    .git
    .hg
    .svn
    
  2. The skip_files entry in your app.yaml file. By default, files matching the following regular expressions are matched:

    - ^(.*/)?#.*#$
    - ^(.*/)?.*~$
    - ^(.*/)?.*\.py[co]$
    - ^(.*/)?.*/RCS/.*$
    - ^(.*/)?\..*$
    

If the missing directories don't match either of these, then there might be another issue. You should file an issue here and attach the logs associated with the deployment (in the location given by gcloud info --format="value(logs.logs_dir)") after scrubbing personal data.

That said, I just tried to deploy the appengine/express sample in the node.js samples for App Engine and was able to do so without any issues with version 138.0.0 of the Cloud SDK.

查看更多
登录 后发表回答