diff --git a/appspec.yml b/appspec.yml index a6455d55c..87a0f944a 100644 --- a/appspec.yml +++ b/appspec.yml @@ -5,6 +5,10 @@ files: - destination: /home/notify-app/notifications-api source: / hooks: + BeforeInstall: + - location: scripts/aws_clear_instance.sh + runas: root + timeout: 1000 AfterInstall: - location: scripts/aws_install_dependencies.sh runas: root diff --git a/scripts/aws_clear_instance.sh b/scripts/aws_clear_instance.sh new file mode 100755 index 000000000..9cdc14568 --- /dev/null +++ b/scripts/aws_clear_instance.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +echo "Removing application and dependencies" + +if [ -d "/home/notify-app/notifications-api" ]; then + # Remove and re-create the directory + rm -rf /home/notify-app/notifications-api + mkdir -p /home/notify-app/notifications-api +fi +