I'm deploying a PHP application using following setup:
- Bitbucket pipeline builds the applucation using composer and creates a finished zip file.
- Bitbucket AWS Elastic Beanstalk deploys the code to a AWS Elastic Beanstalk application.
- The post install hook in opt/elasticbeanstalk/hooks/appdeploy/post does run the PHP script after the deployment
The PHP script which should be executed on the post deploy hook as a background task, never stops running. This effectively clogs the pipeline.
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 &
- 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?
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.
Similar questions I've found throughout the internet: