Skip to content

Commit b5ef117

Browse files
authored
Reorg (#274)
* Reorg code * exec perms * Update setup.env * Update setup.env * fix * Update setup.env * Update setup.env * Update setup.sh * Update setup.sh * fixes * fixes * fixes * fixes * fixes * fixes * fixes * fixes * fixes * fixes * fixes * fixes * Update destroy.sh * fixes * fixes * fixes * Update destroy.sh * fixes * fixes * fixes * fixes * fixes * fixes * fixes * Update apply.sh * fixes * fixes * fixes * fixes * fixes * Create db-setup.sh * Update java-builds.sh * Update non-java-builds.sh * fixes * fixes * Update apply.env * fixes * fixes * fixes * fixes * fixes * fixes * fixes * Update main-setup.sh * Create database.tf * Update main-setup.sh * fixes * Update undeploy.sh * fixes * k6 change * use msdataworkshop namespace for ingress * Update apply.sh * fixes * Update source.env * fixes * ll * Update apply.sh * status * fixes * fixes * fixes * fixes * fixes * fixes * Update apply.sh * Update apply.sh * fixes * fixes * Update apply.sh * Update requirements.env * Update requirements.env * Update database.tf * fixes * Test1 * test2 * test3 * test4 * test5 * test6 * test7 * test7a * test8 * test8a * test9 * test10 * test10a * Test10b * test11 * test11 * test11a * test12 * test12 * test13 * test13a * test14 * test14a * test14b * test15 * test16 * test16b * test16c * test16d * Test17 * test18 * test1 * test2 * test3 * test4 * test5 * test6 * test7 * test 8 * test9 * test10 * test11 * test12 * test13 * test14 * test15 * test16 * test17 * test20 * test20a * test20b * test21 * test21a * test21b * test21c * test22 * test23 * test24 * test25 * test25a * test25b * test26 * test27 * test28 * test29 * test30 * test31 * test32 * test33 * test34 * test35 * test36 * test37 * test38 * test39 * test40 * test41 * test42 * Update setup.sh * test43 * test44 * Update source.env * PostReview * SQL File Renaming
1 parent 6e911a9 commit b5ef117

File tree

240 files changed

+6450
-1405
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

240 files changed

+6450
-1405
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Deployment artifacts
2+
.deployed/
3+
.deployed/*.yaml
4+
15
# Compiled class file
26
*.class
37

common/source.env

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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 source.env'"
8+
return 1
9+
fi
10+
11+
export MSDD_CODE="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd )"
12+
export MSDD_INFRA_CODE="$MSDD_CODE/infra"
13+
export MSDD_APPS_CODE="$MSDD_CODE"
14+
export MSDD_WORKSHOP_CODE="$MSDD_CODE/workshops"
15+
16+
source $MSDD_CODE/common/utils/provisioning-functions.env
17+
source $MSDD_CODE/common/utils/deploy-functions.env

common/utils/deploy-functions.env

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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+
6+
if ! (return 0 2>/dev/null); then
7+
echo "ERROR: Usage 'source deploy_functions.env'"
8+
return 1
9+
fi
10+
11+
12+
# k8s-deploy
13+
# Deploy a microservice
14+
# $1: Space separated list of files to be deployed (in order of deployment)
15+
#
16+
function k8s-deploy() {
17+
# Fail on error or inadvertently referencing undefined variables
18+
set -eu
19+
20+
# Locate the script directory. All the files are there.
21+
local SCRIPT_DIR=$(dirname "$0")
22+
if ! test -d $SCRIPT_DIR; then
23+
echo "ERROR: Script directory does not exist"
24+
return 1
25+
fi
26+
27+
# First parameter is required
28+
local DEPLOYMENT_FILES="$1"
29+
30+
local DEPLOYED_DIR=$SCRIPT_DIR/.deployed
31+
32+
local df
33+
for df in $DEPLOYMENT_FILES; do
34+
echo "Applying $df"
35+
mkdir -p $DEPLOYED_DIR
36+
37+
# Expand the deployment file into the deployed directory
38+
eval "cat >$DEPLOYED_DIR/$df <<!
39+
$(<$SCRIPT_DIR/$df)
40+
!
41+
"
42+
43+
# Apply
44+
kubectl apply -f $DEPLOYED_DIR/$df -n msdataworkshop
45+
done
46+
}
47+
48+
49+
# k8s-undeploy
50+
# Undeploy k8s resources previously deployed by k8s_deploy
51+
#
52+
function k8s-undeploy() {
53+
# Fail on error or inadvertently referencing undefined variables
54+
set -eu
55+
56+
# Locate the script directory. All the files are there.
57+
local SCRIPT_DIR=$(dirname "$0")
58+
if ! test -d $SCRIPT_DIR; then
59+
echo "ERROR: Script directory does not exist"
60+
return 1
61+
fi
62+
63+
local DEPLOYED_DIR=$SCRIPT_DIR/.deployed
64+
if ! test -d $DEPLOYED_DIR; then
65+
# Nothing deployed and so noting to do
66+
return 0
67+
fi
68+
cd $DEPLOYED_DIR
69+
70+
local df
71+
for df in $(ls -r); do
72+
echo "Deleting $df"
73+
# Delete
74+
kubectl delete -f $df -n msdataworkshop
75+
rm $df
76+
done
77+
}
78+
79+
export -f k8s-deploy
80+
export -f k8s-undeploy

0 commit comments

Comments
 (0)