Skip to content

Commit 7c4f93d

Browse files
authored
Merge pull request #17 from oracle/springboot-v1.0.1
Springboot v1.0.1
2 parents d3a31d7 + c377a87 commit 7c4f93d

20 files changed

+127
-46
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ frontend/build
4242
.env.development.local
4343
.env.test.local
4444
.env.production.local
45+
.idea
4546

4647
frontend/package-lock.json
4748
frontend/npm-debug.log*

MtdrSpring/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
**/node_modules/**
2+
**/build/**
3+
**/target/**

MtdrSpring/backend/src/main/resources/todolistapp-springboot.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@ apiVersion: v1
22
kind: Service
33
metadata:
44
name: todolistapp-springboot-service
5+
annotations:
6+
oci.oraclecloud.com/loadbalancer-policy: "IP_HASH"
57
spec:
68
type: LoadBalancer
9+
externalTrafficPolicy: Local
10+
711
ports:
812
- port: 80
913
protocol: TCP
@@ -32,7 +36,7 @@ spec:
3236
selector:
3337
matchLabels:
3438
app: todolistapp-springboot
35-
replicas: 1
39+
replicas: 2
3640
template:
3741
metadata:
3842
labels:

MtdrSpring/terraform/containerengine.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ resource "oci_containerengine_cluster" "mtdrworkshop_cluster" {
88
]
99
subnet_id = oci_core_subnet.endpoint.id
1010
}
11-
kubernetes_version = "v1.23.4"
12-
name = "mtdrworkshopcluster"
11+
kubernetes_version = "v1.25.4"
12+
name = "mtdrworkshopcluster-${var.mtdrKey}"
1313
vcn_id = oci_core_vcn.okevcn.id
1414
#optional
1515

@@ -36,7 +36,7 @@ resource "oci_containerengine_node_pool" "oke_node_pool" {
3636
#Required
3737
cluster_id = oci_containerengine_cluster.mtdrworkshop_cluster.id
3838
compartment_id = var.ociCompartmentOcid
39-
kubernetes_version = "v1.23.4"
39+
kubernetes_version = "v1.25.4"
4040
name = "Pool"
4141
# node_shape="VM.Standard2.4"
4242
# node_shape = "VM.Standard.B2.1"

MtdrSpring/terraform/core.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
resource "oci_core_vcn" "okevcn" {
33
cidr_block = "10.0.0.0/16"
44
compartment_id = var.ociCompartmentOcid
5-
display_name = "mtdrworkshop"
5+
display_name = "mtdrworkshop-${var.mtdrKey}"
66
dns_label = "mtdrworkshop"
77
}
88
resource "oci_core_internet_gateway" "igw" {

MtdrSpring/terraform/main-var.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ variable "ociUserOcid" {}
55
variable "ociCompartmentOcid" {}
66
variable "ociRegionIdentifier" {}
77
variable "mtdrDbName" {}
8-
variable "runName" {}
8+
variable "runName" {}
9+
10+
# mtdrKey is a unique generated id
11+
variable "mtdrKey" {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
data oci_objectstorage_namespace namespace {
2+
#Required
3+
compartment_id = var.ociCompartmentOcid
4+
}
5+
6+
resource "oci_objectstorage_bucket" dbbucket {
7+
#Required
8+
compartment_id = var.ociCompartmentOcid
9+
name = "${var.runName}-${var.mtdrKey}"
10+
namespace = data.oci_objectstorage_namespace.namespace.namespace
11+
}

MtdrSpring/terraform/outputs.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
output lab_oke_cluster_id {
2+
value = oci_containerengine_cluster.mtdrworkshop_cluster.id
3+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
resource "oci_artifacts_container_repository" todolist {
2+
#Required
3+
compartment_id = var.ociCompartmentOcid
4+
display_name = "${var.runName}/${var.mtdrKey}/todolistapp-springboot"
5+
is_public = true
6+
}

MtdrSpring/utils/db-setup.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ set -e
88

99
# Create Object Store Bucket (Should be replaced by terraform one day)
1010
while ! state_done OBJECT_STORE_BUCKET; do
11-
echo "creating object storage bucket"
12-
oci os bucket create --compartment-id "$(state_get COMPARTMENT_OCID)" --name "$(state_get RUN_NAME)"
13-
state_set_done OBJECT_STORE_BUCKET
14-
echo "finished creating object storage buckets"
11+
echo "Checking object storage bucket"
12+
# oci os bucket create --compartment-id "$(state_get COMPARTMENT_OCID)" --name "$(state_get RUN_NAME)"
13+
if oci os bucket get --name "$(state_get RUN_NAME)-$(state_get MTDR_KEY)"; then
14+
state_set_done OBJECT_STORE_BUCKET
15+
echo "finished checking object storage bucket"
16+
fi
1517
done
1618

1719

@@ -40,7 +42,7 @@ done
4042
while ! state_done CWALLET_SSO_OBJECT; do
4143
echo "grabbing wallet"
4244
cd $MTDRWORKSHOP_LOCATION/wallet
43-
oci os object put --bucket-name "$(state_get RUN_NAME)" --name "cwallet.sso" --file 'cwallet.sso'
45+
oci os object put --bucket-name "$(state_get RUN_NAME)-$(state_get MTDR_KEY)" --name "cwallet.sso" --file 'cwallet.sso'
4446
cd $MTDRWORKSHOP_LOCATION
4547
state_set_done CWALLET_SSO_OBJECT
4648
echo "done grabbing wallet"
@@ -50,7 +52,7 @@ done
5052
# Create Authenticated Link to Wallet
5153
while ! state_done CWALLET_SSO_AUTH_URL; do
5254
echo "creating authenticated link to wallet"
53-
ACCESS_URI=`oci os preauth-request create --object-name 'cwallet.sso' --access-type 'ObjectRead' --bucket-name "$(state_get RUN_NAME)" --name 'mtdrworkshop' --time-expires $(date '+%Y-%m-%d' --date '+7 days') --query 'data."access-uri"' --raw-output`
55+
ACCESS_URI=`oci os preauth-request create --object-name 'cwallet.sso' --access-type 'ObjectRead' --bucket-name "$(state_get RUN_NAME)-$(state_get MTDR_KEY)" --name 'mtdrworkshop' --time-expires $(date '+%Y-%m-%d' --date '+7 days') --query 'data."access-uri"' --raw-output`
5456
state_set CWALLET_SSO_AUTH_URL "https://objectstorage.$(state_get REGION).oraclecloud.com${ACCESS_URI}"
5557
echo "done creating authenticated link to wallet"
5658
done

0 commit comments

Comments
 (0)