Skip to content

Commit 1bc30bf

Browse files
paulparkinsonRichardExleyrenagranat
authored
inventory-springboot basic setup, multicloud doc mods (#72)
* 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 * dotnet inventorylocation query * Update main-setup.sh * dotnet inventorylocation query * 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 * Update main-setup.sh * Manage Non-Java Builds Better * inventory-go work * Update main-destroy.sh * inventory-go work * inventory-go aq dequeue added * 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 * inventory-go working with pl/sql * Fixed inventory-helidon-se * Minor fixes * Update main-setup.sh * Update main-setup.sh * Update main-setup.sh * Update db-setup.sh * Update main-setup.sh * Update main-setup.sh * Update db-setup.sh * Update main-setup.sh * Update main-setup.sh * Update main-setup.sh * Update db-setup.sh * Fixes go build.sh fix * Update java-builds.sh * Update non-java-builds.sh * Update oke-setup.sh * Update oke-setup.sh * Update db-setup.sh * Update non-java-builds.sh * Update java-builds.sh * Update non-java-builds.sh * Update java-builds.sh * Update db-setup.sh * Update oke-setup.sh * Update java-builds.sh * Update non-java-builds.sh * Update java-builds.sh * Update non-java-builds.sh * Update oke-setup.sh * Simpler Approach * Update main-setup.sh * Update main-setup.sh * Update main-setup.sh * Update main-setup.sh * Update main-setup.sh * Update main-setup.sh * Update main-setup.sh Remove API Key based authentication as bug is fixed * Update main-destroy.sh Complete API Key removal * Update destroy.sh * Fix Inventory DotNet and Go * Update logback.xml Fixed inventory-helidon-se * Update db-setup.sh Protect password in it contains case special characters * dotnet and go services: switch to polling for msgs * verrazzano/multi-cloud work * verrazzano comp files * verrazzano/multi-cloud work * verrazzano/multi-cloud work * verrazzano/multi-cloud work * verrazzano/multi-cloud work * verrazzano/multi-cloud work * verrazzano/multi-cloud work * verrazzano/multi-cloud work * verrazzano/multi-cloud work * verrazzano/multi-cloud work * verrazzano/multi-cloud work * verrazzano/multi-cloud work * verrazzano/multi-cloud work * verrazzano/multi-cloud work * verrazzano/multi-cloud work * verrazzano/multi-cloud work * verrazzano/multi-cloud work * verrazzano/multi-cloud work * verrazzano/multi-cloud work * verrazzano/multi-cloud work * verrazzano/multi-cloud work * verrazzano/multi-cloud work * verrazzano/multi-cloud work * verrazzano/multi-cloud work * polyglot inventory service mods * verrazzano/multi-cloud work * verrazzano/multi-cloud work * verrazzano/multi-cloud work * verrazzano/multi-cloud work * verrazzano/multi-cloud work * verrazzano/multi-cloud work * verrazzano/multi-cloud work * inventory-springboot Co-authored-by: RichardExley <Richard.exley@oracle.com> Co-authored-by: irina granat <irina.granat@oracle.com>
1 parent 1ab6094 commit 1bc30bf

13 files changed

+387
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM maven:3.6.3-openjdk-11 AS maven_build
2+
COPY pom.xml /tmp/
3+
COPY src /tmp/src/
4+
WORKDIR /tmp/
5+
RUN mvn package
6+
FROM openjdk
7+
EXPOSE 8080
8+
CMD java -jar /data/inventory-springboot-0.1.0.jar
9+
COPY --from=maven_build /tmp/target/inventory-springboot-0.1.0.jar /data/inventory-springboot-0.1.0.jar
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+
6+
export IMAGE_NAME=inventory-springboot
7+
export IMAGE_VERSION=0.1
8+
9+
export DOCKER_REGISTRY=$(state_get DOCKER_REGISTRY)
10+
11+
if [ -z "$DOCKER_REGISTRY" ]; then
12+
echo "Error: DOCKER_REGISTRY env variable needs to be set!"
13+
exit 1
14+
fi
15+
16+
export IMAGE=${DOCKER_REGISTRY}/${IMAGE_NAME}:${IMAGE_VERSION}
17+
18+
#mvn package
19+
docker build -t=$IMAGE .
20+
21+
docker push "$IMAGE"
22+
if [ $? -eq 0 ]; then
23+
docker rmi "$IMAGE"
24+
fi
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
SCRIPT_DIR=$(dirname $0)
7+
8+
export DOCKER_REGISTRY="$(state_get DOCKER_REGISTRY)"
9+
export INVENTORY_PDB_NAME="$(state_get INVENTORY_DB_NAME)"
10+
export OCI_REGION="$(state_get OCI_REGION)"
11+
export VAULT_SECRET_OCID=""
12+
13+
echo create inventory-springboot OAM Component and ApplicationConfiguration
14+
export CURRENTTIME=$( date '+%F_%H:%M:%S' )
15+
echo CURRENTTIME is $CURRENTTIME ...this will be appended to generated deployment yaml
16+
17+
cp inventory-springboot-comp.yaml inventory-springboot-comp-$CURRENTTIME.yaml
18+
19+
#may hit sed incompat issue with mac
20+
sed -i "s|%DOCKER_REGISTRY%|${DOCKER_REGISTRY}|g" inventory-springboot-comp-$CURRENTTIME.yaml
21+
sed -i "s|%INVENTORY_PDB_NAME%|${INVENTORY_PDB_NAME}|g" inventory-springboot-comp-${CURRENTTIME}.yaml
22+
sed -i "s|%OCI_REGION%|${OCI_REGION}|g" inventory-springboot-comp-${CURRENTTIME}.yaml
23+
sed -i "s|%VAULT_SECRET_OCID%|${VAULT_SECRET_OCID}|g" inventory-springboot-comp-${CURRENTTIME}.yaml
24+
25+
if [ -z "$1" ]; then
26+
kubectl apply -f $SCRIPT_DIR/inventory-springboot-comp-$CURRENTTIME.yaml
27+
kubectl apply -f $SCRIPT_DIR/inventory-springboot-app.yaml
28+
else
29+
kubectl apply -f <(istioctl kube-inject -f $SCRIPT_DIR/inventory-springboot-comp-$CURRENTTIME.yaml) -n msdataworkshop
30+
fi
31+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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+
SCRIPT_DIR=$(dirname "$0")
6+
7+
export DOCKER_REGISTRY="$(state_get DOCKER_REGISTRY)"
8+
export INVENTORY_PDB_NAME="$(state_get INVENTORY_DB_NAME)"
9+
export OCI_REGION="$(state_get OCI_REGION)"
10+
export VAULT_SECRET_OCID=""
11+
12+
echo create inventory-springboot deployment...
13+
export CURRENTTIME=$( date '+%F_%H:%M:%S' )
14+
echo CURRENTTIME is $CURRENTTIME ...this will be appended to generated deployment yaml
15+
16+
cp inventory-springboot-deployment.yaml inventory-springboot-deployment-$CURRENTTIME.yaml
17+
18+
IMAGE_NAME="inventory-springboot"
19+
IMAGE_VERSION="0.1"
20+
21+
sed -i "s|%DOCKER_REGISTRY%|${DOCKER_REGISTRY}|g;s|%IMAGE_NAME%|${IMAGE_NAME}|g;s|%IMAGE_VERSION%|${IMAGE_VERSION}|g" inventory-springboot-deployment-${CURRENTTIME}.yaml
22+
sed -i "s|%INVENTORY_PDB_NAME%|${INVENTORY_PDB_NAME}|g" inventory-springboot-deployment-${CURRENTTIME}.yaml
23+
sed -i "s|%OCI_REGION%|${OCI_REGION}|g" inventory-springboot-deployment-${CURRENTTIME}.yaml
24+
sed -i "s|%VAULT_SECRET_OCID%|${VAULT_SECRET_OCID}|g" inventory-springboot-deployment-${CURRENTTIME}.yaml
25+
26+
if [ -z "$1" ]; then
27+
kubectl apply -f "$SCRIPT_DIR"/inventory-springboot-deployment-${CURRENTTIME}.yaml -n msdataworkshop
28+
else
29+
kubectl apply -f <(istioctl kube-inject -f "$SCRIPT_DIR"/inventory-springboot-deployment-${CURRENTTIME}.yaml) -n msdataworkshop
30+
fi
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Copyright (c) 2020, 2021, Oracle and/or its affiliates.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
3+
apiVersion: core.oam.dev/v1alpha2
4+
kind: Component
5+
metadata:
6+
name: inventory-springboot-component
7+
namespace: msdataworkshop
8+
spec:
9+
workload:
10+
apiVersion: oam.verrazzano.io/v1alpha1
11+
kind: VerrazzanoHelidonWorkload
12+
metadata:
13+
name: inventory-springboot-workload
14+
labels:
15+
app: inventory-springboot
16+
spec:
17+
deploymentTemplate:
18+
metadata:
19+
name: inventory-springboot-deployment
20+
podSpec:
21+
containers:
22+
- name: inventory
23+
imagePullPolicy: Always
24+
image: %DOCKER_REGISTRY%/%IMAGE_NAME%:%IMAGE_VERSION%
25+
volumeMounts:
26+
- name: creds
27+
mountPath: /msdataworkshop/creds
28+
ports:
29+
- containerPort: 8080
30+
livenessProbe:
31+
httpGet:
32+
path: /health/live
33+
port: 8080
34+
initialDelaySeconds: 20
35+
periodSeconds: 20
36+
timeoutSeconds: 5
37+
failureThreshold: 3
38+
readinessProbe:
39+
httpGet:
40+
path: /health/ready
41+
port: 8080
42+
initialDelaySeconds: 3
43+
periodSeconds: 3
44+
timeoutSeconds: 5
45+
failureThreshold: 20
46+
env:
47+
- name: LOG_LEVEL
48+
value: "DEBUG"
49+
- name: server_port
50+
value: "8080"
51+
- name: db_user
52+
value: "inventoryuser"
53+
- name: db_url
54+
value: "jdbc:oracle:thin:@%INVENTORY_PDB_NAME%_tp?TNS_ADMIN=/msdataworkshop/creds"
55+
- name: db_queueOwner
56+
value: "inventoryuser"
57+
- name: db_orderQueueName
58+
value: "orderqueue"
59+
- name: db_inventoryQueueName
60+
value: "inventoryqueue"
61+
- name: OCI_REGION
62+
value: "%OCI_REGION%"
63+
- name: VAULT_SECRET_OCID
64+
value: "%VAULT_SECRET_OCID%"
65+
- name: db_password
66+
valueFrom:
67+
secretKeyRef:
68+
name: dbuser
69+
key: dbpassword
70+
optional: true #not needed/used if using VAULT_SECRET_OCID exists
71+
restartPolicy: Always
72+
volumes:
73+
- name: creds
74+
secret:
75+
secretName: db-wallet-secret
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
2+
##
3+
## Copyright (c) 2021 Oracle and/or its affiliates.
4+
## Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
5+
apiVersion: apps/v1
6+
kind: Deployment
7+
metadata:
8+
name: inventory-springboot
9+
labels:
10+
app: inventory
11+
spec:
12+
replicas: 1
13+
selector:
14+
matchLabels:
15+
app: inventory
16+
template:
17+
metadata:
18+
labels:
19+
app: inventory
20+
version: springboot
21+
spec:
22+
containers:
23+
- name: inventory
24+
imagePullPolicy: Always
25+
image: %DOCKER_REGISTRY%/%IMAGE_NAME%:%IMAGE_VERSION%
26+
volumeMounts:
27+
- name: creds
28+
mountPath: /msdataworkshop/creds
29+
ports:
30+
- containerPort: 8080
31+
livenessProbe:
32+
httpGet:
33+
path: /health/live
34+
port: 8080
35+
initialDelaySeconds: 20
36+
periodSeconds: 20
37+
timeoutSeconds: 5
38+
failureThreshold: 3
39+
readinessProbe:
40+
httpGet:
41+
path: /health/ready
42+
port: 8080
43+
initialDelaySeconds: 3
44+
periodSeconds: 3
45+
timeoutSeconds: 5
46+
failureThreshold: 20
47+
env:
48+
- name: LOG_LEVEL
49+
value: "DEBUG"
50+
- name: server_port
51+
value: "8080"
52+
- name: db_user
53+
value: "inventoryuser"
54+
- name: db_url
55+
value: "jdbc:oracle:thin:@%INVENTORY_PDB_NAME%_tp?TNS_ADMIN=/msdataworkshop/creds"
56+
- name: db_queueOwner
57+
value: "inventoryuser"
58+
- name: db_orderQueueName
59+
value: "orderqueue"
60+
- name: db_inventoryQueueName
61+
value: "inventoryqueue"
62+
- name: OCI_REGION
63+
value: "%OCI_REGION%"
64+
- name: VAULT_SECRET_OCID
65+
value: "%VAULT_SECRET_OCID%"
66+
- name: db_password
67+
valueFrom:
68+
secretKeyRef:
69+
name: dbuser
70+
key: dbpassword
71+
optional: true #not needed/used if using VAULT_SECRET_OCID exists
72+
restartPolicy: Always
73+
volumes:
74+
- name: creds
75+
secret:
76+
secretName: db-wallet-secret
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
##
3+
## Copyright (c) 2021 Oracle and/or its affiliates.
4+
## Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
5+
apiVersion: v1
6+
kind: Service
7+
metadata:
8+
name: inventory
9+
labels:
10+
app: inventory
11+
spec:
12+
type: NodePort
13+
ports:
14+
- port: 8080
15+
name: http
16+
selector:
17+
app: inventory
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright (c) 2020, 2021, Oracle and/or its affiliates.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
3+
apiVersion: core.oam.dev/v1alpha2
4+
kind: ApplicationConfiguration
5+
metadata:
6+
name: inventory-springboot-appconf
7+
namespace: msdataworkshop
8+
annotations:
9+
version: v1.0.0
10+
description: "Inventory Helidon SE application"
11+
spec:
12+
components:
13+
- componentName: inventory-springboot-component
14+
traits:
15+
- trait:
16+
apiVersion: oam.verrazzano.io/v1alpha1
17+
kind: MetricsTrait
18+
spec:
19+
scraper: verrazzano-system/vmi-system-prometheus-0
20+
# - trait:
21+
# apiVersion: oam.verrazzano.io/v1alpha1
22+
# kind: IngressTrait
23+
# metadata:
24+
# name: inventory-springboot-ingress
25+
# spec:
26+
# rules:
27+
# - paths:
28+
# - path: "/"
29+
# pathType: Prefix

grabdish/inventory-springboot/pom.xml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<groupId>springboot</groupId>
7+
<artifactId>inventory-springboot</artifactId>
8+
<version>0.1.0</version>
9+
10+
<parent>
11+
<groupId>org.springframework.boot</groupId>
12+
<artifactId>spring-boot-starter-parent</artifactId>
13+
<version>2.2.1.RELEASE</version>
14+
</parent>
15+
16+
<dependencies>
17+
<dependency>
18+
<groupId>org.springframework.boot</groupId>
19+
<artifactId>spring-boot-starter-web</artifactId>
20+
</dependency>
21+
22+
<dependency>
23+
<groupId>junit</groupId>
24+
<artifactId>junit</artifactId>
25+
<version>4.13.1</version>
26+
<scope>test</scope>
27+
</dependency>
28+
29+
</dependencies>
30+
31+
<properties>
32+
<start-class>springboot.inventory.Application</start-class>
33+
</properties>
34+
35+
<build>
36+
<plugins>
37+
<plugin>
38+
<groupId>org.springframework.boot</groupId>
39+
<artifactId>spring-boot-maven-plugin</artifactId>
40+
</plugin>
41+
</plugins>
42+
</build>
43+
44+
</project>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package springboot.inventory;
2+
3+
4+
import org.springframework.boot.SpringApplication;
5+
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
6+
import org.springframework.context.ApplicationContext;
7+
import org.springframework.context.annotation.ComponentScan;
8+
import org.springframework.context.annotation.Configuration;
9+
10+
@Configuration
11+
@EnableAutoConfiguration
12+
@ComponentScan
13+
public class Application {
14+
15+
public static void main(String[] args) {
16+
ApplicationContext ctx = SpringApplication.run(Application.class, args);
17+
18+
}
19+
20+
}

0 commit comments

Comments
 (0)