|
| 1 | +# CloudBank Version 3 |
| 2 | + |
| 3 | +This Spring Boot project is used in the [Oracle Backend Platform for Microservices with Oracle Database](https://apexapps.oracle.com/pls/apex/dbpm/r/livelabs/view-workshop?wid=3607) Live Lab. |
| 4 | + |
| 5 | +Please visit the Live Lab for more information. |
| 6 | + |
| 7 | +## Build cloudbank |
| 8 | + |
| 9 | + `mvn clean package -Dmaven.test.skip=true` |
| 10 | + |
| 11 | + ```text |
| 12 | + [INFO] ------------------------------------------------------------------------ |
| 13 | + [INFO] Reactor Summary for cloudbank 0.0.1-SNAPSHOT: |
| 14 | + [INFO] |
| 15 | + [INFO] cloudbank .......................................... SUCCESS [ 0.456 s] |
| 16 | + [INFO] account ............................................ SUCCESS [ 0.507 s] |
| 17 | + [INFO] customer ........................................... SUCCESS [ 0.079 s] |
| 18 | + [INFO] creditscore ........................................ SUCCESS [ 0.049 s] |
| 19 | + [INFO] transfer ........................................... SUCCESS [ 0.053 s] |
| 20 | + [INFO] testrunner ......................................... SUCCESS [ 0.050 s] |
| 21 | + [INFO] checks ............................................. SUCCESS [ 0.245 s] |
| 22 | + [INFO] ------------------------------------------------------------------------ |
| 23 | + [INFO] BUILD SUCCESS |
| 24 | + [INFO] ------------------------------------------------------------------------ |
| 25 | + [INFO] Total time: 1.633 s |
| 26 | + [INFO] Finished at: 2023-10-09T09:34:43-05:00 |
| 27 | + [INFO] ------------------------------------------------------------------------ |
| 28 | + ``` |
| 29 | + |
| 30 | +## Deploying Cloudbank |
| 31 | + |
| 32 | +1. Start the tunnel |
| 33 | + |
| 34 | + `kpf -n obaas-admin svc/obaas-admin 8080` |
| 35 | + |
| 36 | +1. Login |
| 37 | + |
| 38 | + ```shell |
| 39 | + oractl:>connect |
| 40 | + password (defaults to oractl): |
| 41 | + using default value... |
| 42 | + connect successful server version:0.3.0 |
| 43 | + ``` |
| 44 | + |
| 45 | +1. Create namespace |
| 46 | + |
| 47 | + ```shell |
| 48 | + oractl:>create --app-name cbv3 |
| 49 | + ``` |
| 50 | + |
| 51 | +1. Deploy account service |
| 52 | + |
| 53 | + 1. bind |
| 54 | + |
| 55 | + ```shell |
| 56 | + oractl:>bind --app-name cbv3 --service-name account |
| 57 | + database password/servicePassword (defaults to Welcome12345): ************* |
| 58 | + Kubernetes secret for Datasource was created successfully. |
| 59 | + ``` |
| 60 | + |
| 61 | + 1. deploy |
| 62 | + |
| 63 | + ```shell |
| 64 | + oractl:>deploy --app-name cbv3 --service-name account --artifact-path account/target/account-0.0.1-SNAPSHOT.jar --image-version 0.0.1 --redeploy true |
| 65 | + uploading: account/target/account-0.0.1-SNAPSHOT.jarbuilding and pushing image... |
| 66 | + creating deployment and service... successfully deployed |
| 67 | + ``` |
| 68 | + |
| 69 | +1. Deploy customer service |
| 70 | + |
| 71 | + 1. bind |
| 72 | + |
| 73 | + ```shell |
| 74 | + oractl:>bind --app-name cbv3 --service-name customer |
| 75 | + database password/servicePassword (defaults to Welcome12345): ************* |
| 76 | + Kubernetes secret for Datasource was created successfully. |
| 77 | + ``` |
| 78 | + |
| 79 | + 1. deploy |
| 80 | + |
| 81 | + ```shell |
| 82 | + oractl:>deploy --app-name cbv3 --service-name customer --artifact-path customer/target/customer-0.0.1-SNAPSHOT.jar --image-version 0.0.1 |
| 83 | + uploading: customer/target/customer-0.0.1-SNAPSHOT.jarbuilding and pushing image... |
| 84 | + creating deployment and service... successfully deployed |
| 85 | + ``` |
| 86 | + |
| 87 | +1. Deploy creditscore service |
| 88 | + |
| 89 | + ```shell |
| 90 | + oractl:>deploy --app-name cbv3 --service-name creditscore --artifact-path creditscore/target/creditscore-0.0.1-SNAPSHOT.jar --image-version 0.0.1 |
| 91 | + uploading: creditscore/target/creditscore-0.0.1-SNAPSHOT.jarbuilding and pushing image... |
| 92 | + creating deployment and service... successfully deployed``` |
| 93 | + ``` |
| 94 | + |
| 95 | +1. Deploy testrunner service |
| 96 | + |
| 97 | + 1. bind |
| 98 | + |
| 99 | + ```shell |
| 100 | + oractl:>bind --app-name cbv3 --service-name testrunner --username account |
| 101 | + database password/servicePassword (defaults to Welcome12345): ************* |
| 102 | + Kubernetes secret for Datasource was created successfully. |
| 103 | + ``` |
| 104 | + |
| 105 | + 1. deploy |
| 106 | + |
| 107 | + ```shell |
| 108 | + oractl:>deploy --app-name cbv3 --service-name testrunner --artifact-path testrunner/target/testrunner-0.0.1-SNAPSHOT.jar --image-version 0.0.1 |
| 109 | + uploading: testrunner/target/testrunner-0.0.1-SNAPSHOT.jarbuilding and pushing image... |
| 110 | + creating deployment and service... successfully deployed |
| 111 | + ``` |
| 112 | + |
| 113 | +1. Deploy transfer service |
| 114 | + |
| 115 | + ```shell |
| 116 | + oractl:>deploy --app-name cbv3 --service-name transfer --artifact-path transfer/target/transfer-0.0.1-SNAPSHOT.jar --image-version 0.0.1 |
| 117 | + uploading: transfer/target/transfer-0.0.1-SNAPSHOT.jarbuilding and pushing image... |
| 118 | + creating deployment and service... successfully deployed |
| 119 | + ``` |
| 120 | + |
| 121 | +1. Deploy checks service |
| 122 | + |
| 123 | + 1. bind |
| 124 | + |
| 125 | + ```shell |
| 126 | + oractl:>bind --app-name cbv3 --service-name checks --username account |
| 127 | + database password/servicePassword (defaults to Welcome12345): ************* |
| 128 | + Kubernetes secret for Datasource was created successfully. |
| 129 | + ``` |
| 130 | + |
| 131 | + 1. deploy |
| 132 | + |
| 133 | + ```shell |
| 134 | + oractl:>deploy --app-name cbv3 --service-name checks --artifact-path checks/target/checks-0.0.1-SNAPSHOT.jar --image-version 0.0.1 |
| 135 | + uploading: checks/target/checks-0.0.1-SNAPSHOT.jarbuilding and pushing image... |
| 136 | + creating deployment and service... successfully deployed |
| 137 | + ``` |
| 138 | + |
| 139 | +1. Verify pods are running |
| 140 | + |
| 141 | + `kgp -n cbv3` |
| 142 | + |
| 143 | + ```text |
| 144 | + NAME READY STATUS RESTARTS AGE |
| 145 | + account-5b68b6dbb6-l5sbd 1/1 Running 0 18m |
| 146 | + checks-848c7c8898-cqpss 1/1 Running 0 36s |
| 147 | + creditscore-5fd9f975c5-s5zlp 1/1 Running 0 11m |
| 148 | + customer-665d64bbbd-mnm4h 1/1 Running 0 13m |
| 149 | + testrunner-7cd7cb8f76-fg9ph 1/1 Running 0 4m10s |
| 150 | + transfer-55c4664759-2tfvl 1/1 Running 0 7m33s |
| 151 | + ``` |
| 152 | + |
| 153 | +## Test Cloudbank |
| 154 | + |
| 155 | +1. Test account service |
| 156 | + |
| 157 | + 1. Port forward |
| 158 | + `kpf -n cbv3 svc/account 8081:8080` |
| 159 | + |
| 160 | + 1. Rest endpoint |
| 161 | + `http --body :8081/api/v1/accounts` |
| 162 | + |
| 163 | + ```json |
| 164 | + [ |
| 165 | + { |
| 166 | + "accountBalance": -20, |
| 167 | + "accountCustomerId": "qwertysdwr", |
| 168 | + "accountId": 149, |
| 169 | + "accountName": "Andy's checking", |
| 170 | + "accountOpenedDate": "2023-06-26T17:39:37.000+00:00", |
| 171 | + "accountOtherDetails": "Account Info", |
| 172 | + "accountType": "CH" |
| 173 | + }, |
| 174 | + ... |
| 175 | + ... |
| 176 | + ``` |
| 177 | +
|
| 178 | +curl -i -X POST \ |
| 179 | +-H 'Content-Type: application/json' \ |
| 180 | +-d '{"journalType": "PENDING", "accountId": 149, "journalAmount": 100.00, "lraId": "0", "lraState": ""}' \ |
| 181 | +http://localhost:8081/api/v1/account/journal |
| 182 | +
|
| 183 | +```json |
| 184 | +{"journalId":21,"journalType":"PENDING","accountId":149,"lraId":"0","lraState":"","journalAmount":100} |
| 185 | +``` |
| 186 | +
|
| 187 | +`http --body :8081/api/v1/account/149/journal` |
| 188 | +
|
| 189 | +```json |
| 190 | +[ |
| 191 | + { |
| 192 | + "accountId": 149, |
| 193 | + "journalAmount": 100, |
| 194 | + "journalId": 21, |
| 195 | + "journalType": "PENDING", |
| 196 | + "lraId": "0", |
| 197 | + "lraState": null |
| 198 | + }, |
| 199 | + { |
| 200 | + "accountId": 149, |
| 201 | + "journalAmount": 100, |
| 202 | + "journalId": 22, |
| 203 | + "journalType": "PENDING", |
| 204 | + "lraId": "0", |
| 205 | + "lraState": null |
| 206 | + }, |
| 207 | + { |
| 208 | + "accountId": 149, |
| 209 | + "journalAmount": 100, |
| 210 | + "journalId": 23, |
| 211 | + "journalType": "PENDING", |
| 212 | + "lraId": "0", |
| 213 | + "lraState": null |
| 214 | + } |
| 215 | +] |
| 216 | +``` |
| 217 | +
|
| 218 | +`curl -i -X POST http://localhost:8081/api/v1/account/journal/21/clear` |
| 219 | +
|
| 220 | +```json |
| 221 | +{"journalId":21,"journalType":"DEPOSIT","accountId":149,"lraId":"0","lraState":null,"journalAmount":100} |
| 222 | +``` |
| 223 | +
|
| 224 | +
|
| 225 | +1. Test customer service |
| 226 | +
|
| 227 | + 1. Port forward |
| 228 | + `kpf -n cbv3 svc/customer 8082:8080` |
| 229 | +
|
| 230 | + 1. Rest points |
| 231 | + `http --body :8082/api/v1/customer` |
| 232 | +
|
| 233 | + ```json |
| 234 | + [ |
| 235 | + { |
| 236 | + "customerEmail": "sanjay@sanjay.com", |
| 237 | + "customerId": "aerg45sffd", |
| 238 | + "customerName": "Sanjay", |
| 239 | + "customerOtherDetails": "Information", |
| 240 | + "customerPassword": "Welcome", |
| 241 | + "dateBecameCustomer": "2023-06-26T17:44:49.000+00:00" |
| 242 | + }, |
| 243 | + ... |
| 244 | + ... |
| 245 | + ``` |
| 246 | +
|
| 247 | +1. Test creditscore service |
| 248 | +
|
| 249 | + 1. Port forward |
| 250 | + `kpf -n cbv3 svc/creditscore 8081:8080` |
| 251 | +
|
| 252 | + 1. REST call to endpoint |
| 253 | + `http --body :8081/api/v1/creditscore` |
| 254 | + |
| 255 | + ```json |
| 256 | + { |
| 257 | + "Credit Score": "844", |
| 258 | + "Date": "2023-06-26" |
| 259 | + } |
| 260 | + ``` |
| 261 | +
|
| 262 | +1. Test check processing services |
| 263 | +`curl -i -X POST -H 'Content-Type: application/json' -d '{"journalId": 4}' http://localhost:8083/api/v1/testrunner/clear` |
| 264 | +
|
| 265 | +http POST :8083/api/v1/testrunner/clear journalId:=4 |
| 266 | +
|
| 267 | +```json |
| 268 | +{"journalId":4} |
| 269 | +``` |
| 270 | +
|
| 271 | +1. Test the transfer service |
| 272 | +
|
| 273 | +http :9090/api/v1/accounts |
| 274 | +
|
| 275 | +curl -X POST "http://localhost:7000/transfer?fromAccount=594&toAccount=596&amount=100" |
| 276 | +
|
| 277 | +curl -X POST "http://localhost:7000/transfer?fromAccount=594&toAccount=596&amount=100000" |
| 278 | +
|
| 279 | +http POST :7000/transfer fromAccount==594 toAccount==596 amount==1000000 |
| 280 | +
|
| 281 | +http :9090/api/v1/account/596 |
| 282 | +
|
| 283 | +http :9090/api/v1/account/594 |
| 284 | +
|
| 285 | +klf -n cbv3 svc/transfer |
| 286 | +
|
| 287 | +## Verify Monitoring of Cloudbank |
| 288 | +
|
0 commit comments