Skip to content

Commit 6572103

Browse files
andytaelddrechse
andauthored
Cloudbank version 5 (#1099)
* CBv5 Jkube build Signed-off-by: Andy Tael <[email protected]> * Use Kubernetes Configured Eureka Server (#1113) * Updates Signed-off-by: Andy Tael <[email protected]> * Updates * typo * updates * remove my data * readme update * Remove chatbot and docu fixes * Updates * docu update and script fixes * linting * Use Kubernetes Configured Eureka Server (#1115) * typo * OpenTelemetry configuration for SigNoz metrics integration (#1117) * Updates * Docu update Signed-off-by: Andy Tael <[email protected]> * DB Version clarification * Update Build and Push (#1120) * Add changes to support build and push * generic tenancy * generic tenancy --------- Signed-off-by: Andy Tael <[email protected]> Co-authored-by: Doug Drechsel <[email protected]>
1 parent 64840c9 commit 6572103

File tree

190 files changed

+11378
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

190 files changed

+11378
-0
lines changed

cloudbank-v5/CBV5.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Installing Cloudbank v5
2+
3+
This repo contains a almost ready deployment of cloudbank v5. There are minimal changes to make this work in your environment. **NOTE:** this example assumes that OBaaS is installed in a namespace called `obaas-dev` and that CBv5 will be installed in the same namespace called `obaas-dev`.
4+
5+
Cluudbank v5 has only been tested on Java 21.
6+
7+
You must set the DOCKER_HOST variable to be able to build CLoudbank v5, for example if you're using Rancher Desktop on a Mac `export DOCKER_HOST=unix:///Users/atael/.rd/docker.sock`.
8+
9+
**NOTE** the repositories must by public. Needs to investigate why private repos aren't working (authentication error). You can use the script `create-oci-repos.sh` to create the necessary repositories. For example `source create-oci-repos.sh andytael sjc.ocir.io/maacloud/cloudbank`.
10+
11+
## Dependencies for Cloudbank
12+
13+
Build dependencies and install -- `mvn clean install -pl common,buildtools`
14+
15+
## Build cloudbank
16+
17+
A script called `update-jkube-image.sh` is provided to update the `pom.xml` file for JKube to point to the repository that will be used (update-jkube-image.sh <new-image-prefix> (sjc.ocir.io/maacloud/cloudbank-v5 for example)). When that change is made you can execute the following command to build and push the images:
18+
19+
```bash
20+
mvn clean package k8s:build k8s:push -pl account,customer,transfer,checks,creditscore,testrunner
21+
```
22+
23+
## Create account and customer DB users
24+
25+
Update the `sqljob.yaml` file to reflect your environment. Run the job and **VERIFY** that the job finished successfully before proceeding.
26+
27+
```bash
28+
k create -f sqljob.yaml
29+
```
30+
31+
## Create secrets for account and customer microservices
32+
33+
A script called `acc_cust_secrets.sh` is provided that could be used create the necessary secrets. This script *MUST* be updated to reflect your environment.
34+
35+
## Change values.yaml
36+
37+
A script called `update_image.sh` is provided that could be used to change the repository and tag to your environment (`./update-image.sh <repository> <tag>`) in the `values.yaml` file. For example `update-image.sh sjc.ocir.io/maacloud/cloudbank-v5 0.0.1-SNAPSHOT`.
38+
39+
Verify and change credentialSecret and walletSecret values in the `values.yaml` if needed. Names can be found be looking at the secrets in the `obaas-dev` namespace.
40+
41+
## Install CBv5
42+
43+
A script call `deploy-all-services.sh` is provided that can be used to deploy all the Cloudbank services (account,customer,transfer,checks,creditscore,testrunner). For example `./deploy-all-services.sh obaas-dev`.
44+
45+
## Create APISIX routes
46+
47+
1. Retrieve the API KEY (requires `yq`) for APISIX by running this command:
48+
49+
```bash
50+
kubectl -n obaas-dev get configmap apisix -o yaml | yq '.data."config.yaml"' | yq '.deployment.admin.admin_key[] | select(.name == "admin") | .key'
51+
```
52+
53+
If the command doesn't work you can get the API key by looking into the ConfigMap
54+
......
55+
56+
1. Create tunnel to APISIX
57+
58+
```shell
59+
kubectl port-forward -n obaas-dev svc/apisix-admin 9180
60+
```
61+
62+
1. Create the routes by running this command:
63+
64+
```bash
65+
(cd apisix-routes; source ./create-all-routes.sh <YOUR-API-KEY>)
66+
```
67+
68+
## Test the services
69+
70+
Follow the [README](README.md) section `Test CloudBank Services`.

cloudbank-v5/CLAUDE.md

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
CloudBank v5 is a microservices-based banking application built with Spring Boot 3.4.6 and Java 21. It demonstrates Oracle Backend for Microservices and AI (OBaaS) capabilities, including distributed transactions using Long Running Actions (LRA), observability, and service mesh integration.
8+
9+
## Build and Development Commands
10+
11+
### Build the entire project
12+
```bash
13+
mvn clean package
14+
```
15+
16+
### Run specific tests for a module
17+
```bash
18+
mvn test -pl <module-name>
19+
# Example: mvn test -pl account
20+
```
21+
22+
### Code quality checks
23+
```bash
24+
# Run checkstyle validation
25+
mvn checkstyle:check
26+
27+
# Run dependency vulnerability scan
28+
mvn org.owasp:dependency-check-maven:check
29+
```
30+
31+
### Docker image build and push
32+
```bash
33+
mvn k8s:build
34+
```
35+
36+
## Architecture
37+
38+
### Microservices Structure
39+
- **account**: Account management service with journal/transaction tracking
40+
- **customer**: Customer management and profile operations
41+
- **transfer**: Inter-account transfer service with LRA support
42+
- **checks**: Check deposit/clearance processing
43+
- **creditscore**: Credit scoring service
44+
- **chatbot**: AI-powered chatbot service (optional)
45+
- **testrunner**: Test automation and system testing utilities
46+
- **common**: Shared configuration and utilities
47+
- **buildtools**: Development tooling and quality checks
48+
49+
### Key Architectural Patterns
50+
- **Event-driven Architecture**: Services communicate via REST APIs with distributed transaction support
51+
- **Saga Pattern**: Implemented using Oracle MicroTx LRA for distributed transactions
52+
- **Service Discovery**: Eureka-based service registration and discovery
53+
- **Circuit Breaker**: OpenFeign with resilience patterns
54+
- **Observability**: OpenTelemetry tracing, Micrometer metrics, Prometheus monitoring
55+
56+
### Database Design
57+
- Oracle Database with UCP connection pooling
58+
- Liquibase for database migrations
59+
- JPA/Hibernate for ORM with optimistic locking
60+
- Each service has its own schema (account, customer, etc.)
61+
62+
### Configuration Management
63+
- Spring Cloud Config for centralized configuration
64+
- Service-specific `application.yaml` files
65+
- Common configuration shared via `common.yaml`
66+
- Environment-specific overrides through externalized config
67+
68+
## Technology Stack
69+
70+
### Core Framework
71+
- Spring Boot 3.4.6 with Virtual Threads enabled
72+
- Spring Cloud 2024.0.1 for microservices infrastructure
73+
- Oracle MicroTx for distributed transactions
74+
75+
### Database & Persistence
76+
- Oracle Database with oracle-spring-boot-starter-ucp
77+
- Liquibase for schema migrations
78+
- JPA/Hibernate with Oracle dialect
79+
80+
### Observability & Monitoring
81+
- OpenTelemetry for distributed tracing
82+
- Micrometer with Prometheus for metrics
83+
- SigNoz for APM and observability dashboards
84+
- Spring Boot Actuator for health checks
85+
86+
### Service Communication
87+
- OpenFeign for service-to-service communication
88+
- Eureka for service discovery
89+
- APISIX for API gateway and routing
90+
91+
## Development Guidelines
92+
93+
### LRA Transaction Patterns
94+
- Use `@LRA(value = LRA.Type.REQUIRES_NEW)` for new transaction boundaries
95+
- Implement `@Complete` and `@Compensate` methods for saga compensation
96+
- Pass LRA context headers between services for transaction correlation
97+
98+
### REST API Conventions
99+
- All APIs follow `/api/v1/` versioning pattern
100+
- Use standard HTTP status codes (201 for creation, 204 for deletion)
101+
- Return `Location` headers for created resources
102+
- Implement proper error handling with meaningful HTTP status codes
103+
104+
### Database Patterns
105+
- Use repository pattern with Spring Data JPA
106+
- Implement proper transaction boundaries at service layer
107+
- Follow naming conventions: `findBy*`, `existsById`, etc.
108+
- Use `saveAndFlush()` for immediate persistence when needed
109+
110+
### Testing Approach
111+
- Unit tests with Spring Boot Test slice annotations
112+
- Integration tests using `@SpringBootTest`
113+
- Use testrunner service for end-to-end system testing
114+
- Mock external service dependencies with WireMock or similar
115+
116+
## Common Issues & Solutions
117+
118+
### LRA Transaction Timeouts
119+
- Check MicroTx coordinator connectivity via `${MP_LRA_COORDINATOR_URL}`
120+
- Verify LRA headers are properly propagated between services
121+
- Monitor transaction logs for compensation trigger patterns
122+
123+
### Service Discovery Issues
124+
- Verify Eureka client configuration in `common.yaml`
125+
- Check service registration with Eureka dashboard
126+
- Ensure `spring.application.name` matches service discovery expectations
127+
128+
### Database Connection Problems
129+
- Validate Oracle UCP configuration in service-specific `application.yaml`
130+
- Check connection pool sizing (`initial-pool-size`, `max-pool-size`)
131+
- Verify Liquibase migrations complete successfully during startup

0 commit comments

Comments
 (0)