繁体   English   中英

在 Composer 命令后 Laravel 部署到 App 引擎中断

[英]Laravel deployment to the App engine broken after a composer command

我正在使用 Laravel 7 编写 PHP API。我的开发过程是这样的:

本地(Homestead@Virtualbox:Ubuntu)=> Github => Google Cloud 构建(由主提交触发的部署)=> Google App Engine <> Google Cloud SQL

现在我以这种方式部署我的应用程序没有问题,但昨天我尝试添加一个作曲家包(mpociot/laravel-apidoc-generator)。 经过一些一切正常的本地测试后,我提交了我的主分支,我的 GC Build 触发器尝试在我的 App 引擎实例上部署应用程序。

该过程因我迄今为止从未见过的错误而终止。 然后我恢复了我最近的提交,回到我从未运行过 composer 命令并再次提交我的主分支的状态:部署像往常一样成功。

因此,由于 composer 命令发生了一些事情,我进行了进一步调查。

这是我在 GC Build 失败部署中得到的日志:

FETCHSOURCE
Fetching storage object: gs://701891080190.cloudbuild-source.googleusercontent.com/7541db97159423ca9ec0996eb740a404aef3c4b9-ec3f59e5-8eb5-46f9-98ab-6848be6dd6f8.tar.gz#1589712757789375
Copying gs://701891080190.cloudbuild-source.googleusercontent.com/7541db97159423ca9ec0996eb740a404aef3c4b9-ec3f59e5-8eb5-46f9-98ab-6848be6dd6f8.tar.gz#1589712757789375...
/ [0 files][    0.0 B/  9.4 MiB]                                                
/ [1 files][  9.4 MiB/  9.4 MiB]                                                
Operation completed over 1 objects/9.4 MiB.                                      
BUILD
Already have image (with digest): gcr.io/cloud-builders/gcloud
Services to deploy:

