Skip to content

Commit

Permalink
Application information + output for LB IP + deploy script (#7)
Browse files Browse the repository at this point in the history
* Application information + output for LB IP + deploy script

* Version
  • Loading branch information
fmeheust authored Jul 6, 2023
1 parent 4775264 commit 812b274
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
10 changes: 4 additions & 6 deletions interface.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ title: "App Stack for Java"
description: |
The App Stack for Java can deploy existing Java applications to serverless Container Instances behind a load balancer in the Oracle Cloud. It supports multiple options: the source code of the application is in DevOps, the application is uploaded as a war or jar, or as a container image.
schemaVersion: 1.1.0
version: "20230607"
version: "v0.1.3"
informationalText: |
For more information and product documentation please visit the <a href="https://github.com/oracle-quickstart/appstack/">App Stack project page</a> .
logoUrl: "https://cloudmarketplace.oracle.com/marketplace/content?contentId=58352039"

source:
type: marketplace
reference: 47726045

locale: "en"

variableGroups:
Expand Down Expand Up @@ -817,7 +815,7 @@ outputGroups:
outputs:
app_url:
type: link
title: Open Application URL
title: Application URL
visible: true


Expand Down
2 changes: 1 addition & 1 deletion output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@

output "app_url" {
description = "Application URL : "
value = (var.create_fqdn ? "https://${local.domain_name}" : oci_load_balancer.flexible_loadbalancer.ip_address_details[0].ip_address)
value = (var.create_fqdn ? "https://${local.domain_name}" : "http://${oci_load_balancer.flexible_loadbalancer.ip_address_details[0].ip_address}")
}
21 changes: 12 additions & 9 deletions update_container_instance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
# Copyright (c) 2023, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
# drain backend from backend set
OUTPUT=$(oci lb backend update --backend-name $1 --backend-set-name $2 --backup false --drain true --load-balancer-id $3 --offline false --weight 1 --wait-for-state SUCCEEDED --wait-for-state FAILED)
if [[ $OUTPUT == *"FAILED"* ]] ; then
OUTPUT=$(oci lb backend update --backend-name $1 --backend-set-name $2 --backup false --drain true --load-balancer-id $3 --offline false --weight 1 --wait-for-state SUCCEEDED --wait-for-state FAILED | python3 -c "import sys, json; print(json.load(sys.stdin)['data']['lifecycle-state'])" | tr ‘[:lower:]’ ‘[:upper:]’)
echo $OUTPUT
if [ "$OUTPUT" = "FAILED" ] ; then
exit 1
else
echo "load balancer drained backend: $1"
fi

# update backend
OUTPUT=$(oci container-instances container-instance restart --container-instance-id $4 --wait-for-state SUCCEEDED --wait-for-state FAILED)
if [[ $OUTPUT == *"FAILED"* ]] ; then
OUTPUT=$(oci container-instances container-instance restart --container-instance-id $4 --wait-for-state SUCCEEDED --wait-for-state FAILED | python3 -c "import sys, json; print(json.load(sys.stdin)['data']['status'])" | tr ‘[:lower:]’ ‘[:upper:]’)
echo $OUTPUT
if [ "$OUTPUT" = "FAILED" ] ; then
exit 1
else
echo "updated container instance: $4"
Expand All @@ -20,8 +22,9 @@ fi
# wait for container instance to come up again
sleep 30
OUTPUT="FAILED"
echo $OUTPUT
i=0
while [[ $OUTPUT != *"OK"* ]]
while [ "$OUTPUT" != "OK" ]
do
let "i+=1"
if [ $i -gt 30 ]
Expand All @@ -30,16 +33,16 @@ do
exit 1
fi
sleep 10
OUTPUT=$(oci lb backend-health get --backend-name $1 --backend-set-name $2 --load-balancer-id $3)
OUTPUT=$(oci lb backend-health get --backend-name $1 --backend-set-name $2 --load-balancer-id $3 | python3 -c "import sys, json; print(json.load(sys.stdin)['data']['status'])" | tr ‘[:lower:]’ ‘[:upper:]’)
echo $OUTPUT
done

# undrain backend from backend set
OUTPUT=$(oci lb backend update --backend-name $1 --backend-set-name $2 --backup false --drain false --load-balancer-id $3 --offline false --weight 1 --wait-for-state SUCCEEDED --wait-for-state FAILED)
OUTPUT=$(oci lb backend update --backend-name $1 --backend-set-name $2 --backup false --drain false --load-balancer-id $3 --offline false --weight 1 --wait-for-state SUCCEEDED --wait-for-state FAILED | python3 -c "import sys, json; print(json.load(sys.stdin)['data']['lifecycle-state'])" | tr ‘[:lower:]’ ‘[:upper:]’)
echo $OUTPUT
if [[ $OUTPUT == *"FAILED"* ]] ; then
if [ "$OUTPUT" = "FAILED" ] ; then
exit 1
else
echo "load balancer undrained backend: $1"
fi
exit 0
exit 0

0 comments on commit 812b274

Please sign in to comment.