0

I'm deploying a PHP application using following setup:

Setup

  1. Bitbucket pipeline builds the applucation using composer and creates a finished zip file.
  2. Bitbucket AWS Elastic Beanstalk deploys the code to a AWS Elastic Beanstalk application.
  3. The post install hook in opt/elasticbeanstalk/hooks/appdeploy/post does run the PHP script after the deployment

Problem

The PHP script which should be executed on the post deploy hook as a background task, never stops running. This effectively clogs the pipeline.

Screenshot of Pipeline running forever (stopped on purpose)

Bitbucket pipeline checking the health status of the AWS Elastic Beanstalk Application

Here is the code to the .ebextensions configuration file.

container_commands:
  01-create_post_hook:
    command: "mkdir -p /opt/elasticbeanstalk/hooks/appdeploy/post"
    ignoreErrors: true
files:
  "/opt/elasticbeanstalk/hooks/appdeploy/post/start.sh":
    mode: "000770"
    owner: root
    group: root
    content: | #!/bin/bash
      echo "--------Starting Runner------------"
      php /var/app/current/runner.php &

Questions

  • Is the bash script configured correctly to run in the background?
  • Is there another (recommended) way to execute a script after the application has been updated?

Notes

Since the script that is supposed to run in the background actually never finished, the health status of the application always remains at "info". This is a problem since it requires to be at "OK" for an application to be deployed successfully.

Application Health Stuck at "Info" rather than "OK"

Similar questions I've found throughout the internet:

https://forums.aws.amazon.com/thread.jspa?threadID=301439&tstart=0 https://forums.aws.amazon.com/thread.jspa?messageID=425130&#425130

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.