尝试将 Laravel 部署到 Cloud Foundry 时出错
Error while trying to deploy Laravel to Cloud Foundry
我正在尝试将基本 Laravel 应用程序部署到 Cloud Foundry。下面你可以看到我 运行 ibmcloud cf push
:
之后的输出
Invoking 'cf push'...
Pushing from manifest to org ***** / space dev as *****...
Using manifest file *****\manifest.yml
Getting app info...
Updating app with these attributes...
name: *****
path: *****
buildpacks:
https://github.com/cloudfoundry/php-buildpack.git#v4.4.13
disk quota: 1G
health check type: port
instances: 1
memory: 256M
stack: cflinuxfs3
services:
Db2-8n
availability-monitoring-auto
env:
APP_DEBUG
APP_ENV
APP_NAME
CF_STAGING_TIMEOUT
CF_STARTUP_TIMEOUT
routes:
*****.mybluemix.net
Updating app *****...
Mapping routes...
Comparing local files to remote cache...
Packaging files to upload...
Uploading files...
26.79 MiB / 26.79 MiB [===========] 100.00% 11s
Waiting for API to complete processing files...
Staging app and tracing logs...
Cell 79671882-f747-4d8b-8466-68fb1c4bfc6a creating container for instance c10e2d4c-d35f-4920-8002-ce81e32dcc3c
Cell 79671882-f747-4d8b-8466-68fb1c4bfc6a successfully created container for instance c10e2d4c-d35f-4920-8002-ce81e32dcc3c
Downloading app package...
Downloading build artifacts cache...
Downloaded build artifacts cache (221B)
Downloaded app package (43.9M)
-------> Buildpack version 4.4.13
Installing HTTPD
HTTPD 2.4.43
Downloaded [https://buildpacks.cloudfoundry.org/dependencies/httpd/httpd_2.4.43_linux_x64_cflinuxfs3_59c67ff8.tgz] to [/tmp]
Installing PHP
PHP 7.4.5
Downloaded [https://buildpacks.cloudfoundry.org/dependencies/php/php7_7.4.5_linux_x64_cflinuxfs3_c0055c53.tgz] to [/tmp]
The extension 'mcrypt' is not provided by this buildpack.
Downloaded [https://buildpacks.cloudfoundry.org/dependencies/php/php7_7.4.5_linux_x64_cflinuxfs3_c0055c53.tgz] to [/tmp]
Downloaded [https://buildpacks.cloudfoundry.org/dependencies/composer/composer_1.10.5_linux_noarch_any-stack_a1f79ebd.phar] to [/tmp]
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 482 100 482 0 0 2386 0 --:--:-- --:--:-- --:--:-- 2386
Loading composer repositories with package information
Installing dependencies from lock file
Package operations: 0 installs, 0 updates, 37 removals
- Removing webmozart/assert (1.9.1)
- Removing theseer/tokenizer (1.2.0)
- Removing sebastian/version (2.0.1)
- Removing sebastian/type (1.1.3)
- Removing sebastian/resource-operations (2.0.1)
- Removing sebastian/recursion-context (3.0.0)
- Removing sebastian/object-reflector (1.1.1)
- Removing sebastian/object-enumerator (3.0.3)
- Removing sebastian/global-state (3.0.0)
- Removing sebastian/exporter (3.1.2)
- Removing sebastian/environment (4.2.3)
- Removing sebastian/diff (3.0.2)
- Removing sebastian/comparator (3.0.2)
- Removing sebastian/code-unit-reverse-lookup (1.0.1)
- Removing scrivo/highlight.php (v9.18.1.1)
- Removing phpunit/phpunit (8.5.8)
- Removing phpunit/php-token-stream (3.1.1)
- Removing phpunit/php-timer (2.1.2)
- Removing phpunit/php-text-template (1.2.1)
- Removing phpunit/php-file-iterator (2.0.2)
- Removing phpunit/php-code-coverage (7.0.10)
- Removing phpspec/prophecy (1.11.1)
- Removing phpdocumentor/type-resolver (1.3.0)
- Removing phpdocumentor/reflection-docblock (5.2.0)
- Removing phpdocumentor/reflection-common (2.2.0)
- Removing phar-io/version (2.0.1)
- Removing phar-io/manifest (1.0.3)
- Removing nunomaduro/collision (v4.2.0)
- Removing myclabs/deep-copy (1.10.1)
- Removing mockery/mockery (1.4.1)
- Removing hamcrest/hamcrest-php (v2.0.1)
- Removing fzaninotto/faker (v1.9.1)
- Removing filp/whoops (2.7.3)
- Removing facade/ignition-contracts (1.0.1)
- Removing facade/ignition (2.3.4)
- Removing facade/flare-client-php (1.3.4)
- Removing doctrine/instantiator (1.3.1)
Package moontoast/math is abandoned, you should avoid using it. Use brick/math instead.
Generating optimized autoload files
[RuntimeException]
Could not scan for classes inside "database/seeds" which does not appear to be a file nor a folder
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...
-----> Composer command failed
Traceback (most recent call last):
File "/tmp/buildpackdownloads/a299fb3027da6b25566e06badf712812/scripts/compile.py", line 59, in <module>
.from_build_pack('lib/additional_commands')
File "/tmp/buildpackdownloads/a299fb3027da6b25566e06badf712812/lib/build_pack_utils/builder.py", line 212, in extensions
process_extension(path, ctx, 'compile', process, args=[self])
File "/tmp/buildpackdownloads/a299fb3027da6b25566e06badf712812/lib/build_pack_utils/utils.py", line 69, in process_extension
success(getattr(extn, to_call)(*args))
File "/tmp/buildpackdownloads/a299fb3027da6b25566e06badf712812/extensions/composer/extension.py", line 444, in compile
return composer.compile(install)
File "/tmp/buildpackdownloads/a299fb3027da6b25566e06badf712812/lib/extension_helpers.py", line 154, in compile
self._compile(install)
File "/tmp/buildpackdownloads/a299fb3027da6b25566e06badf712812/extensions/composer/extension.py", line 196, in _compile
self.run()
File "/tmp/buildpackdownloads/a299fb3027da6b25566e06badf712812/extensions/composer/extension.py", line 343, in run
*self._ctx['COMPOSER_INSTALL_OPTIONS'])
File "/tmp/buildpackdownloads/a299fb3027da6b25566e06badf712812/extensions/composer/extension.py", line 390, in run
shell=True)
File "/tmp/buildpackdownloads/a299fb3027da6b25566e06badf712812/lib/build_pack_utils/runner.py", line 109, in stream_output
raise CalledProcessError(retcode, cmd)
build_pack_utils.runner.CalledProcessError: Command '<open file '<fdopen>', mode 'w' at 0x7f994f249930>' returned non-zero exit status 1
Failed to compile droplet: Failed to run finalize script: exit status 1
Exit status 223
Cell 79671882-f747-4d8b-8466-68fb1c4bfc6a stopping instance c10e2d4c-d35f-4920-8002-ce81e32dcc3c
Cell 79671882-f747-4d8b-8466-68fb1c4bfc6a destroying container for instance c10e2d4c-d35f-4920-8002-ce81e32dcc3c
Error staging application: App staging failed in the buildpack compile phase
FAILED
ibmcloud cf push
BP_DEBUG
设置为 true
的日志可在此处获得:
https://drive.google.com/file/d/1NL1KxqdJv4k0QtIrrySwb-XF_7VwFO7l/view?usp=sharing
这是我的 composer.json
文件:
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2.5",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^6.3",
"laravel/framework": "^7.22.2",
"laravel/telescope": "^3.5",
"laravel/tinker": "^2.0",
"laravel/ui": "^2.1"
},
"require-dev": {
"facade/ignition": "^2.0",
"fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^4.1",
"phpunit/phpunit": "^8.5"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\Foundation\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
}
}
这是我的 options.json
文件:
{
"PHP_VERSION": "{PHP_70_LATEST}",
"COMPOSER_VENDOR_DIR": "vendor",
"WEBDIR": "public"
}
这是我的 manifest.yml
文件:
---
applications:
- name: *****
memory: 256M
buildpacks: [ https://github.com/cloudfoundry/php-buildpack.git#v4.4.13 ]
random-route: true
env:
APP_DEBUG: false
CF_STAGING_TIMEOUT: 15
CF_STARTUP_TIMEOUT: 15
APP_NAME: *****
我一直在寻找这个问题的解决方案很长一段时间,但我找不到任何可以帮助我的东西。我希望这里有人运气好,可以找到解决这个问题的方法......非常感谢任何帮助:)
此问题的解决方案是将 .pb-config
文件夹重命名为 .bp-config
。 this link 下可用的教程有一个拼写错误,这就是所有痛苦的原因...
我正在尝试将基本 Laravel 应用程序部署到 Cloud Foundry。下面你可以看到我 运行 ibmcloud cf push
:
Invoking 'cf push'...
Pushing from manifest to org ***** / space dev as *****...
Using manifest file *****\manifest.yml
Getting app info...
Updating app with these attributes...
name: *****
path: *****
buildpacks:
https://github.com/cloudfoundry/php-buildpack.git#v4.4.13
disk quota: 1G
health check type: port
instances: 1
memory: 256M
stack: cflinuxfs3
services:
Db2-8n
availability-monitoring-auto
env:
APP_DEBUG
APP_ENV
APP_NAME
CF_STAGING_TIMEOUT
CF_STARTUP_TIMEOUT
routes:
*****.mybluemix.net
Updating app *****...
Mapping routes...
Comparing local files to remote cache...
Packaging files to upload...
Uploading files...
26.79 MiB / 26.79 MiB [===========] 100.00% 11s
Waiting for API to complete processing files...
Staging app and tracing logs...
Cell 79671882-f747-4d8b-8466-68fb1c4bfc6a creating container for instance c10e2d4c-d35f-4920-8002-ce81e32dcc3c
Cell 79671882-f747-4d8b-8466-68fb1c4bfc6a successfully created container for instance c10e2d4c-d35f-4920-8002-ce81e32dcc3c
Downloading app package...
Downloading build artifacts cache...
Downloaded build artifacts cache (221B)
Downloaded app package (43.9M)
-------> Buildpack version 4.4.13
Installing HTTPD
HTTPD 2.4.43
Downloaded [https://buildpacks.cloudfoundry.org/dependencies/httpd/httpd_2.4.43_linux_x64_cflinuxfs3_59c67ff8.tgz] to [/tmp]
Installing PHP
PHP 7.4.5
Downloaded [https://buildpacks.cloudfoundry.org/dependencies/php/php7_7.4.5_linux_x64_cflinuxfs3_c0055c53.tgz] to [/tmp]
The extension 'mcrypt' is not provided by this buildpack.
Downloaded [https://buildpacks.cloudfoundry.org/dependencies/php/php7_7.4.5_linux_x64_cflinuxfs3_c0055c53.tgz] to [/tmp]
Downloaded [https://buildpacks.cloudfoundry.org/dependencies/composer/composer_1.10.5_linux_noarch_any-stack_a1f79ebd.phar] to [/tmp]
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 482 100 482 0 0 2386 0 --:--:-- --:--:-- --:--:-- 2386
Loading composer repositories with package information
Installing dependencies from lock file
Package operations: 0 installs, 0 updates, 37 removals
- Removing webmozart/assert (1.9.1)
- Removing theseer/tokenizer (1.2.0)
- Removing sebastian/version (2.0.1)
- Removing sebastian/type (1.1.3)
- Removing sebastian/resource-operations (2.0.1)
- Removing sebastian/recursion-context (3.0.0)
- Removing sebastian/object-reflector (1.1.1)
- Removing sebastian/object-enumerator (3.0.3)
- Removing sebastian/global-state (3.0.0)
- Removing sebastian/exporter (3.1.2)
- Removing sebastian/environment (4.2.3)
- Removing sebastian/diff (3.0.2)
- Removing sebastian/comparator (3.0.2)
- Removing sebastian/code-unit-reverse-lookup (1.0.1)
- Removing scrivo/highlight.php (v9.18.1.1)
- Removing phpunit/phpunit (8.5.8)
- Removing phpunit/php-token-stream (3.1.1)
- Removing phpunit/php-timer (2.1.2)
- Removing phpunit/php-text-template (1.2.1)
- Removing phpunit/php-file-iterator (2.0.2)
- Removing phpunit/php-code-coverage (7.0.10)
- Removing phpspec/prophecy (1.11.1)
- Removing phpdocumentor/type-resolver (1.3.0)
- Removing phpdocumentor/reflection-docblock (5.2.0)
- Removing phpdocumentor/reflection-common (2.2.0)
- Removing phar-io/version (2.0.1)
- Removing phar-io/manifest (1.0.3)
- Removing nunomaduro/collision (v4.2.0)
- Removing myclabs/deep-copy (1.10.1)
- Removing mockery/mockery (1.4.1)
- Removing hamcrest/hamcrest-php (v2.0.1)
- Removing fzaninotto/faker (v1.9.1)
- Removing filp/whoops (2.7.3)
- Removing facade/ignition-contracts (1.0.1)
- Removing facade/ignition (2.3.4)
- Removing facade/flare-client-php (1.3.4)
- Removing doctrine/instantiator (1.3.1)
Package moontoast/math is abandoned, you should avoid using it. Use brick/math instead.
Generating optimized autoload files
[RuntimeException]
Could not scan for classes inside "database/seeds" which does not appear to be a file nor a folder
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...
-----> Composer command failed
Traceback (most recent call last):
File "/tmp/buildpackdownloads/a299fb3027da6b25566e06badf712812/scripts/compile.py", line 59, in <module>
.from_build_pack('lib/additional_commands')
File "/tmp/buildpackdownloads/a299fb3027da6b25566e06badf712812/lib/build_pack_utils/builder.py", line 212, in extensions
process_extension(path, ctx, 'compile', process, args=[self])
File "/tmp/buildpackdownloads/a299fb3027da6b25566e06badf712812/lib/build_pack_utils/utils.py", line 69, in process_extension
success(getattr(extn, to_call)(*args))
File "/tmp/buildpackdownloads/a299fb3027da6b25566e06badf712812/extensions/composer/extension.py", line 444, in compile
return composer.compile(install)
File "/tmp/buildpackdownloads/a299fb3027da6b25566e06badf712812/lib/extension_helpers.py", line 154, in compile
self._compile(install)
File "/tmp/buildpackdownloads/a299fb3027da6b25566e06badf712812/extensions/composer/extension.py", line 196, in _compile
self.run()
File "/tmp/buildpackdownloads/a299fb3027da6b25566e06badf712812/extensions/composer/extension.py", line 343, in run
*self._ctx['COMPOSER_INSTALL_OPTIONS'])
File "/tmp/buildpackdownloads/a299fb3027da6b25566e06badf712812/extensions/composer/extension.py", line 390, in run
shell=True)
File "/tmp/buildpackdownloads/a299fb3027da6b25566e06badf712812/lib/build_pack_utils/runner.py", line 109, in stream_output
raise CalledProcessError(retcode, cmd)
build_pack_utils.runner.CalledProcessError: Command '<open file '<fdopen>', mode 'w' at 0x7f994f249930>' returned non-zero exit status 1
Failed to compile droplet: Failed to run finalize script: exit status 1
Exit status 223
Cell 79671882-f747-4d8b-8466-68fb1c4bfc6a stopping instance c10e2d4c-d35f-4920-8002-ce81e32dcc3c
Cell 79671882-f747-4d8b-8466-68fb1c4bfc6a destroying container for instance c10e2d4c-d35f-4920-8002-ce81e32dcc3c
Error staging application: App staging failed in the buildpack compile phase
FAILED
ibmcloud cf push
BP_DEBUG
设置为 true
的日志可在此处获得:
https://drive.google.com/file/d/1NL1KxqdJv4k0QtIrrySwb-XF_7VwFO7l/view?usp=sharing
这是我的 composer.json
文件:
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2.5",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^6.3",
"laravel/framework": "^7.22.2",
"laravel/telescope": "^3.5",
"laravel/tinker": "^2.0",
"laravel/ui": "^2.1"
},
"require-dev": {
"facade/ignition": "^2.0",
"fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^4.1",
"phpunit/phpunit": "^8.5"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\Foundation\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
}
}
这是我的 options.json
文件:
{
"PHP_VERSION": "{PHP_70_LATEST}",
"COMPOSER_VENDOR_DIR": "vendor",
"WEBDIR": "public"
}
这是我的 manifest.yml
文件:
---
applications:
- name: *****
memory: 256M
buildpacks: [ https://github.com/cloudfoundry/php-buildpack.git#v4.4.13 ]
random-route: true
env:
APP_DEBUG: false
CF_STAGING_TIMEOUT: 15
CF_STARTUP_TIMEOUT: 15
APP_NAME: *****
我一直在寻找这个问题的解决方案很长一段时间,但我找不到任何可以帮助我的东西。我希望这里有人运气好,可以找到解决这个问题的方法......非常感谢任何帮助:)
此问题的解决方案是将 .pb-config
文件夹重命名为 .bp-config
。 this link 下可用的教程有一个拼写错误,这就是所有痛苦的原因...