Skip to content

Commit

Permalink
CB fixes (#832)
Browse files Browse the repository at this point in the history
* CB fixes

* remove customer32 from CB (LL)

* README update
  • Loading branch information
andytael authored Feb 14, 2024
1 parent f6195d9 commit fea6ad8
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 61 deletions.
37 changes: 2 additions & 35 deletions cloudbank-v32/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ Version 3.2 of CloudBank is under development. This document and application is
[INFO] account ............................................ SUCCESS [ 2.904 s]
[INFO] checks ............................................. SUCCESS [ 1.168 s]
[INFO] customer ........................................... SUCCESS [ 1.198 s]
[INFO] customer32 ......................................... SUCCESS [ 1.133 s]
[INFO] creditscore ........................................ SUCCESS [ 0.956 s]
[INFO] transfer ........................................... SUCCESS [ 0.463 s]
[INFO] testrunner ......................................... SUCCESS [ 1.009 s]
Expand Down Expand Up @@ -98,8 +97,6 @@ Schema {account} was successfully Not_Modified and Kubernetes Secret {applicatio
Database/Service Password: *************
Schema {customer} was successfully Created and Kubernetes Secret {application/customer} was successfully Created.
Database/Service Password: *************
Schema {customer} was successfully Not_Modified and Kubernetes Secret {application/customer32} was successfully Created.
Database/Service Password: *************
Schema {account} was successfully Not_Modified and Kubernetes Secret {application/testrunner} was successfully Created.
uploading: account/target/account-0.0.1-SNAPSHOT.jar
building and pushing image...
Expand All @@ -116,12 +113,6 @@ NOTICE: service not accessible outside K8S
uploading: customer/target/customer-0.0.1-SNAPSHOT.jar
building and pushing image...
creating deployment and service...
obaas-cli [deploy]: Application was successfully deployed.
NOTICE: service not accessible outside K8S
uploading: customer32/target/customer32-0.0.1-SNAPSHOT.jar
building and pushing image...
creating deployment and service...
obaas-cli [deploy]: Application was successfully deployed.
NOTICE: service not accessible outside K8S
Expand Down Expand Up @@ -151,12 +142,10 @@ The following commands are executed:
bind --service-name account
bind --service-name checks --username account
bind --service-name customer
bind --service-name customer32 --username customer
bind --service-name testrunner --username account
deploy --service-name account --artifact-path account/target/account-0.0.1-SNAPSHOT.jar --image-version 0.0.1 --liquibase-db admin
deploy --service-name checks --artifact-path checks/target/checks-0.0.1-SNAPSHOT.jar --image-version 0.0.1
deploy --service-name customer --artifact-path customer/target/customer-0.0.1-SNAPSHOT.jar --image-version 0.0.1 --liquibase-db admin
deploy --service-name customer32 --artifact-path customer32/target/customer32-0.0.1-SNAPSHOT.jar --image-version 0.0.1 --liquibase-db admin
deploy --service-name creditscore --artifact-path creditscore/target/creditscore-0.0.1-SNAPSHOT.jar --image-version 0.0.1
deploy --service-name testrunner --artifact-path testrunner/target/testrunner-0.0.1-SNAPSHOT.jar --image-version 0.0.1
deploy --service-name transfer --artifact-path transfer/target/transfer-0.0.1-SNAPSHOT.jar --image-version 0.0.1
Expand Down Expand Up @@ -198,7 +187,6 @@ The following commands are executed:
create-autoscaler --service-name account --min-replicas 1 --max-replicas 4 --cpu-request 100m --cpu-percent 80
create-autoscaler --service-name checks --min-replicas 1 --max-replicas 4 --cpu-request 100m --cpu-percent 80
create-autoscaler --service-name customer --min-replicas 1 --max-replicas 4 --cpu-request 100m --cpu-percent 80
create-autoscaler --service-name customer32 --min-replicas 1 --max-replicas 4 --cpu-request 100m --cpu-percent 80
create-autoscaler --service-name creditscore --min-replicas 1 --max-replicas 4 --cpu-request 100m --cpu-percent 80
create-autoscaler --service-name testrunner --min-replicas 1 --max-replicas 4 --cpu-request 100m --cpu-percent 80
create-autoscaler --service-name transfer --min-replicas 1 --max-replicas 4 --cpu-request 100m --cpu-percent 80
Expand Down Expand Up @@ -276,27 +264,6 @@ This is an example of the `customer32` application:
]
```
1. Test `customer32` service
1. REST endpoint
```shell
curl -s http://<EXTERNAL-IP>/api/v2/customer | jq
```
Should return:
```json
[
{
"email": "andy@andy.com",
"id": "qwertysdwr",
"name": "Andy"
},
{...}
]
```
1. Test `creditscore` service
1. REST endpoint
Expand Down Expand Up @@ -529,9 +496,9 @@ This is an example of the `customer32` application:
![Jaeger Dashboard Login](images/jaeger.png " ")
1. Choose `customer32` Service and click *Find Traces*
1. Choose `customer` Service and click *Find Traces*
![Customer32](images/j-traces.png " ")
![Customer](images/j-traces.png " ")
1. Check the Grafana Dashboard
Expand Down
1 change: 0 additions & 1 deletion cloudbank-v32/apisix-routes/create-all-routes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ fi
source ./create-accounts-route.sh $1
source ./create-creditscore-route.sh $1
source ./create-customer-route.sh $1
source ./create-customer32-route.sh $1
source ./create-testrunner-route.sh $1
source ./create-transfer-route.sh $1
16 changes: 8 additions & 8 deletions cloudbank-v32/customer32-mongo/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Example of "customer32" reimplemented to use the Oracle Database API for MongoDB
# Example of "customer32" reimplemented to use the Oracle Database API for MongoDB

This directory provides an example of the [customer32](../customer32/) service reimplmented using [Oracle Database API for MongoDB](https://docs.oracle.com/en-us/iaas/autonomous-database-serverless/doc/mongo-using-oracle-database-api-mongodb.html) and [Spring Data MongoDB](https://docs.spring.io/spring-data/mongodb/reference/index.html).

Expand All @@ -20,33 +20,33 @@ Once that configuration is done, you can run the application using `mvn spring-b

- Create a customer

```
```shell
curl -i -X POST -H 'Content-Type: application/json' \
-d '{"name":"Bob Jones","email":"bob@job.com"}' \
http://localhost:8080/api/v1mongo/customer
```

- List customers
```
curl http://localhost:8080/api/v1mongo/customer|jq .

```shell
curl -s http://localhost:8080/api/v1mongo/customer | jq .
```

- Update a customer - make sure you use the correct ID from the output of the previous example

```
```shell
curl -i -X PUT -H 'Content-Type: application/json' \
-d '{"name":"Bob Jackson","email":"bob@jackson.com"}' \
http://localhost:8080/api/v1mongo/customer/65cb9ad3d0538471e9fb5f27
```

- Find a customer by email

```
```shell
curl -i http://localhost:8080/api/v1mongo/customer/email/bob@jackson.com
```

### Notes on the MongoDB connection
## Notes on the MongoDB connection

Please refer to the [Spring Data MongoDB documentation](https://docs.spring.io/spring-data/mongodb/reference/mongodb/configuration.html) for details of how to configure the connection and database.

Expand Down
11 changes: 2 additions & 9 deletions cloudbank-v32/customer32-mongo/pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) 2023, Oracle and/or its affiliates. -->
<!-- Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
Expand All @@ -8,25 +10,16 @@
<version>0.0.1-SNAPSHOT</version>
</parent>

<groupId>com.example</groupId>
<artifactId>customer32-mongo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>customer32-mongo</name>
<description>Customer32 service implemented with Oracle Database MongoDB API</description>

<properties>
<java.version>17</java.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
package com.example.customer32mongo.model;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

@Document("customers")
public class Customer {

@Id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@

# Copyright (c) 2023, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
#
# You must update the URI to match your Oracle Database instance - the USER, PASSWORD, HOSTNAME, and region need to be udpated.
# NOTE:
# You must update the URI to match your Oracle Database instance - the USER, PASSWORD, HOSTNAME, and region need to be udpated.
#

spring:
application:
name: customer32-mongodb
data:
mongodb:
uri: 'mongodb://USER:PASSWORD@HOSTNAME-MONGO1.adb.us-phoenix-1.oraclecloudapps.com:27017/USER?authMechanism=PLAIN&authSource=$external&ssl=true&retryWrites=false&loadBalanced=true'
Expand Down
1 change: 0 additions & 1 deletion cloudbank-v32/deploy-cmds/autoscale-cmd.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
create-autoscaler --service-name account --min-replicas 1 --max-replicas 4 --cpu-request 100m --cpu-percent 80
create-autoscaler --service-name checks --min-replicas 1 --max-replicas 4 --cpu-request 100m --cpu-percent 80
create-autoscaler --service-name customer --min-replicas 1 --max-replicas 4 --cpu-request 100m --cpu-percent 80
create-autoscaler --service-name customer32 --min-replicas 1 --max-replicas 4 --cpu-request 100m --cpu-percent 80
create-autoscaler --service-name creditscore --min-replicas 1 --max-replicas 4 --cpu-request 100m --cpu-percent 80
create-autoscaler --service-name testrunner --min-replicas 1 --max-replicas 4 --cpu-request 100m --cpu-percent 80
create-autoscaler --service-name transfer --min-replicas 1 --max-replicas 4 --cpu-request 100m --cpu-percent 80
1 change: 0 additions & 1 deletion cloudbank-v32/deploy-cmds/delete-autoscale-cmd.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
delete-autoscaler --service-name account
delete-autoscaler --service-name checks
delete-autoscaler --service-name customer
delete-autoscaler --service-name customer32
delete-autoscaler --service-name creditscore
delete-autoscaler --service-name testrunner
delete-autoscaler --service-name transfer
1 change: 0 additions & 1 deletion cloudbank-v32/deploy-cmds/deploy-app-only.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
deploy --service-name account --artifact-path account/target/account-0.0.1-SNAPSHOT.jar --image-version 0.0.1 --liquibase-db admin
deploy --service-name checks --artifact-path checks/target/checks-0.0.1-SNAPSHOT.jar --image-version 0.0.1
deploy --service-name customer --artifact-path customer/target/customer-0.0.1-SNAPSHOT.jar --image-version 0.0.1 --liquibase-db admin
deploy --service-name customer32 --artifact-path customer32/target/customer32-0.0.1-SNAPSHOT.jar --image-version 0.0.1 --liquibase-db admin
deploy --service-name creditscore --artifact-path creditscore/target/creditscore-0.0.1-SNAPSHOT.jar --image-version 0.0.1
deploy --service-name testrunner --artifact-path testrunner/target/testrunner-0.0.1-SNAPSHOT.jar --image-version 0.0.1
deploy --service-name transfer --artifact-path transfer/target/transfer-0.0.1-SNAPSHOT.jar --image-version 0.0.1
2 changes: 0 additions & 2 deletions cloudbank-v32/deploy-cmds/deploy-cb.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
bind --service-name account
bind --service-name checks --username account
bind --service-name customer
bind --service-name customer32 --username customer
bind --service-name testrunner --username account
deploy --service-name account --artifact-path account/target/account-0.0.1-SNAPSHOT.jar --image-version 0.0.1 --liquibase-db admin
deploy --service-name checks --artifact-path checks/target/checks-0.0.1-SNAPSHOT.jar --image-version 0.0.1
deploy --service-name customer --artifact-path customer/target/customer-0.0.1-SNAPSHOT.jar --image-version 0.0.1 --liquibase-db admin
deploy --service-name customer32 --artifact-path customer32/target/customer32-0.0.1-SNAPSHOT.jar --image-version 0.0.1 --liquibase-db admin
deploy --service-name creditscore --artifact-path creditscore/target/creditscore-0.0.1-SNAPSHOT.jar --image-version 0.0.1
deploy --service-name testrunner --artifact-path testrunner/target/testrunner-0.0.1-SNAPSHOT.jar --image-version 0.0.1
deploy --service-name transfer --artifact-path transfer/target/transfer-0.0.1-SNAPSHOT.jar --image-version 0.0.1
1 change: 0 additions & 1 deletion cloudbank-v32/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
<module>account</module>
<module>checks</module>
<module>customer</module>
<module>customer32</module>
<module>creditscore</module>
<module>transfer</module>
<module>testrunner</module>
Expand Down

0 comments on commit fea6ad8

Please sign in to comment.