一旦部署到Elastic Beanstalk,就会混淆laravel应用程序中的文件夹结构

omr*_*hur 0 php amazon-web-services laravel

一旦我将laravel应用程序部署到AWS Elastic Beanstalk,就会出现文件夹中缺少文件的错误var/app/current/vendor...

该文件存在app/vendor于我的本地计算机内部.在将本地应用程序部署到AWS之前,是否必须配置本地应用程序,以便它还反映AWS的首选目录结构?

编辑:这是收到的错误:

ErrorException in ClassLoader.php line 412:
include(/var/app/current/vendor/composer/../symfony/http-foundation/Session/Storage/MetadataBag.php): failed to open stream: No such file or directory
Run Code Online (Sandbox Code Playgroud)

scr*_*bmx 7

Elastic beanstalk首先在/var/app/ondeck目录中设置应用程序,然后将其交换为/var/app/current.

它们提供了一种运行所有必要脚本的方法,例如composer install通过.config文件来处理这类任务.

这是我的setup.config档案:

commands:
  composer_update:
    command: export COMPOSER_HOME=/root && /usr/bin/composer.phar self-update

option_settings:
  - namespace: aws:elasticbeanstalk:application:environment
    option_name: COMPOSER_HOME
    value: /root

container_commands:
  01-install_dependencies:
    command: "php /usr/bin/composer.phar install"
    cwd: "/var/app/ondeck"
  02-artisan_migrate:
    command: "php artisan migrate --force"
    cwd: "/var/app/ondeck"
    leader_only: true
Run Code Online (Sandbox Code Playgroud)

您可以将其保存在.ebextensions项目根目录下的目录中.

脚本正在做的是首先更新composer,运行composer install然后再进行artisan migrate.

最后,整个事物(以及供应商目录)随后被移动到/var/app/current目录中.

希望这会有所帮助,AWS文档页面中有更多信息:

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/ebextensions.html

这篇文章"关于AWS Elastic Beanstalk的Laravel"

http://blog.goforyt.com/laravel-aws-elastic-beanstalk-dev-guide/

  • 我收到以下错误:`没有这样的文件或目录:'/var/app/ondeck'。` (2认同)