descriptor:      [/workspace/app.yaml]
source:          [/workspace]
target project:  [#####]
target service:  [#####]
target version:  [20200517t105250]
target url:      [https://#####.ew.r.appspot.com]


Do you want to continue (Y/n)?  
Beginning deployment of service [heavnt-test]...
#============================================================#
#= Uploading 2 files to Google Cloud Storage                =#
#============================================================#
File upload done.
Updating service [heavnt-test]...
.............................................................................................................................................................................................................failed.
ERROR: (gcloud.app.deploy) Error Response: [9] Cloud build 0dd458db-cd18-463a-b0de-034668d9802a status: FAILURE.
Build error details: {"error":{"errorType":"BuildError","canonicalCode":"INVALID_ARGUMENT","errorId":"39857F2F","errorMessage":"INFO     FTL version php-v0.17.0\nINFO     Beginning FTL build for php\nINFO     FTL arg passed: exposed_ports None\nINFO     FTL arg passed: cache_repository eu.gcr.io/hotpot-63d32/app-engine-tmp/build-cache/ttl-7d\nINFO     FTL arg passed: tar_base_image_path None\nINFO     FTL arg passed: export_cache_stats False\nINFO     FTL arg passed: builder_output_path \"\"\nINFO     FTL arg passed: name eu.gcr.io/hotpot-63d32/app-engine-tmp/app/ttl-2h:a30cd452-e54a-46f4-a041-9b975258909a\nINFO     FTL arg passed: ttl 168\nINFO     FTL arg passed: global_cache False\nINFO     FTL arg passed: cache True\nINFO     FTL arg passed: upload True\nINFO     FTL arg passed: sh_c_prefix False\nINFO     FTL arg passed: fail_on_error True\nINFO     FTL arg passed: base eu.gcr.io/gae-runtimes/php72:php72_20200412_7_2_29_RC00\nINFO     FTL arg passed: output_path None\nINFO     FTL arg passed: cache_key_version v0.17.0\nINFO     FTL arg passed: cache_salt \nINFO     FTL arg passed: directory /workspace\nINFO     FTL arg passed: entrypoint None\nINFO     FTL arg passed: additional_directory /.googleconfig\nINFO     FTL arg passed: destination_path /srv\nINFO     FTL arg passed: verbosity NOTSET\nINFO     starting: full build\nINFO     starting: builder initialization\nINFO     Loading Docker credentials for repository 'eu.gcr.io/gae-runtimes/php72:php72_20200412_7_2_29_RC00'\nINFO     Loading Docker credentials for repository 'eu.gcr.io/hotpot-63d32/app-engine-tmp/app/ttl-2h:a30cd452-e54a-46f4-a041-9b975258909a'\nINFO     builder initialization took 0 seconds\nINFO     starting: build process for FTL image\nINFO     starting: rm_vendor_dir\nINFO     rm_vendor_dir rm -rf /workspace/vendor\nINFO     `rm_vendor_dir` stdout:\n\nINFO     rm_vendor_dir took 0 seconds\nINFO     descriptor_contents:\n{\n    \"_readme\": [\n        \"This file locks the dependencies of your project to a known state\",\n        \"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies\",\n        \"This file is @generated automatically\"\n    ],\n    \"content-hash\": \"f8027c7d3e5d36c84e1215645bb96efa\",\n    \"packages\": [\n        {\n            \"name\": \"asm89/stack-cors\",\n            \"version\": \"1.3.0\",\n            \"source\": {\n                \"type\": \"git\",\n                \"url\": \"https://github.com/asm89/stack-cors.git\",\n                \"reference\": \"b9c31def6a83f84b4d4a40d35996d375755f0e08\"\n            },\n            \"dist\": {\n                \"type\": \"zip\",\n                \"url\": \"https://api.github.com/repos/asm89/stack-cors/zipball/b9c31def6a83f84b4d4a40d35996d375755f0e08\",\n                \"reference\": \"b9c31def6a83f84b4d4a40d35996d375755f0e08\",\n                \"shasum\": \"\"\n            },\n            \"require\": {\n                \"php\": \"\u003e=5.5.9\",\n                \"symfony/http-foundation\": \"~2.7|~3.0|~4.0|~5.0\",\n                \"symfony/http-kernel\": \"~2.7|~3.0|~4.0|~5.0\"\n            },\n            \"require-dev\": {\n                \"phpunit/phpunit\": \"^5.0 || ^4.8.10\",\n                \"squizlabs/php_codesniffer\": \"^2.3\"\n            },\n            \"type\": \"library\",\n            \"extra\": {\n                \"branch-alias\": {\n                    \"dev-master\": \"1.2-dev\"\n                }\n            },\n            \"autoload\": {\n                \"psr-4\": {\n                    \"Asm89\\\\Stack\\\\\": \"src/Asm89/Stack/\"\n                }\n            },\n            \"notification-url\": \"https://packagist.org/downloads/\",\n            \"license\": [\n                \"MIT\"\n            ],\n            \"authors\": [\n                {\n                    \"name\": \"Alexander\",\n                    \"email\": \"iam.asm89@gmail.com\"\n                }\n            ],\n            \"description\": \"Cross-origin resource sharing library and stack middleware\",\n            \"homepage\": \"https://github.com/asm8.
Check the build log for errors: ####SEE BELOW####
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/gcloud" failed: step exited with non-zero status: 1

日志的完整内容对于这个站点来说太大了(16k+ 行),但它的结尾是这样的:

Step #1 - "builder": Generating optimized autoload files
Step #1 - "builder": > Illuminate\Foundation\ComposerScripts::postAutoloadDump
Step #1 - "builder": > @php artisan package:discover --ansi
Step #1 - "builder": Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
Step #1 - "builder": 
Step #1 - "builder": error: `composer_install` returned code: 1
Step #1 - "builder": Traceback (most recent call last):
Step #1 - "builder":   File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
Step #1 - "builder":     "__main__", fname, loader, pkg_name)
Step #1 - "builder":   File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
Step #1 - "builder":     exec code in run_globals
Step #1 - "builder":   File "/usr/local/bin/ftl.par/__main__.py", line 65, in <module>
Step #1 - "builder":   File "/usr/local/bin/ftl.par/__main__.py", line 57, in main
Step #1 - "builder":   File "/usr/local/bin/ftl.par/__main__/ftl/common/ftl_error.py", line 58, in UserErrorHandler
Step #1 - "builder": IOError: [Errno 2] No such file or directory: '""/output'
Finished Step #1 - "builder"
ERROR
ERROR: build step 1 "gcr.io/gae-runtimes/php72_app_builder:php72_20200412_7_2_29_RC00" failed: step exited with non-zero status: 1

我的 App.yaml 文件:

service: heavnt-test
runtime: php72

env_variables:
    ## Put production environment variables here.
    APP_KEY: base64:TRoTxS+x5PeiAOlwV/F1AwyfgV6y8mZloqGastMYylQ=
    APP_STORAGE: /tmp
    VIEW_COMPILED_PATH: /tmp
    SESSION_DRIVER: cookie  
    APP_SERVICES_CACHE: /tmp/services.php
    APP_PACKAGES_CACHE: /tmp/packages.php
    APP_CONFIG_CACHE: /tmp/config.php
    APP_ROUTES_CACHE: /tmp/routes.php

handlers:
- url: /(.*\.(gif|png|jpg|css|js))$
  static_files: public/\1
  upload: public/.*\.(gif|png|jpg|css|js)$

- url: /.*
  secure: always
  redirect_http_response_code: 301
  script: auto

entrypoint: serve /public/index.php

我的 Cloudbuild.yaml 文件:

steps:
- name: "gcr.io/cloud-builders/gcloud"
  args: ["app", "deploy"]
timeout: "1600s"

我尝试使用 Github Desktop 检查添加我的 Composer 包时文件上发生的更改,但是添加和更改的文件太多,我不知道

2020 年 5 月 18 日编辑:

在 16k+ 行日志中,我发现了这个问题:

Step #1 - "builder": INFO     composer_install composer install --no-dev --no-progress --no-suggest --no-interaction
Step #1 - "builder": INFO     `composer_install` stdout:
Step #1 - "builder": 
Step #1 - "builder": In PackageManifest.php line 177:
Step #1 - "builder":                                                                           
Step #1 - "builder":   The /workspace/bootstrap/cache directory must be present and writable.  

我不知道如何确定这是否是我遇到的问题,因为在本地一切正常并且过去在线工作正常。

我正在使用 Laravel 7 编写 PHP API。我的开发过程是这样的:

本地(Homestead@Virtualbox:Ubuntu)=> Github => Google Cloud 构建(由主提交触发的部署)=> Google App Engine <> Google Cloud SQL

现在我以这种方式部署我的应用程序没有问题,但昨天我尝试添加一个作曲家包(mpociot/laravel-apidoc-generator)。 经过一些一切正常的本地测试后,我提交了我的主分支,我的 GC Build 触发器尝试在我的 App 引擎实例上部署应用程序。

该过程因我迄今为止从未见过的错误而终止。 然后我恢复了我最近的提交,回到我从未运行过 composer 命令并再次提交我的主分支的状态:部署像往常一样成功。

因此,由于 composer 命令发生了一些事情,我进行了进一步调查。

这是我在 GC Build 失败部署中得到的日志:

FETCHSOURCE
Fetching storage object: gs://701891080190.cloudbuild-source.googleusercontent.com/7541db97159423ca9ec0996eb740a404aef3c4b9-ec3f59e5-8eb5-46f9-98ab-6848be6dd6f8.tar.gz#1589712757789375
Copying gs://701891080190.cloudbuild-source.googleusercontent.com/7541db97159423ca9ec0996eb740a404aef3c4b9-ec3f59e5-8eb5-46f9-98ab-6848be6dd6f8.tar.gz#1589712757789375...
/ [0 files][    0.0 B/  9.4 MiB]                                                
/ [1 files][  9.4 MiB/  9.4 MiB]                                                
Operation completed over 1 objects/9.4 MiB.                                      
BUILD
Already have image (with digest): gcr.io/cloud-builders/gcloud
Services to deploy:

descriptor:      [/workspace/app.yaml]
source:          [/workspace]
target project:  [#####]
target service:  [#####]
target version:  [20200517t105250]
target url:      [https://#####.ew.r.appspot.com]


Do you want to continue (Y/n)?  
Beginning deployment of service [heavnt-test]...
#============================================================#
#= Uploading 2 files to Google Cloud Storage                =#
#============================================================#
File upload done.
Updating service [heavnt-test]...
.............................................................................................................................................................................................................failed.
ERROR: (gcloud.app.deploy) Error Response: [9] Cloud build 0dd458db-cd18-463a-b0de-034668d9802a status: FAILURE.
Build error details: {"error":{"errorType":"BuildError","canonicalCode":"INVALID_ARGUMENT","errorId":"39857F2F","errorMessage":"INFO     FTL version php-v0.17.0\nINFO     Beginning FTL build for php\nINFO     FTL arg passed: exposed_ports None\nINFO     FTL arg passed: cache_repository eu.gcr.io/hotpot-63d32/app-engine-tmp/build-cache/ttl-7d\nINFO     FTL arg passed: tar_base_image_path None\nINFO     FTL arg passed: export_cache_stats False\nINFO     FTL arg passed: builder_output_path \"\"\nINFO     FTL arg passed: name eu.gcr.io/hotpot-63d32/app-engine-tmp/app/ttl-2h:a30cd452-e54a-46f4-a041-9b975258909a\nINFO     FTL arg passed: ttl 168\nINFO     FTL arg passed: global_cache False\nINFO     FTL arg passed: cache True\nINFO     FTL arg passed: upload True\nINFO     FTL arg passed: sh_c_prefix False\nINFO     FTL arg passed: fail_on_error True\nINFO     FTL arg passed: base eu.gcr.io/gae-runtimes/php72:php72_20200412_7_2_29_RC00\nINFO     FTL arg passed: output_path None\nINFO     FTL arg passed: cache_key_version v0.17.0\nINFO     FTL arg passed: cache_salt \nINFO     FTL arg passed: directory /workspace\nINFO     FTL arg passed: entrypoint None\nINFO     FTL arg passed: additional_directory /.googleconfig\nINFO     FTL arg passed: destination_path /srv\nINFO     FTL arg passed: verbosity NOTSET\nINFO     starting: full build\nINFO     starting: builder initialization\nINFO     Loading Docker credentials for repository 'eu.gcr.io/gae-runtimes/php72:php72_20200412_7_2_29_RC00'\nINFO     Loading Docker credentials for repository 'eu.gcr.io/hotpot-63d32/app-engine-tmp/app/ttl-2h:a30cd452-e54a-46f4-a041-9b975258909a'\nINFO     builder initialization took 0 seconds\nINFO     starting: build process for FTL image\nINFO     starting: rm_vendor_dir\nINFO     rm_vendor_dir rm -rf /workspace/vendor\nINFO     `rm_vendor_dir` stdout:\n\nINFO     rm_vendor_dir took 0 seconds\nINFO     descriptor_contents:\n{\n    \"_readme\": [\n        \"This file locks the dependencies of your project to a known state\",\n        \"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies\",\n        \"This file is @generated automatically\"\n    ],\n    \"content-hash\": \"f8027c7d3e5d36c84e1215645bb96efa\",\n    \"packages\": [\n        {\n            \"name\": \"asm89/stack-cors\",\n            \"version\": \"1.3.0\",\n            \"source\": {\n                \"type\": \"git\",\n                \"url\": \"https://github.com/asm89/stack-cors.git\",\n                \"reference\": \"b9c31def6a83f84b4d4a40d35996d375755f0e08\"\n            },\n            \"dist\": {\n                \"type\": \"zip\",\n                \"url\": \"https://api.github.com/repos/asm89/stack-cors/zipball/b9c31def6a83f84b4d4a40d35996d375755f0e08\",\n                \"reference\": \"b9c31def6a83f84b4d4a40d35996d375755f0e08\",\n                \"shasum\": \"\"\n            },\n            \"require\": {\n                \"php\": \"\u003e=5.5.9\",\n                \"symfony/http-foundation\": \"~2.7|~3.0|~4.0|~5.0\",\n                \"symfony/http-kernel\": \"~2.7|~3.0|~4.0|~5.0\"\n            },\n            \"require-dev\": {\n                \"phpunit/phpunit\": \"^5.0 || ^4.8.10\",\n                \"squizlabs/php_codesniffer\": \"^2.3\"\n            },\n            \"type\": \"library\",\n            \"extra\": {\n                \"branch-alias\": {\n                    \"dev-master\": \"1.2-dev\"\n                }\n            },\n            \"autoload\": {\n                \"psr-4\": {\n                    \"Asm89\\\\Stack\\\\\": \"src/Asm89/Stack/\"\n                }\n            },\n            \"notification-url\": \"https://packagist.org/downloads/\",\n            \"license\": [\n                \"MIT\"\n            ],\n            \"authors\": [\n                {\n                    \"name\": \"Alexander\",\n                    \"email\": \"iam.asm89@gmail.com\"\n                }\n            ],\n            \"description\": \"Cross-origin resource sharing library and stack middleware\",\n            \"homepage\": \"https://github.com/asm8.
Check the build log for errors: ####SEE BELOW####
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/gcloud" failed: step exited with non-zero status: 1

日志的完整内容对于这个站点来说太大了(16k+ 行),但它的结尾是这样的:

Step #1 - "builder": Generating optimized autoload files
Step #1 - "builder": > Illuminate\Foundation\ComposerScripts::postAutoloadDump
Step #1 - "builder": > @php artisan package:discover --ansi
Step #1 - "builder": Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
Step #1 - "builder": 
Step #1 - "builder": error: `composer_install` returned code: 1
Step #1 - "builder": Traceback (most recent call last):
Step #1 - "builder":   File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
Step #1 - "builder":     "__main__", fname, loader, pkg_name)
Step #1 - "builder":   File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
Step #1 - "builder":     exec code in run_globals
Step #1 - "builder":   File "/usr/local/bin/ftl.par/__main__.py", line 65, in <module>
Step #1 - "builder":   File "/usr/local/bin/ftl.par/__main__.py", line 57, in main
Step #1 - "builder":   File "/usr/local/bin/ftl.par/__main__/ftl/common/ftl_error.py", line 58, in UserErrorHandler
Step #1 - "builder": IOError: [Errno 2] No such file or directory: '""/output'
Finished Step #1 - "builder"
ERROR
ERROR: build step 1 "gcr.io/gae-runtimes/php72_app_builder:php72_20200412_7_2_29_RC00" failed: step exited with non-zero status: 1

我的 App.yaml 文件:

service: heavnt-test
runtime: php72

env_variables:
    ## Put production environment variables here.
    APP_KEY: base64:TRoTxS+x5PeiAOlwV/F1AwyfgV6y8mZloqGastMYylQ=
    APP_STORAGE: /tmp
    VIEW_COMPILED_PATH: /tmp
    SESSION_DRIVER: cookie  
    APP_SERVICES_CACHE: /tmp/services.php
    APP_PACKAGES_CACHE: /tmp/packages.php
    APP_CONFIG_CACHE: /tmp/config.php
    APP_ROUTES_CACHE: /tmp/routes.php

handlers:
- url: /(.*\.(gif|png|jpg|css|js))$
  static_files: public/\1
  upload: public/.*\.(gif|png|jpg|css|js)$

- url: /.*
  secure: always
  redirect_http_response_code: 301
  script: auto

entrypoint: serve /public/index.php

我的 Cloudbuild.yaml 文件:

steps:
- name: "gcr.io/cloud-builders/gcloud"
  args: ["app", "deploy"]
timeout: "1600s"

我尝试使用 Github Desktop 检查添加我的 Composer 包时文件上发生的更改,但是添加和更改的文件太多,我不知道

2020 年 5 月 18 日编辑:

在 16k+ 行日志中,我发现了这个问题:

Step #1 - "builder": INFO     composer_install composer install --no-dev --no-progress --no-suggest --no-interaction
Step #1 - "builder": INFO     `composer_install` stdout:
Step #1 - "builder": 
Step #1 - "builder": In PackageManifest.php line 177:
Step #1 - "builder":                                                                           
Step #1 - "builder":   The /workspace/bootstrap/cache directory must be present and writable.  

我不知道如何确定这是否是我遇到的问题,因为在本地一切正常并且过去在线工作正常。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM