Skip to content

Commit 0791659

Browse files
authored
Resource checks (#33)
* 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 * Resource Checking and Remove Wallet.zip
1 parent 4ef20cb commit 0791659

File tree

2 files changed

+42
-16
lines changed

2 files changed

+42
-16
lines changed

grabdish/utils/db-setup.sh

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,6 @@ while ! state_done WALLET_GET; do
3939
done
4040

4141

42-
# Create Wallet in Object Store
43-
while ! state_done WALLET_ZIP_OBJECT; do
44-
cd $GRABDISH_HOME/wallet
45-
oci os object put --bucket-name "$(state_get RUN_NAME)" --name "wallet.zip" --file 'wallet.zip'
46-
cd $GRABDISH_HOME
47-
state_set_done WALLET_ZIP_OBJECT
48-
done
49-
50-
51-
# Create Authenticated Link to Wallet
52-
while ! state_done WALLET_ZIP_AUTH_URL; do
53-
ACCESS_URI=`oci os preauth-request create --object-name 'wallet.zip' --access-type 'ObjectRead' --bucket-name "$(state_get RUN_NAME)" --name 'grabdish' --time-expires $(date '+%Y-%m-%d' --date '+7 days') --query 'data."access-uri"' --raw-output`
54-
state_set WALLET_ZIP_AUTH_URL "https://objectstorage.$(state_get REGION).oraclecloud.com${ACCESS_URI}"
55-
done
56-
57-
5842
# Get DB Connection Wallet and to Object Store
5943
while ! state_done CWALLET_SSO_OBJECT; do
6044
cd $GRABDISH_HOME/wallet

grabdish/utils/main-setup.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,54 @@ while ! state_done RUN_TYPE; do
4949
state_set RUN_NAME "grabdish$(state_get RESERVATION_ID)"
5050
state_set ORDER_DB_NAME "ORDERDB$(state_get RESERVATION_ID)"
5151
state_set INVENTORY_DB_NAME "INVENTORY$(state_get RESERVATION_ID)"
52+
state_set_done OKE_LIMIT_CHECK
53+
state_set_done ATP_LIMIT_CHECK
5254
else
5355
state_set RUN_TYPE "1"
5456
fi
5557
done
5658

5759

60+
# Check OKE Limits
61+
if ! state_done OKE_LIMIT_CHECK; then
62+
# Cluster Service Limit
63+
OKE_LIMIT=`oci limits value list --compartment-id "$OCI_TENANCY" --service-name "container-engine" --query 'sum(data[?"name"=='"'cluster-count'"'].value)'`
64+
if test "$OKE_LIMIT" -lt 1; then
65+
echo 'The service limit for the "Container Engine" "Cluster Count" is insufficent to run this workshop. At least 1 is required.'
66+
exit
67+
elif test "$OKE_LIMIT" -eq 1; then
68+
echo 'You are limited to only one OKE cluster in this tenancy. This workshop will create one additional OKE cluster and so any other OKE clusters must be terminated.'
69+
read -p "Please confirm that no other un-terminated OKE clusters exist in this tenancy and then hit [RETURN]? " DUMMY
70+
fi
71+
state_set_done OKE_LIMIT_CHECK
72+
fi
73+
74+
75+
# Check ATP resource availability
76+
while ! state_done ATP_LIMIT_CHECK; do
77+
CHECK=1
78+
# ATP OCPU availability
79+
if test $(oci limits resource-availability get --compartment-id="$OCI_TENANCY" --service-name "database" --limit-name "atp-ocpu-count" --query 'to_string(min([data."fractional-availability",`4.0`]))' --raw-output) != '4.0'; then
80+
echo 'The "Autonomous Transaction Processing OCPU Count" resource availability is insufficent to run this workshop.'
81+
echo '4 OCPUs are required. Terminate some existing ATP databases and try again.'
82+
CHECK=0
83+
fi
84+
85+
# ATP storage availability
86+
if test $(oci limits resource-availability get --compartment-id="$OCI_TENANCY" --service-name "database" --limit-name "atp-total-storage-tb" --query 'to_string(min([data."fractional-availability",`2.0`]))' --raw-output) != '2.0'; then
87+
echo 'The "Autonomous Transaction Processing Total Storage (TB)" resource availability is insufficent to run this workshop.'
88+
echo '2 TB are required. Terminate some existing ATP databases and try again.'
89+
CHECK=0
90+
fi
91+
92+
if test $CHECK -eq 1; then
93+
state_set_done ATP_LIMIT_CHECK
94+
else
95+
read -p "Hit [RETURN] when you are ready to retry? " DUMMY
96+
fi
97+
done
98+
99+
58100
# Get Run Name from directory name
59101
while ! state_done RUN_NAME; do
60102
cd $GRABDISH_HOME

0 commit comments

Comments
 (0)