“Code that works is good. Code that runs anywhere is great. Code that stands strong like a fort — that's legendary.”
Inspired by Chhatrapati Shivaji Maharaj’s empire-building wisdom.
๐งญ Quick Recap
In our open-source journey toward a fraud detection system inspired by the Swarajya movement, we’ve already built:
- ๐ก️ sindhudurg: Fraud Scoring API (Spring Boot)
- ๐ง tanaji: AI Engine (FastAPI + Python)
- ๐ dadoji: Rules Engine
- ⚡ jiva: Redis-based caching
- ๐ฆ ramchandrapant: PostgreSQL for transaction storage
- ๐ kanhoji: Prometheus + Grafana Monitoring
Now it’s time to bring these warriors together in formation — reliably, portably, and scalably.
๐ฐ Inspired by Shivaji Maharaj’s Fort Strategy
Shivaji Maharaj built over 300 forts — not to dominate land, but to secure Swarajya.
Every fort was:
- Modular
- Self-sufficient
- Strategically connected but independently operational
That’s exactly what Docker does for us today in software.
⚔️ Shivaji’s Forts = Our Containers
Forts of Swarajya | Docker Microservices |
---|---|
Had their own food, water | Contain dependencies & config |
Stood independently | Isolated service containers |
Could signal one another | Docker networking |
Decentralized command | Compose-managed services |
Fortified walls | Runtime boundary & security |
Moved troops via sea/land | Image portability across environments |
๐ง Each microservice is a Fort. Docker is our General. Compose is our battle plan.
๐ Why Docker?
- Before Docker: Manually ran services, installed dependencies, dealt with port conflicts
- Now: 1 command spins up the entire system reliably across machines
๐งฉ What We’re Running in Docker
Container Name | Module |
---|---|
sindhudurg-app | Spring Boot REST API |
tanaji-api | FastAPI AI Service |
ramchandrapant | PostgreSQL DB |
jiva | Redis Cache |
kanhoji-prometheus | Prometheus Monitoring |
kanhoji-grafana | Grafana Dashboard |
๐ docker-compose.yml (Snippet)
services:
sindhudurg-app:
build: ./sindhudurg
ports:
- "8080:8080"
depends_on:
- tanaji-api
- redis
- postgres-db
tanaji-api:
build: ./tanaji
ports:
- "8000:8000"
redis:
image: redis:7
postgres-db:
image: postgres:15
environment:
POSTGRES_DB: transactions_db
POSTGRES_USER: txn_db_user
POSTGRES_PASSWORD: transactions_secret
๐ Run the System
docker compose up --build
This command:
- Starts all services
- Builds Docker images
- Connects networks internally
๐ Test a Transaction
curl -X POST http://localhost:8080/api/v1/fraud-score \
-H "Content-Type: application/json" \
-d '{
"transactionId": "txn001",
"userId": "user123",
"amount": 5000,
"currency": "INR",
"paymentMethod": "risky",
"cardNumberLast4": "1234",
"transactionTime": "2025-04-22T14:30:00Z",
"location": "risky",
"deviceId": "d1234",
"ipAddress": "192.168.1.10",
"merchantId": "m123"
}'
๐ Monitoring in Action
- Prometheus: http://localhost:9090
- Grafana: http://localhost:3000 (Login: admin/admin)
๐ Troubleshooting Log
Problem | Fix |
---|---|
Port Conflicts | Mapped to different host ports |
Redis not visible | Skipped advanced metrics for MVP |
Connection refused | Used service names, not localhost |
Postgres driver error | Added missing dependency |
Grafana not showing data | Fixed Prometheus targets |
๐ฏ What I Learned
- Docker = Forts for Software
- Each service = A garrison of Swarajya
- Shivaji Maharaj didn’t wait for chaos — he built resilience.
๐ GitHub
https://github.com/pcm1984/fraud-free-swarajya
๐ค What’s Next?
- ๐ฌ Notification Service (SMS, Email)
- ๐ Santaji – Feedback Learning Loop
- ๐งช Integration Testing + Observability
๐ Final Thought
“If Shivaji Maharaj could build forts that confused and defeated the mightiest empires…
...surely we can build software systems that don't fall apart on deploy.” ๐ฎ๐ณ