-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3140b52
commit ee68860
Showing
1 changed file
with
15 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,7 +86,20 @@ jobs: | |
echo "Deployment successful" | ||
EOF | ||
# Step 8: Notify Slack - Success | ||
# Step 8: Verify Container Health | ||
- name: Verify Container Health | ||
env: | ||
VPS_IP: ${{ secrets.VPS_IP }} | ||
run: | | ||
health_status=$(sshpass -p "${{ secrets.SSH_PASSPHRASE }}" ssh -o StrictHostKeyChecking=no docker@${VPS_IP} "docker inspect --format '{{json .State.Health.Status}}' $(docker ps -q -f name=api)") | ||
if [[ "$health_status" != "\"healthy\"" ]]; then | ||
echo "API container is unhealthy! Status: $health_status" | ||
exit 1 | ||
else | ||
echo "API container is healthy." | ||
fi | ||
# Step 9: Notify Slack - Success | ||
- name: Notify Slack - Success | ||
if: success() | ||
uses: slackapi/[email protected] | ||
|
@@ -106,7 +119,7 @@ jobs: | |
short: true | ||
value: "The latest code was successfully deployed to the VPS." | ||
# Step 9: Notify Slack - Failure | ||
# Step 10: Notify Slack - Failure | ||
- name: Notify Slack - Failure | ||
if: failure() | ||
uses: slackapi/[email protected] | ||
|