How rgowda46/bank-of-anthos works
Purpose and Entry Points
Bank of Anthos is a sample HTTP banking/payment application designed to demonstrate modernization on Kubernetes and Google Cloud. The deployable microservice system is rooted in kubernetes-manifests/; local build/deploy orchestration uses skaffold.yaml. The browser entry point is the Python frontend at src/frontend/frontend.py, exposed by the frontend Kubernetes service.
Web Edge and Request Orchestration
The frontend serves login, signup, account, deposit, and transfer pages, and makes backend HTTP calls on behalf of browser users. Static UI assets and templates remain within this boundary. It is deployed through base and environment-specific Kustomize manifests.
• src/frontend/frontend.py
• src/frontend/api_call.py
• src/frontend/k8s/base/frontend.yaml
Identity, Accounts, and Contacts Domain
userservice owns account creation and authentication and signs JWTs consumed by protected downstream services. contacts owns each user’s associated counterparty accounts for payment/deposit forms. Both Python services persist account-domain data in accounts-db, a PostgreSQL database initialized from SQL/scripts.
• src/accounts/userservice/userservice.py
• src/accounts/contacts/contacts.py
• src/accounts/accounts-db/initdb/0-accounts-schema.sql
Ledger Write Path
Payments and deposits flow from the frontend to the Java Spring ledger-writer. It validates incoming transactions, verifies JWTs, and persists accepted entries to the separate PostgreSQL ledger database. This is the authoritative transaction-write boundary.
• src/ledger/ledgerwriter/src/main/java/anthos/samples/bankofanthos/ledgerwriter/LedgerWriterController.java
• src/ledger/ledgerwriter/src/main/java/anthos/samples/bankofanthos/ledgerwriter/TransactionValidator.java
• src/ledger/ledger-db/initdb/0_init_tables.sql
Ledger Read Models
Two Java Spring services query the ledger database and maintain purpose-specific caches: balance-reader provides current balances, while transaction-history serves prior transactions. These services isolate frontend read traffic from the write service and database access pattern.
• src/ledger/balancereader/src/main/java/anthos/samples/bankofanthos/balancereader/BalanceReaderController.java
• src/ledger/balancereader/src/main/java/anthos/samples/bankofanthos/balancereader/BalanceCache.java
• src/ledger/transactionhistory/src/main/java/anthos/samples/bankofanthos/transactionhistory/TransactionCache.java
Deployment Topology and Runtime Boundaries
Services are containerized and run on Kubernetes, with root manifests providing the default in-cluster topology. Each service has Kustomize base/overlay variants for development, staging, production, and some Workload Identity configurations. PostgreSQL runs in-cluster by default; optional overlays replace it with Cloud SQL and proxy/workload-identity wiring.
• kubernetes-manifests/config.yaml
• src/components/cloud-sql/kustomization.yaml
• extras/cloudsql/kubernetes-manifests/config.yaml
Cloud Platform and Delivery
Terraform provisions GKE/Anthos and a multi-environment delivery foundation, including Artifact Registry, Cloud Build triggers, Cloud Deploy, networking, IAM, and fleet features. Cloud Build service-level configurations and Skaffold support build/deploy workflows. Optional integrations include Anthos Service Mesh/Istio, Cloud SQL, Google-managed Prometheus, and multi-cluster ingress.
• iac/tf-multienv-cicd-anthos-autopilot/main.tf
• iac/tf-multienv-cicd-anthos-autopilot/modules/ci-cd-pipeline/cloud-deploy.tf
• src/frontend/cloudbuild.yaml
Alternate Runtime and Traffic Generation
A VM-oriented Java ledger monolith combines the three ledger microservices for migration/containerization demonstrations. Separately, a Locust-based load generator drives realistic account and transaction traffic through the frontend, exercising the system’s public application path rather than backend services directly.
• src/ledgermonolith/src/main/java/anthos/samples/bankofanthos/ledgermonolith/LedgerMonolithApplication.java
• src/loadgenerator/locustfile.py
• src/loadgenerator/k8s/base/loadgenerator.yaml
Main entry points: api_call.py Backend API client · 0_init_tables.sql Ledger PostgreSQL · config.yaml Kubernetes manifests · frontend.py Python frontend
Components 20
Banking services
- Python frontend · Serves banking pages and orchestrates backend calls.
src/frontend/frontend.py - Backend API client
src/frontend/api_call.py - User service · Creates accounts, authenticates users, and signs JWTs.
src/accounts/userservice/userservice.py - Contacts service
src/accounts/contacts/contacts.py - Ledger writer · Authoritative transaction-write boundary.
src/ledger/ledgerwriter/src/main/java/anthos/samples/bankofanthos/ledgerwriter/LedgerWriterController.java - Transaction validator · Validates transactions and JWTs before persistence.
src/ledger/ledgerwriter/src/main/java/anthos/samples/bankofanthos/ledgerwriter/TransactionValidator.java - Balance reader
src/ledger/balancereader/src/main/java/anthos/samples/bankofanthos/balancereader/BalanceReaderController.java - Balance cache
src/ledger/balancereader/src/main/java/anthos/samples/bankofanthos/balancereader/BalanceCache.java - Transaction history · Serves prior transaction queries.
src/ledger/transactionhistory/src/main/java/anthos/samples/bankofanthos/transactionhistory/TransactionCache.java
Data stores
- Accounts PostgreSQL · Account and counterparty data store.
src/accounts/accounts-db/initdb/0-accounts-schema.sql - Ledger PostgreSQL · Authoritative transaction ledger.
src/ledger/ledger-db/initdb/0_init_tables.sql
Platform and delivery
- Kubernetes manifests · Base and environment overlays deploy the in-cluster system.
kubernetes-manifests/config.yaml - Cloud SQL overlay · Replaces in-cluster PostgreSQL with Cloud SQL wiring.
src/components/cloud-sql/kustomization.yaml - Skaffold
skaffold.yaml - Terraform foundation · Provisions GKE, networking, IAM, registry, and delivery services.
iac/tf-multienv-cicd-anthos-autopilot/main.tf - Cloud Deploy pipeline
iac/tf-multienv-cicd-anthos-autopilot/modules/ci-cd-pipeline/cloud-deploy.tf - Cloud Build
src/frontend/cloudbuild.yaml
Alternate workloads
- Locust load generator · Exercises the public frontend path.
src/loadgenerator/locustfile.py - VM ledger monolith · Combines ledger write and read services for migration demonstrations.
src/ledgermonolith/src/main/java/anthos/samples/bankofanthos/ledgermonolith/LedgerMonolithApplication.java
Other components
- Browser users
Connections 24
- Browser users → Python frontend: HTTP
- Locust load generator → Python frontend: simulated HTTP traffic
- Python frontend → Backend API client: uses
- Backend API client → User service: login and signup
- Backend API client → Contacts service: counterparties
- Backend API client → Ledger writer: deposits and payments
- Backend API client → Balance reader: balances
- Backend API client → Transaction history: transaction history
- User service → Accounts PostgreSQL: accounts
- Contacts service → Accounts PostgreSQL: contacts
- Ledger writer → Transaction validator: validates
- Transaction validator → Ledger PostgreSQL: accepted entries
- Balance reader → Balance cache: maintains
- Balance cache → Ledger PostgreSQL: queries
- Transaction history → Ledger PostgreSQL: queries and caches
- Kubernetes manifests → Python frontend: deploys
- Kubernetes manifests → User service: deploys
- Kubernetes manifests → Ledger writer: deploys
- Kubernetes manifests → Ledger PostgreSQL: deploys in-cluster
- Cloud SQL overlay → Ledger PostgreSQL: optional replacement
- Skaffold → Kubernetes manifests: builds and deploys
- Terraform foundation → Cloud Deploy pipeline: provisions
- Cloud Build → Cloud Deploy pipeline: build artifact delivery
- VM ledger monolith → Ledger PostgreSQL: combined ledger access