64bit Amazon Linux 2017.09 v2.6.0 running PHP 5.6でデプロイできません。

0

全く同じソースで、
64bit Amazon Linux 2017.03 v2.4.1 running PHP 5.6だとデプロイできるのですが、
64bit Amazon Linux 2017.09 v2.6.0 running PHP 5.6にするとデプロイできません。

試行錯誤の末.ebextensionsでfilesコマンドを使用しているファイルを取り除くとv2.6.0環境でもデプロイに成功することがわかりました。

.ebextensionsに指定しているファイルの問題でしょうか。
解決のヒントをご提供いただけると幸いです。

イベント情報は下記です。

INFO	Environment update is starting.

INFO	Deploying new version to instance(s).

WARN	The following instances have not responded in the allowed command timeout time (they might still finish eventually on their own): [i-XXXXXXXXXXXXXXXXXX].

INFO	Command execution completed on all instances. Summary: [Successful: 0, TimedOut: 1].

ERROR	Unsuccessful command execution on instance id(s) 'i-XXXXXXXXXXXXXXXXXX'. Aborting the operation.

ERROR	Failed to deploy application.

ERROR	During an aborted deployment, some instances may have deployed the new application version. To ensure all instances are running the same version, re-deploy the appropriate application version.

WARN	Environment health has transitioned from Info to Degraded. Incorrect application version found on all instances. Expected version "XXXXX" (deployment 30). Application update is aborting (running for 15 minutes).

filesコマンドは下記です。

files:
    "/opt/elasticbeanstalk/hooks/appdeploy/enact/99-crontab.sh" :
        mode: "000777"
        owner: ec2-user
        group: ec2-user
        content: |
            #!/usr/bin/env bash

            sudo su -
            cp -f /var/app/current/hoge/crontab/shell-a /etc/cron.d/shell-a
            chmod 644 /etc/cron.d/shell-a
            cp -f /var/app/current/hoge/crontab/shell-b /etc/cron.d/shell-b
            chmod 644 /etc/cron.d/shell-b
kbos
demandé il y a 6 ans515 vues
4 réponses
0
Réponse acceptée

適当なことを言って申し訳ありません。

実際に試してみたところ、同様の状況を再現する事ができました。

sudo su -

また、上の行を content から取り除いたところ、デプロイを完了する事ができました。

おそらく su コマンドで新しい shell が起動されて操作が完了できなくなるため、タイムアウトになるものと思われます。
これまでの環境で動作していた事が少し不可解ですが、root で実行する必要がある操作は都度 sudo コマンドを使用するなど変更する必要がありそうです。

semnil
répondu il y a 6 ans
0

2017.03 v2.4.1 の環境を起動する事ができなかったため、とりあえず 2017.09 v2.6.0 でインスタンスの中をのぞいてみました。

[ec2-user@ip-*-*-*-* ~]$ ls -l /opt/elasticbeanstalk/hooks/appdeploy/
合計 12
drwxr-xr-x 2 root root 4096 11月  7 22:50 enact
drwxr-xr-x 2 root root 4096 11月  7 22:50 post
drwxr-xr-x 2 root root 4096 11月  7 22:50 pre

ファイルを配置しようとしているディレクトリは root のみ書き込み可能になっているようです。
owner, group を ec2-user から root に変えてみてはいかがでしょうか。

semnil
répondu il y a 6 ans
0

アドバイスありがとうございます。

rootで試してみましたが、同様の状況でデプロイできませんでした。

また、v2.4.1の環境でも下記の通りで、 v2.6.0とv2.4.1で違いはないように思います。
引き続き原因を探ってみますが、他にも何か可能性がございましたアドバイスいただけますと幸いです。

[ec2-user@ip-X-X-X-X ~]$ ls -l /opt/elasticbeanstalk/hooks/appdeploy/
total 12
drwxr-xr-x 2 root root 4096 Dec  3 06:18 enact
drwxr-xr-x 2 root root 4096 Dec  3 06:18 post
drwxr-xr-x 2 root root 4096 Jun 22 23:34 pre
kbos
répondu il y a 6 ans
0

ありがとうございます!
都度 sudo コマンドにすることで解決致しました!

今まで動いていた方が不思議な状況だったのですね。

わざわざ私のために環境を作り、検証いただいて本当に感謝です。
ありがとうございました。

kbos
répondu il y a 6 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions