php - 将 Symfony 项目部署到 App Engine - 错误 : Too many files

标签 php symfony google-app-engine

首次将 Symfony 项目部署到 Google App Engine,运行 gcloud app deploy

错误:

File upload done.
ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: This deployment has too many files. New versions are limited to 10000 files for this app.
- '@type': type.googleapis.com/google.rpc.BadRequest
  fieldViolations:
  - description: This deployment has too many files. New versions are limited to 10000
      files for this app.
    field: version.deployment.files[...]

我怀疑问题出在我的 app.yaml 文件上:

runtime: php55
api_version: 1

handlers:
# tell appengine where our static assets live
- url: /public
  static_dir: public

(我想我至少错过了一些东西来告诉它不要上传供应商的东西,例如忽略)。

我应该如何更新我的 app.ymal 文件以供项目部署?

PS 项目文件夹如下所示:

enter image description here

最佳答案

使用 gcloud app deploy--verbosity 选项提高部署详细程度命令,您将获得所有上传文件的列表。然后使用skip_files app.yaml 中的选项来指定您想要忽略的选项:

Optional. The skip_files element specifies which files in the application directory are not to be uploaded to App Engine. The value is either a regular expression, or a list of regular expressions. Any filename that matches any of the regular expressions is omitted from the list of files to upload when the application is uploaded. Filenames are relative to the project directory.

The skip_files has the following default:

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

注意:注意覆盖此配置的默认值。

我可能是错的,但您的项目结构图像表明您的应用程序代码位于 src 目录中。如果是这样,我建议将 app.yaml 文件移到其中 - 包含正在部署的 app.yaml 文件的目录被认为是应用程序/的顶级目录服务 - 其全部内容将上传至 GAE。此类移动后,您可能需要调整一些路径 - GAE 会考虑相对于此应用程序/服务顶级目录的所有应用程序/服务路径。如果需要它们,您可以有选择地将项目目录中的一些文件/目录符号链接(symbolic link)到 src 目录中,部署遵循符号链接(symbolic link),将它们替换为实际内容。

一些相关帖子:

关于php - 将 Symfony 项目部署到 App Engine - 错误 : Too many files,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51942384/

相关文章:

php - Twig:如何检查变量是否为 DateTime 对象

symfony - 在 Twig 中设置简单的 bool 值

google-app-engine - 谷歌应用引擎 :Where is the datastore file stored on the local development server?

java - 如何从动态创建的字符串数组中创建 datastore.Text 对象?

java - GAE Java灵活环境随机实例正在创建

php - 当它是语言特定字符时返回第一个字母

php - 如何使用动态创建的 PHP 变量将数据插入 Mysql

php - 如何制作缩放工具来像谷歌地图一样缩放图像?

php - phpmyadmin中创建函数错误

html - Symfony 和 RequireJS - 如何提供静态 html 文件?