I try to run a script from the moment the war loads, so here is the contents of the configurations
container_commands: 01_setup_apache: command: "cp .ebextensions/enable_mod_deflate.conf /etc/httpd/conf.d/enable_mod_deflate.conf" 02_setup_script: command: "sudo su root" 03_setup_script: command: "sudo mkdir -p /home/dev" 04_setup_script: command: "sudo chmod 777 /home/dev -R" 05_setup_script: command: "sudo cp .ebextensions/scripts/setup.sh /home/dev/" 06_setup_script: command: "sudo chmod +x /home/dev/setup.sh" 07_setup_script: command: "sudo /home/dev/setup.sh" 08-restart-apache: command: "sudo /etc/init.d/httpd restart"
I tried everything, but deployment was always aborted when running setup.sh. In the above example, it does not work on 07_setup_script
Here is the contents of the magazine
] : Starting activity... /Command 01_setup_apache] : Starting activity... /Command 01_setup_apache] : Completed activity. /Command 02_setup_script] : Starting activity... /Command 02_setup_script] : Completed activity. /Command 03_setup_script] : Starting activity... /Command 03_setup_script] : Completed activity. /Command 04_setup_script] : Starting activity... /Command 04_setup_script] : Completed activity. /Command 05_setup_script] : Starting activity... /Command 05_setup_script] : Completed activity. /Command 06_setup_script] : Starting activity... /Command 06_setup_script] : Completed activity. /Command 07_setup_script] : Starting activity... /Command 07_setup_script] : Activity execution failed, because: sudo: unable to execute /home/dev/setup.sh: No such file or directory (ElasticBeanstalk::ExternalInvocationError)
If ssh on the instances there is no folder or file there (/ home / dev) or (/home/dev/setup.sh), it seems that the previous commands were not executed, but the log says it is completed
I know there is a way to create a script file at runtime, but we can avoid this and just use the method described above.
source share