Skip to content

Commit 96ee71e

Browse files
authored
Final Live Labs Deployment Changes (#75)
* first-round * second-set * third-push * push4 * push5 * push6 * push * push * push * push * fixes * fixes * fixes * fixes * fixes * fixes * fixes * terra optimizations * terra fixes * env.sh and fixes * docker login fix * take out vaults for now * fixes * fixes * fixes * fixes * fixes * fixes * fixes * Deploy fixes and new terraform * terraform reorg and fixes * oci_core_services fix * Update core.tf * Update core.tf * Update main-destroy.sh * fixes * Update core.tf * fixes * Update oke-setup.sh * fixes * Boost Node CPU and Memory * Rename states for clarity * Update containerengine.tf * Update main-setup.sh * Build perf and main-setup.sh restart * fix * compute shape and docker login enhancements * Update main-setup.sh * build perf tuning * build fixes * Update build-all.sh * Update oci-cli-cs-key-auth.sh * terraform 3 AD * Update oci-cli-cs-key-auth.sh * Update core.tf * fixes * Update core.tf * fixes Uncomment Internet Gateway Comment DHCP settings Move SSL creation to earlier Add wait for OKE to warm up * fixes PropSetup Back to single domain Wait for OKE nodes msdataworkshop alias cwallet.sso name change remove terraform-orig * fixes wallet.zip VM.Standard.B1.1 image Prune terraform status to 60 characters * fixes add cwallet.sso link rm wallet folder (for security) * fixes Destroy new object atp secrets wait for OKE improved logging and setup handling * minor fixes * Fixes Remove RUN_TYPE for now Execute JAVA_BUILD and NON_JAVA_BUILD from main-setup * Fixes No Key Generated messages Improve end of setup * Update containerengine.tf Change image shape * Fixes Hardening oke-setup Different Shape * Update oke-setup.sh Hardening * Parallel Destroy Make destroy run in parallel * chmod * Update main-setup.sh More hardening * Update main-setup.sh * Update oke-setup.sh More defensive code * Typo * SODA build + cleanup Replace SODA jar with maven dependency Remove old scripts Fix global deploy/undeploy scripts * Reorg Jaeger * Jaeger Fixes * DB Prep in Setup and DB Name Changes Moved DB Setup from Java to Shell Change DB Name to o and i * Fixes and Start of GB Integration * DB Name Changes * Update db-setup.sh Fixes * Update db-setup.sh * GB Integration and Prop Fixes * fixes * Update oci-cli-cs-key-auth.sh * Removed DB Setup from UI * Update oci-cli-cs-key-auth.sh * Dot Net and Go * Fixes * Manage Non-Java Builds Better * Update main-destroy.sh * Build Reorg * Update main-setup.sh Reorg password collection * Update main-setup.sh Minor fixes * Minor Fixes * Binding Changes * Fixes * Remove Legacy Code Removed admin-helidon, atp-setup, Removed initContainers from deployment yamls * Fixed inventory-helidon-se * Minor fixes * Fixes go build.sh fix * Update oke-setup.sh * Update db-setup.sh Fixed unprotected password * GB Fix and Autotest * Fixes * Update oke-setup.sh * Avoid Concurrent kubectl * Update oke-setup.sh * kubectl perf booster * kube token cache * Build reordering * Update main-setup.sh * Update main-setup.sh * Update main-setup.sh * Update main-setup.sh * Automatic Testing * Perms * Fixes * Update main-test.sh
1 parent 25512fd commit 96ee71e

File tree

6 files changed

+249
-23
lines changed

6 files changed

+249
-23
lines changed

grabdish/test.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
# Copyright (c) 2021 Oracle and/or its affiliates.
3+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
4+
5+
# Make sure this is run via source or .
6+
if ! (return 0 2>/dev/null); then
7+
echo "ERROR: Usage 'source test.sh $USER_OCID'"
8+
exit
9+
fi
10+
11+
TEST_SCRIPT="$GRABDISH_HOME/utils/main-test.sh"
12+
$TEST_SCRIPT 2>&1 | tee -ai $GRABDISH_LOG/main-test.log

grabdish/utils/func-test.sh

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/bin/bash
2+
# Copyright (c) 2021 Oracle and/or its affiliates.
3+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
4+
5+
# Fail on error
6+
set -e
7+
8+
ORDER_ID="$1"
9+
10+
function order() {
11+
echo '{"serviceName": "order", "commandName": "'"$2"'", "orderId": '"$1"', "orderItem": "sushi", "deliverTo": "780 PANORAMA DR, San francisco, CA"}'
12+
}
13+
14+
function inventory() {
15+
echo '{"serviceName": "supplier", "commandName": "'"$2"'", "orderId": "-1", "orderItem": '"$1"', "deliverTo": ""}'
16+
}
17+
18+
function placeOrderTest() {
19+
# Place order
20+
if wget --http-user grabdish --http-password "$TEST_UI_PASSWORD" --no-check-certificate --post-data "$(order "$1" 'placeOrder')" \
21+
--header='Content-Type: application/json' "$(state_get FRONTEND_URL)/placeorder"; then
22+
echo "placeOrder $1 failed"
23+
return 1
24+
fi
25+
}
26+
27+
function showOrderTest() {
28+
# Place order
29+
if wget --http-user grabdish --http-password "$TEST_UI_PASSWORD" --no-check-certificate --post-data "$(order "$1" 'showorder')" \
30+
--header='Content-Type: application/json' "$(state_get FRONTEND_URL)/command" > $GRUBDASH_LOG/order; then
31+
echo "showOrder $1 failed"
32+
return 1
33+
fi
34+
35+
echo $GRUBDASH_LOG/order
36+
}
37+
38+
function addInventoryTest() {
39+
# Place order
40+
if wget --http-user grabdish --http-password "$TEST_UI_PASSWORD" --no-check-certificate --post-data "$(inventory "$1" 'addInventory')" \
41+
--header='Content-Type: application/json' "$(state_get FRONTEND_URL)/command"; then
42+
echo "showOrder $1 failed"
43+
return 1
44+
fi
45+
}
46+
47+
48+
# Show order and wait for status "no inventory"
49+
placeOrderTest $ORDER_ID
50+
51+
sleep 5
52+
53+
showOrderTest $ORDER_ID 'no inventory'
54+
55+
56+
# Add inventory
57+
addInventoryTest "sushi"
58+
59+
60+
# Place second order
61+
ORDER_ID=$(($ORDER_ID + 1))
62+
63+
placeOrderTest "$ORDER_ID"
64+
65+
sleep 5
66+
67+
showOrderTest "$ORDER_ID" 'inventory exists'

grabdish/utils/main-setup.sh

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,26 @@ if state_done SETUP_VERIFIED; then
1919
fi
2020

2121

22+
# Identify Run Type
23+
while ! state_done RUN_TYPE; do
24+
if [[ "$HOME" =~ /home/ll[0-9]{1,4}_use$ ]]; then
25+
# Green Button
26+
state_set RUN_TYPE "3"
27+
state_set RESERVATION_ID `grep -oP '(?<=/home/ll).*?(?=_use)' <<<"$HOME"`
28+
state_set USER_OCID 'NA'
29+
state_set USER_NAME "LL$(state_get RESERVATION_ID)-USER"
30+
state_set_done PROVISIONING
31+
state_set RUN_NAME "grabdish$(state_get RESERVATION_ID)"
32+
state_set ORDER_DB_NAME "ORDER$(state_get RESERVATION_ID)"
33+
state_set INVENTORY_DB_NAME "INVENTORY$(state_get RESERVATION_ID)"
34+
state_set_done OKE_LIMIT_CHECK
35+
state_set_done ATP_LIMIT_CHECK
36+
else
37+
state_set RUN_TYPE "1"
38+
fi
39+
done
40+
41+
2242
# Get the User OCID
2343
while ! state_done USER_OCID; do
2444
if test -z "$TEST_USER_OCID"; then
@@ -43,24 +63,6 @@ while ! state_done USER_NAME; do
4363
done
4464

4565

46-
# Identify Run Type
47-
while ! state_done RUN_TYPE; do
48-
if [[ "$(state_get USER_NAME)" =~ LL[0-9]{1,5}-USER$ ]]; then
49-
# Green Button
50-
state_set RUN_TYPE "3"
51-
state_set RESERVATION_ID `grep -oP '(?<=LL).*?(?=-USER)' <<<"$(state_get USER_NAME)"`
52-
state_set_done PROVISIONING
53-
state_set RUN_NAME "grabdish$(state_get RESERVATION_ID)"
54-
state_set ORDER_DB_NAME "ORDER$(state_get RESERVATION_ID)"
55-
state_set INVENTORY_DB_NAME "INVENTORY$(state_get RESERVATION_ID)"
56-
state_set_done OKE_LIMIT_CHECK
57-
state_set_done ATP_LIMIT_CHECK
58-
else
59-
state_set RUN_TYPE "1"
60-
fi
61-
done
62-
63-
6466
# Get Run Name from directory name
6567
while ! state_done RUN_NAME; do
6668
cd $GRABDISH_HOME
@@ -93,9 +95,11 @@ done
9395

9496
# Double check and then set the region
9597
while ! state_done REGION; do
96-
HOME_REGION=`oci iam region-subscription list --query 'data[?"is-home-region"]."region-name" | join('\'' '\'', @)' --raw-output`
98+
if test $(state_get RUN_TYPE) -eq 1; then
99+
HOME_REGION=`oci iam region-subscription list --query 'data[?"is-home-region"]."region-name" | join('\'' '\'', @)' --raw-output`
100+
state_set HOME_REGION "$HOME_REGION"
101+
fi
97102
state_set REGION "$OCI_REGION" # Set in cloud shell env
98-
state_set HOME_REGION "$HOME_REGION"
99103
done
100104

101105

@@ -194,9 +198,7 @@ fi
194198

195199
# Get Namespace
196200
while ! state_done NAMESPACE; do
197-
export OCI_CLI_PROFILE=$(state_get HOME_REGION)
198201
NAMESPACE=`oci os ns get --compartment-id "$(state_get COMPARTMENT_OCID)" --query "data" --raw-output`
199-
export OCI_CLI_PROFILE=$(state_get REGION)
200202
state_set NAMESPACE "$NAMESPACE"
201203
done
202204

@@ -218,7 +220,7 @@ while ! state_done DOCKER_REGISTRY; do
218220
fi
219221
fi
220222
else
221-
read -p "Please generate an Auth Token and enter the value: " TOKEN
223+
read -s -r -p "Please generate an Auth Token and enter the value: " TOKEN
222224
fi
223225

224226
RETRIES=0

grabdish/utils/main-test.sh

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#!/bin/bash
2+
# Copyright (c) 2021 Oracle and/or its affiliates.
3+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
4+
5+
# Fail on error
6+
set -e
7+
8+
# Check home is set
9+
if test -z "$GRABDISH_HOME"; then
10+
echo "ERROR: This script requires GRABDISH_HOME to be set"
11+
exit
12+
fi
13+
14+
15+
# SETUP
16+
export TEST_DB_PASSWORD='Welcome12345;#!:'
17+
# export TEST_UI_PASSWORD='Welcome1;"#!:'
18+
export TEST_UI_PASSWORD='Welcome1'
19+
if ! state_done SETUP_VERIFIED; then
20+
docker image prune -a -f
21+
source setup.sh
22+
fi
23+
24+
if ! state_done SETUP_VERIFIED; then
25+
echo "SETUP failed"
26+
return 1
27+
fi
28+
29+
# WALKTHROUGH
30+
# Deploy the java services
31+
./deploy.sh
32+
33+
sleep 60
34+
35+
# Get the frontend URL
36+
RETRIES=0
37+
while ! state_done FRONTEND_URL; do
38+
if IP=`kubectl get services -n msdataworkshop | awk '/frontend/ {print $4}'`; then
39+
state_set FRONTEND_URL "https://$IP"
40+
else
41+
RETRIES=$(($RETRIES + 1))
42+
if test $RETRIES -gt 10; then
43+
echo "ERROR: Failed to get FRONTEND_URL"
44+
exit
45+
fi
46+
sleep 5
47+
fi
48+
done
49+
50+
# Is the UI available?
51+
if wget -qO- --no-check-certificate --http-user grabdish --http-password "$TEST_UI_PASSWORD" "$(state_get FRONTEND_URL)" | grep 'GrabDish Explorer' >/dev/null; then
52+
echo "ERROR: UI Unavailable"
53+
fi
54+
55+
# Functional test on order 66/67
56+
utils/func-test.sh 66
57+
58+
59+
# POLYGLOT
60+
# Deploy each inventory service and perform functional test
61+
utils/polyglot-test.sh
62+
63+
64+
# SCALING
65+
# utils/scaling-test.sh
66+
67+
68+
# TRACING
69+
# TODO
70+
71+
# APEX
72+
# TODO
73+
74+
75+
# TEARDOWN
76+
source destroy.sh

grabdish/utils/polyglot-test.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
# Copyright (c) 2021 Oracle and/or its affiliates.
3+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
4+
5+
# Fail on error
6+
set -e
7+
8+
# Deploy each inventory service and perform functional test
9+
SERVICES="inventory-python inventory-nodejs inventory-dotnet inventory-go inventory-helidon-se"
10+
ORDER_ID=66
11+
12+
PREV_SERVICE="inventory-helidon"
13+
for s in $SERVICES; do
14+
echo "Testing $s"
15+
cd $GRABDISH_HOME/"$PREV_SERVICE"
16+
./undeploy.sh
17+
cd $GRABDISH_HOME/$s
18+
./deploy.sh
19+
sleep 60
20+
cd $GRABDISH_HOME
21+
ORDER_ID=$(($ORDER_ID + 100))
22+
utils/func-test.sh $ORDER_ID
23+
PREV_SERVICE=$s
24+
done

grabdish/utils/scaling-test.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
# Copyright (c) 2021 Oracle and/or its affiliates.
3+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
4+
5+
# Fail on error
6+
set -e
7+
8+
9+
# Deploy the external load balancer
10+
11+
12+
# Install k6
13+
14+
15+
# Get LB (way have to retry)
16+
17+
18+
# Execute load test scale 1/1
19+
20+
21+
# Scale app to 2
22+
23+
24+
# Execute load test scale 2/1
25+
26+
27+
# Scale app to 3
28+
29+
30+
# Execute load test scale 3/1
31+
32+
33+
# Scale db to 2
34+
35+
36+
# Execute load test scale 3/2
37+
38+
39+
# Scale down to 1/1
40+
41+
42+
43+
44+
45+

0 commit comments

Comments
 (0)