1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ElasticbeanstalkでAmazon Linux 2のプラットフォームブランチを選択するとebextensionsが動かない

Posted at

AWS BeanstalkでPHPプラットフォームを選択するとき、最新のプラットフォームブランチだとAmazon Linux2を使うようになっている。
Amazon Linuxのときに使っていた、ebextensionsがそのままだと動かなかったのを書き換えたのでメモ。
/var/app/ondeckで動いていた部分を変更。

一応ログを見る限り、composer installは自動で走っているみたいなので、00-composerはいらないかもしれないと思う。
ここのコマンドのエラーログは、/var/log/cfn-init-cmd.logに出力される

変更前

.ebextensions/*.config
commands:
  01-updateComposer:
    command: export COMPOSER_HOME=/root && /usr/bin/composer.phar self-update

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

  - namespace: aws:elasticbeanstalk:container:php:phpini
    option_name: document_root
    value: /public

container_commands:
  00-composer:
    command: "php /opt/elasticbeanstalk/support/composer.phar install"
    cwd: "/var/app/ondeck"
  01-environment:
    command: "mv /var/app/ondeck/$ENV_FILE /var/app/ondeck/.env"
  02-migrate:
    command: "php artisan migrate"
    cwd: "/var/app/ondeck"

変更後

.ebextensions/*.config
commands:
  01-updateComposer:
    command: export COMPOSER_HOME=/root && /usr/bin/composer.phar self-update

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

  - namespace: aws:elasticbeanstalk:container:php:phpini
    option_name: document_root
    value: /public

container_commands:
  00-composer:
    command: "php /usr/bin/composer.phar install"
    cwd: "/var/app/staging"
  01-environment:
    command: "mv /var/app/staging/$ENV_FILE /var/app/staging/.env"
  02-migrate:
    command: "php artisan migrate"
    cwd: "/var/app/staging"
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?