An scalable pseudo springboot application that runs on K8 cluster
- Java8
- Docker
v20.10.2
or higher - Kubernetes
v1.19.3
or higher
- Clone the repo and navigate into folder;
git clone https://github.com/rasika/time-checker
cd time-checker
- Trigger the gradle build;
./gradlew clean build
- Deploy your Kubernetes deployment;
kubectl create -f deployments/k8-deploy.yaml
4.. Invoke the service using following URL;
- To send generic GET request;
curl http://localhost:31000
- To send as a mobile device;
curl -H "User-Agent: Mozilla/5.0 (Linux; Android 11) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Mobile Safari/537.36" http://localhost:31000
- Scaling Your K8 Deployment: You can scale up/down base you need using;
kubectl scale --replicas=3 deploy time-checker-deployment
- RollingOut K8 Deployment: You can scale up/down base you need using;
kubectl set image deploy time-checker-deployment time-checker-deployment=time-checker:2.0.0-SNAPSHOT
- Undo RollOut K8 Deployment: You can scale up/down base your need using;
kubectl rollout undo deploy time-checker-deployment
This application is already configured with Prometeus and Grafana using K8 artifacts. You need only to import recommended dashboard(or any dashboard) with few clicks to make this work.
-
Visit http://localhost:31002/login and login with default user credentials
admin/admin
-
Visit http://localhost:31002/dashboard/import and load dashboard with id
13625
(preview) -
Select datasources as
promethius
for both dropdowns and import dashboard
- JUnit Tests written for the SpringBoot application functionality can be found in package src/test/java/com/example/demo/
- Test-coverage report is available upon command
./gradelw test
and reports will be generated inbuild/reports/tests/test/index.html
path. - Code quality checks are assesed with spot-bugs and reports are generated in
build/reports/spotbugs/main.html
path.
Feel free to contribute into this repository. There are areas such as CI/CD improvements that can be done into the build flow to make the deployment flawless. Git PRs are warmly welcome!
This code is distributed under Apache license 2.0.