Skip to content

Commit 812b274

Browse files
authored
Application information + output for LB IP + deploy script (#7)
* Application information + output for LB IP + deploy script * Version
1 parent 4775264 commit 812b274

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

interface.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@ title: "App Stack for Java"
55
description: |
66
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.
77
schemaVersion: 1.1.0
8-
version: "20230607"
8+
version: "v0.1.3"
9+
informationalText: |
10+
For more information and product documentation please visit the <a href="https://github.com/oracle-quickstart/appstack/">App Stack project page</a> .
911
1012
logoUrl: "https://cloudmarketplace.oracle.com/marketplace/content?contentId=58352039"
1113

12-
source:
13-
type: marketplace
14-
reference: 47726045
15-
1614
locale: "en"
1715

1816
variableGroups:
@@ -817,7 +815,7 @@ outputGroups:
817815
outputs:
818816
app_url:
819817
type: link
820-
title: Open Application URL
818+
title: Application URL
821819
visible: true
822820

823821

output.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55

66
output "app_url" {
77
description = "Application URL : "
8-
value = (var.create_fqdn ? "https://${local.domain_name}" : oci_load_balancer.flexible_loadbalancer.ip_address_details[0].ip_address)
8+
value = (var.create_fqdn ? "https://${local.domain_name}" : "http://${oci_load_balancer.flexible_loadbalancer.ip_address_details[0].ip_address}")
99
}

update_container_instance.sh

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@
22
# Copyright (c) 2023, Oracle and/or its affiliates.
33
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
# drain backend from backend set
5-
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)
6-
if [[ $OUTPUT == *"FAILED"* ]] ; then
5+
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:]’)
6+
echo $OUTPUT
7+
if [ "$OUTPUT" = "FAILED" ] ; then
78
exit 1
89
else
910
echo "load balancer drained backend: $1"
1011
fi
1112

1213
# update backend
13-
OUTPUT=$(oci container-instances container-instance restart --container-instance-id $4 --wait-for-state SUCCEEDED --wait-for-state FAILED)
14-
if [[ $OUTPUT == *"FAILED"* ]] ; then
14+
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:]’)
15+
echo $OUTPUT
16+
if [ "$OUTPUT" = "FAILED" ] ; then
1517
exit 1
1618
else
1719
echo "updated container instance: $4"
@@ -20,8 +22,9 @@ fi
2022
# wait for container instance to come up again
2123
sleep 30
2224
OUTPUT="FAILED"
25+
echo $OUTPUT
2326
i=0
24-
while [[ $OUTPUT != *"OK"* ]]
27+
while [ "$OUTPUT" != "OK" ]
2528
do
2629
let "i+=1"
2730
if [ $i -gt 30 ]
@@ -30,16 +33,16 @@ do
3033
exit 1
3134
fi
3235
sleep 10
33-
OUTPUT=$(oci lb backend-health get --backend-name $1 --backend-set-name $2 --load-balancer-id $3)
36+
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:]’)
3437
echo $OUTPUT
3538
done
3639

3740
# undrain backend from backend set
38-
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)
41+
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:]’)
3942
echo $OUTPUT
40-
if [[ $OUTPUT == *"FAILED"* ]] ; then
43+
if [ "$OUTPUT" = "FAILED" ] ; then
4144
exit 1
4245
else
4346
echo "load balancer undrained backend: $1"
4447
fi
45-
exit 0
48+
exit 0

0 commit comments

Comments
 (0)