File tree Expand file tree Collapse file tree 13 files changed +387
-0
lines changed
grabdish/inventory-springboot
src/main/java/springboot/inventory Expand file tree Collapse file tree 13 files changed +387
-0
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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+
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments