From 461728159ecdcf3ac03eaa8a3d4e35b847c5bec2 Mon Sep 17 00:00:00 2001 From: David Whittington Date: Wed, 13 Dec 2023 15:19:43 -0600 Subject: [PATCH] ci(codedeploy): be extra sure container are shut down Appologies for the curn. Trying to track down a hopefully unrelated deployment issue before release. --- scripts/codedeploy/app-start | 5 +++++ scripts/codedeploy/before-install | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/scripts/codedeploy/app-start b/scripts/codedeploy/app-start index 8ef17b6..036a0f1 100755 --- a/scripts/codedeploy/app-start +++ b/scripts/codedeploy/app-start @@ -2,5 +2,10 @@ cd /opt/ar-io-node +# ensure containers are shut down +if [ "$(docker ps -q)" ]; then + docker-compose down +fi + # TODO use a pre-built image docker-compose up -d diff --git a/scripts/codedeploy/before-install b/scripts/codedeploy/before-install index 14adccc..ee8b48e 100755 --- a/scripts/codedeploy/before-install +++ b/scripts/codedeploy/before-install @@ -16,6 +16,11 @@ instance_id=$(curl -s http://169.254.169.254/latest/meta-data/instance-id) mkdir -p /efs/backups/$instance_id/sqlite/previous-before-install mkdir -p /efs/backups/$instance_id/sqlite/before-install +# ensure containers are shut down +if [ "$(docker ps -q)" ]; then + docker-compose down +fi + # keep an archive of the previous backup in case the copy fails if [ "$(ls /efs/backups/$instance_id/before-install/*.db)" ]; then mv /efs/backups/$instance_id/before-install/* /efs/backups/$instance_id/previous-before-install/