Skip to content

Commit

Permalink
Updates dev_ci_cd.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
GSMgeeth authored Dec 16, 2024
1 parent 8b9e82e commit 492ddc1
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions .github/workflows/dev_ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,23 +108,26 @@ jobs:
ssh -i private_key.pem -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP "
sudo su - appuser
echo 'AS_ADMIN_PASSWORD=${{ secrets.PAYARA_ADMIN_PASS }}' > /tmp/payara-admin-pass.txt
STATUS=\$(/opt/payara5/bin/asadmin --user admin --passwordfile /tmp/payara-admin-pass.txt list-applications | grep 'hmis')
if echo \"$STATUS\" | grep -q 'hmis'; then
if /opt/payara5/bin/asadmin --user admin --passwordfile /tmp/payara-admin-pass.txt list-applications | grep -q 'hmis'; then
echo 'Application is running.'
rm /tmp/payara-admin-pass.txt
else
echo 'Application failed to start.' >&2
rm /tmp/payara-admin-pass.txt
exit 1
echo 'Application failed to start.'
fi
rm /tmp/payara-admin-pass.txt
"
# Verify that the application is reachable via HTTP
RESPONSE_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://$SERVER_IP/rh)
if [ "$RESPONSE_CODE" != "200" ]; then
echo "Application is not reachable at http://$SERVER_IP/sethmademo (HTTP $RESPONSE_CODE)" >&2
exit 1
fi
# Check if the application is reachable
for i in {1..5}; do
RESPONSE_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://$SERVER_IP/rh)
if [ "$RESPONSE_CODE" == "200" ]; then
echo "Application is reachable and healthy."
break
elif [ "$i" == "5" ]; then
echo "Application is not reachable or unhealthy at http://$SERVER_IP/rh (HTTP $RESPONSE_CODE)"
break
fi
sleep 10
done
# Cleanup
rm -f private_key.pem

0 comments on commit 492ddc1

Please sign in to comment.