Skip to content

Commit 27647dc

Browse files
authored
Reorg (#277)
* 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 * vault fixes * Update vault-oci-os-functions.env * Update vault-oci-os-functions.env * Update setup.sh * fixes * Update destroy.sh
1 parent b5ef117 commit 27647dc

File tree

14 files changed

+286
-176
lines changed

14 files changed

+286
-176
lines changed

common/docs/DeployFunctions.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
_Copyright (c) 2019, 2020, 2021 Oracle and/or its affiliates The Universal Permissive License (UPL), Version 1.0_
2+
3+
# Deployment Functions
4+
5+
The deployment helper functions are defined in common/utils/deploy-functions.env and sourced by common/source.env. They are used to streamline the deployment of microservices.
6+
7+
## k8s_deploy
8+
9+
Deploy a set of yaml files. The function accepts a single parameter that represents a space separate list of yaml files to be deployed, for example:
10+
11+
```
12+
k8s-deploy 'inventory-helidon-deployment.yaml inventory-service.yaml'
13+
```
14+
15+
### Internals
16+
17+
kubectl apply is used to deploy the files and so the k8s_deploy function is idempotent.
18+
19+
The yaml files are expected to be in the same folder as the script that invokes this function.
20+
21+
The yaml files are processed to substitute environment variables before they are deployed. The processed yaml files are place in the .deployed folder in the home directory of the microservice.
22+
23+
The syntax available to define substitution variable is as follows:
24+
25+
- **${VAR}** Fails if VAR is undefined, else is substitutes the value of VAR
26+
- **${VAR-default}** If VAR is not defined substitute 'default', else substitutes the value of VAR
27+
- **${VAR-}** If VAR is not defined substitute '', else it substitutes the value of VAR
28+
- **${VAR?MSG}** Fails if VAR is undefined with the error 'MSG', else it substitutes value of VAR
29+
- **${VAR:-default}** If VAR is not defined or empty, substitute 'default', else it substitutes the value of VAR
30+
- **${VAR:?MSG}** Fails if VAR is undefined or empty with the error 'MSG', else it substitutes the value of VAR
31+
32+
Here is an example:
33+
34+
```
35+
- name: OCI_REGION
36+
value: "${OCI_REGION-}"
37+
```
38+
39+
## k8s_undeploy
40+
41+
Undeploy the yaml files what were deployed by k82_deploy. The files are undeployed in the reverse order.
42+
43+
### Internals
44+
45+
The yaml files of the deployed resources are found in the .deployed folder. The files are deleted once thay have been undeployed.
46+
47+
kubectl delete is used to undeploy the resources.

grabdish/config/requirements.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44

55
# Variables to be set in input.env:
6-
# DB_DEPLOYMENT: 2db
6+
# DB_DEPLOYMENT: 1DB 2DB
77
# DB_TYPE: atp
88
# QUEUE_TYPE: classicq
99
# DB_PASSWORD_SECRET: Name of the secret holding the database password access by function get_secret
@@ -18,4 +18,4 @@
1818

1919
REQ_UTILS="touch cat rm sqlplus grep"
2020
REQ_INPUT_PARAMS="DB_DEPLOYMENT DB_TYPE QUEUE_TYPE DB_PASSWORD_SECRET UI_PASSWORD_SECRET DB1_NAME DB1_TNS_ADMIN DB1_ALIAS DB2_NAME DB2_TNS_ADMIN DB2_ALIAS CWALLET_OS_BUCKET OCI_REGION GRABDISH_LOG"
21-
REQ_OUTPUT_PARAMS="ORDER_DB_NAME ORDER_DB_ALIAS ORDER_DB_TNS_ADMIN INVENTORY_DB_NAME INVENTORY_DB_ALIAS INVENTORY_DB_TNS_ADMIN"
21+
REQ_OUTPUT_PARAMS="ORDER_DB_NAME ORDER_DB_ALIAS ORDER_DB_TNS_ADMIN INVENTORY_DB_NAME INVENTORY_DB_ALIAS INVENTORY_DB_TNS_ADMIN"

grabdish/docs/Build.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
_Copyright (c) 2019, 2020, 2021 Oracle and/or its affiliates The Universal Permissive License (UPL), Version 1.0_
2+
3+
# Grabdish Build Process
4+
5+
It is necessary to build the grabdish microservices before they can be deployed. Each microservice has its own build script. A build script compiles the code, constructs a docker image, and pushes the image to the repository. The image is used when deploying the microservice. It is possible to run the builds and provisioning in parallel to save time, however, building more than one java based microservice in parallel has been found to be unreliable and so is not recommended.
6+
7+
## Prerequisites
8+
9+
The following are required before building a Grabdish microservice:
10+
11+
1. Java installed
12+
2. Docker installed
13+
3. Docker image repository prepared
14+
4. Software cloned
15+
16+
## Environment Variables
17+
18+
To build grabdish services the following environment variables must be exported:
19+
20+
DOCKER_REGISTRY
21+
JAVA_HOME
22+
PATH=${JAVA_HOME}/bin:$PATH
23+
24+
## Steps
25+
26+
1. Change to a service's home folder, for example:
27+
28+
```
29+
cd inventory-helidon
30+
```
31+
32+
2. Execute the build script:
33+
34+
```
35+
./build.sh
36+
```

grabdish/docs/Deploy.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
_Copyright (c) 2019, 2020, 2021 Oracle and/or its affiliates The Universal Permissive License (UPL), Version 1.0_
2+
3+
# Grabdish Deployment
4+
5+
## Environment Variables
6+
7+
To deploy grabdish services the following environment variables must be exported. Note, most of these are outputs from the provisioning process:
8+
9+
- ORDER_DB_NAME
10+
- ORDER_DB_TNS_ADMIN
11+
- ORDER_DB_ALIAS
12+
- INVENTORY_DB_NAME
13+
- INVENTORY_DB_TNS_ADMIN
14+
- INVENTORY_DB_ALIAS
15+
- OCI_REGION: OCI vault only
16+
- VAULT_SECRET_OCID: OCI vault only
17+
18+
## Deploy Steps
19+
20+
1. Source the common environment:
21+
22+
source microservices-datadriven/common/source.env
23+
24+
2. Change to a microservice's home folder, for example:
25+
26+
```
27+
cd inventory-helidon
28+
```
29+
30+
3. Execute the deploy script:
31+
32+
```
33+
./deploy.sh
34+
```
35+
36+
## Undeploy Steps
37+
38+
1. Source the common environment:
39+
40+
source microservices-datadriven/common/source.env
41+
42+
2. Change to a microservice's home folder, for example:
43+
44+
```
45+
cd inventory-helidon
46+
```
47+
48+
3. Execute the undeploy script:
49+
50+
```
51+
./undeploy.sh
52+
```
53+
54+
## Internals
55+
56+
The deploy.sh and undeploy.sh scripts use the k8s_deploy andf k8s_undeploy helper functions respectively, defined in common/utils/deploy-functions.env and sourced by common/source.env. See common/docs/DeployFunctions.md for details.

grabdish/docs/ProvisionBuildDeploy.md

Lines changed: 0 additions & 152 deletions
This file was deleted.

0 commit comments

Comments
 (0)