Appengine app deployment is not uploading some folders

删除回忆录丶 提交于 2020-01-15 08:44:26

问题


I have an app deployed on AppEngine. When I test the app locally, everything works fine. I have done composer install and the "vendor" folder exists.

When I view the source, i can see that some folders are not uploading. This is my folder structure on local drive:

I deploy using this code:

gcloud app deploy --promote --stop-previous-version app.yaml

The deployed structure looks like this:

As you can see, only dialpad_research folder is uploaded. My app.yaml file is like this:

runtime: php55
api_version: 1
threadsafe: true

env_variables:

handlers:
- url: /(.*\.(appcache|manifest))
  mime_type: text/cache-manifest
  static_files: static/\1
  upload: static/(.*\.(appcache|manifest))

- url: /dialpad_research/(.*\.(appcache|manifest))
  mime_type: text/cache-manifest
  static_files: dialpad_research/static/\1
  upload: dialpad_research/static/(.*\.(appcache|manifest))

- url: /(.*\.atom)
  mime_type: application/atom+xml
  static_files: static/\1
  upload: static/(.*\.atom)

- url: /(.*\.crx)
  mime_type: application/x-chrome-extension
  static_files: static/\1
  upload: static/(.*\.crx)

- url: /(.*\.css)
  mime_type: text/css
  static_files: static/\1
  upload: static/(.*\.css)

- url: /(.*\.eot)
  mime_type: application/vnd.ms-fontobject
  static_files: static/\1
  upload: static/(.*\.eot)

- url: /(.*\.htc)
  mime_type: text/x-component
  static_files: static/\1
  upload: static/(.*\.htc)

- url: /(.*\.html)
  mime_type: text/html
  static_files: static/\1
  upload: static/(.*\.html)

- url: /(.*\.ico)
  mime_type: image/x-icon
  static_files: static/\1
  upload: static/(.*\.ico)

- url: /(.*\.js)
  mime_type: text/javascript
  static_files: static/\1
  upload: static/(.*\.js)

- url: /(.*\.json)
  mime_type: application/json
  static_files: static/\1
  upload: static/(.*\.json)

- url: /(.*\.otf)
  mime_type: font/opentype
  static_files: static/\1
  upload: static/(.*\.otf)

- url: /(.*\.rss)
  mime_type: application/rss+xml
  static_files: static/\1
  upload: static/(.*\.rss)

- url: /(.*\.safariextz)
  mime_type: application/octet-stream
  static_files: static/\1
  upload: static/(.*\.safariextz)

- url: /(.*\.(svg|svgz))
  mime_type: images/svg+xml
  static_files: static/\1
  upload: static/(.*\.(svg|svgz))

- url: /(.*\.swf)
  mime_type: application/x-shockwave-flash
  static_files: static/\1
  upload: static/(.*\.swf)

- url: /(.*\.ttf)
  mime_type: font/truetype
  static_files: static/\1
  upload: static/(.*\.ttf)

- url: /(.*\.txt)
  mime_type: text/plain
  static_files: static/\1
  upload: static/(.*\.txt)

- url: /(.*\.unity3d)
  mime_type: application/vnd.unity
  static_files: static/\1
  upload: static/(.*\.unity3d)

- url: /(.*\.webm)
  mime_type: video/webm
  static_files: static/\1
  upload: static/(.*\.webm)

- url: /(.*\.webp)
  mime_type: image/webp
  static_files: static/\1
  upload: static/(.*\.webp)

- url: /(.*\.woff)
  mime_type: application/x-font-woff
  static_files: static/\1
  upload: static/(.*\.woff)

- url: /(.*\.xml)
  mime_type: application/xml
  static_files: static/\1
  upload: static/(.*\.xml)

- url: /(.*\.xpi)
  mime_type: application/x-xpinstall
  static_files: static/\1
  upload: static/(.*\.xpi)

# audio files
- url: /(.*\.(mid|midi|mp3|wav))
  static_files: static/\1
  upload: static/(.*\.(mid|midi|mp3|wav))

# windows files
- url: /(.*\.(doc|exe|ppt|rtf|xls))
  static_files: static/\1
  upload: static/(.*\.(doc|exe|ppt|rtf|xls))

# compressed files
- url: /(.*\.(bz2|gz|rar|tar|tgz|zip))
  static_files: static/\1
  upload: static/(.*\.(bz2|gz|rar|tar|tgz|zip))

# index files
- url: /(.*)/
  static_files: static/\1/index.html
  upload: static/(.*)/index.html

- url: /dialpad_research/api/(.+\.php)$
  script: dialpad_research/api/\1

- url: /vendor/(.+\.php)$
  script: vendor/\1

# site root
- url: /
  static_files: static/index.html
  upload: static/index.html


- url: /static
  static_dir: static


- url: /dialpad_research/static
  static_dir: dialpad_research/static

# dialpad root
- url: /dialpad_research.*
  static_files: dialpad_research/static/index.html
  upload: dialpad_research/static/index.html

# portfolio redirect
- url: /portfolio/.*
  static_files: static/red.html
  upload: static/red.html

# G2 redirect
- url: /g2.*
  static_files: static/red.html
  upload: static/red.html

# Blog redirect
- url: /blog.*
  static_files: static/red.html
  upload: static/red.html

# SSDESIGN redirect
- url: /ssdesign.*
  static_files: static/red.html
  upload: static/red.html

# Colours redirect
- url: /colours.*
  static_files: static/red.html
  upload: static/red.html

Any idea what I might be doing wrong here?

Thanks


回答1:


The static directory is expected to be missing on GAE because it's handled via a static_dir handler, so by default it's not uploaded together with the app code. If you want it uploaded together with the app code you need to set the application_readable for it. From Handlers element:

application_readable

Optional. Boolean. By default, files declared in static file handlers are uploaded as static data and are only served to end users. They cannot be read by an application. If this field is set to true, the files are also uploaded as code data so your application can read them. Both uploads are charged against your code and static data storage resource quotas.

The same applies to all individual files served via static_file handlers.

Things are different for the vendor directory - no static file/dir references it.

I can't yet see a reason for vendor not being uploaded from the info from your post. Things you can try:

  • increase the verbosity of your deployment command using the --verbosity global option, it should mention which files/directories are being skipped and why.
  • if you have a .gcloudignore file in your service check its content
  • use a directory name different than vendor - just in case that particular name is handled differently for whatever reason - just a wild guess, in case the reason for skipping the directory isn't uncovered by the increased verbosity


来源:https://stackoverflow.com/questions/53455793/appengine-app-deployment-is-not-uploading-some-folders

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