Remove notify app folder and installed python packages before we deploy the app

This commit is contained in:
Imdad Ahad
2017-02-13 17:13:39 +00:00
parent b2267ae5fc
commit 383553b964
2 changed files with 18 additions and 0 deletions

View File

@@ -5,6 +5,10 @@ files:
- destination: /home/notify-app/notifications-api - destination: /home/notify-app/notifications-api
source: / source: /
hooks: hooks:
BeforeInstall:
- location: scripts/aws_clear_instance.sh
runas: root
timeout: 1000
AfterInstall: AfterInstall:
- location: scripts/aws_install_dependencies.sh - location: scripts/aws_install_dependencies.sh
runas: root runas: root

14
scripts/aws_clear_instance.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/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 -vp /home/notify-app/notifications-api
# Remove installed py3 packages
pip3 freeze | xargs pip3 uninstall -y
else
echo "Directory does not exist, something went wrong!"
fi