From f19fd9cdd16be7690d1d3641c6eda938c4306f71 Mon Sep 17 00:00:00 2001 From: dvd Date: Wed, 29 May 2024 00:26:09 -0400 Subject: [PATCH 1/2] fix deploy script --- .github/workflows/deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 4f6c4ae..6acf564 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -130,7 +130,7 @@ jobs: docker ps -q --filter ancestor=${{ secrets.AWS_ECR_REPOSITORY }}:latest | xargs -r docker stop echo "Starting new Docker container..." - docker run -d -p 8080:8080 --env-file /path/to/.env ${{ secrets.AWS_ECR_REPOSITORY }}:latest + docker run -d -p 8080:8080 --env-file .env ${{ secrets.AWS_ECR_REPOSITORY }}:latest - name: Confirm server is up uses: appleboy/ssh-action@v0.1.0 @@ -142,7 +142,7 @@ jobs: echo "Waiting for server to start..." sleep 30 # Adjust sleep time as needed echo "Checking server status..." - if curl -s --head --request GET http://localhost:8080 | grep "200 OK" > /dev/null; then + if curl -s --head --request GET http://localhost:8080/flowsheet | grep "200 OK" > /dev/null; then echo "Server is up and running." else echo "Server is not running. Deployment failed." >&2 From 7d44236202c81c49dec9b8d68ddbbbd9f6b2daf9 Mon Sep 17 00:00:00 2001 From: dvd Date: Wed, 29 May 2024 00:43:02 -0400 Subject: [PATCH 2/2] remove old docker containers --- .github/workflows/deploy.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6acf564..bd890f1 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -126,8 +126,13 @@ jobs: echo "Pulling Docker image..." docker pull ${{ secrets.AWS_ECR_REPOSITORY }}:latest - echo "Stopping current Docker container..." - docker ps -q --filter ancestor=${{ secrets.AWS_ECR_REPOSITORY }}:latest | xargs -r docker stop + echo "Stopping any existing container using port 8080..." + docker ps --filter "ancestor=${{ secrets.AWS_ECR_REPOSITORY }}:latest" --format "{{.ID}}" | xargs -r docker stop + docker ps --filter "publish=8080" --format "{{.ID}}" | xargs -r docker stop + + echo "Removing any existing container using port 8080..." + docker ps -a --filter "ancestor=${{ secrets.AWS_ECR_REPOSITORY }}:latest" --format "{{.ID}}" | xargs -r docker rm + docker ps -a --filter "publish=8080" --format "{{.ID}}" | xargs -r docker rm echo "Starting new Docker container..." docker run -d -p 8080:8080 --env-file .env ${{ secrets.AWS_ECR_REPOSITORY }}:latest