我有一个在PHP 7.1.14(本地)上运行的Symfony 4.0.1应用程序,我想使用EB CLI部署到AWS Elastic Beanstalk
我的master
git分支上有一个应用程序的dist包,用于生产(供应商文件夹已删除等),我能够成功部署到Heroku。现在我需要部署到AWS EB。
已经设置了AWS EB环境(尽管我无法访问控制台)。一些环境细节如下:
Platform: arn:aws:elasticbeanstalk:us-east-2::platform/Tomcat 8 with Java 8 running on 64bit Amazon Linux/2.7.7
Tier: WebServer-Standard-1.0
首先,我能够成功部署该应用程序,但访问该网址时,每个页面都会出现404错误。
我做了一些谷歌搜索,发现了一些描述
.config
文件使用的文章。我添加了一个名为03_main.config
的内容,其中包含以下内容。
commands:
300-composer-update:
command: "export COMPOSER_HOME=/root && composer.phar self-update -n"
container_commands:
300-run-composer:
command: "composer.phar install --no-dev --optimize-autoloader --prefer-dist --no-interaction"
600-update-cache:
command: "source .ebextensions/bin/update-cache.sh"
700-remove-dev-app:
command: "rm web/app_dev.php"
使用此.config
文件进行部署会导致以下部署失败错误:
ERROR: [Instance: i-0c5f61f41d55a18bc] Command failed on instance. Return code: 127 Output: /bin/sh: composer.phar: command not found. command 300-composer-update in .ebextensions/03-main.config failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
我了解.config
文件的用途,但不明白为了让这个Symfony应用运行所需的其他配置。
答案 0 :(得分:0)
我想您应该像波纹管一样使用完整的路径来作曲:
100-update-composer:
command: export COMPOSER_HOME=/root && /usr/bin/composer.phar self-update -n