AWS弹性魔豆和作曲家 [英] AWS Elastic Beanstalk and Composer

查看:173
本文介绍了AWS弹性魔豆和作曲家的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有,我要部署到弹性魔豆容器作曲家依赖的应用程序。但是我composer.json文件不在项目的根文件夹。我的项目的根目录结构如下:

I have an application with Composer dependencies which I want to deploy to an Elastic Beanstalk container. However my composer.json file is not in the project root folder. My project root has the following structure:

- .ebextensions
- scripts
- www (Webroot)
  - composer.json

和我已经设置文档根目录为/ WWW容器中的配置选项。问题是,我需要在机器上安装的作曲家和运行作曲家安装脚本添加的项目依赖。据我所知,部署在EB将检查,看看是否有在项目根composer.json文件并安装作曲家,但在这种情况下,我composer.json文件是一个子目录。

And I have set the document root to /www in the container configuration options. The issue is that I need to install composer on the box and run the composer install script to add the project dependencies. I understand that during a deploy EB will check to see if there is a composer.json file in the project root and install Composer but in this case my composer.json file is in a sub-directory.

我认为可以用.ebextenstions添加命令来安装Composer和依赖的应用程序部署之后。我创建了一个文件.ebextensions / 01-composer.config与以下容器的命令:

I thought that could use .ebextenstions to add commands to install Composer and dependencies after the application has been deployed. I created a file .ebextensions/01-composer.config with the following container commands:

container_commands:
  01-install-composer:
    command: "curl -sS https://getcomposer.org/installer | php"
  02-install-packages:
    command: "php composer.phar install"
    cwd: "/var/app/current/www/"

但我的应用程序将无法使用此配置部署。请问AP preciate一些帮助,看看我错了。

But my app won't deploy with this configuration. Would appreciate some assistance to see where I am going wrong.

感谢。

推荐答案

作曲家已经安装在默认情况下魔豆的PHP AMI。

Composer is already installed default in Beanstalk's PHP AMI.

同时认为,container_commands通过的/ var / APP / ondeck'跑了,而不是电流。尝试是这样的:

Also consider that container_commands are ran through '/var/app/ondeck' and not on current. Try something like this:

container_commands:
  01-install-packages:
    command: "composer.phar install -d /var/app/ondeck/www"

这篇关于AWS弹性魔豆和作曲家的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