Java 21+
needs to be installedexport JAVA_HOME=$(/usr/libexec/java_home -v 21)
Maven
needs to be installedDocker
needs to be installed- Install any Java IDE (
Eclipse
,STS
,Intellij
etc..) and ensure you are able to launch - Clone or checkout the project from version control system (
git
) and follow below steps
-
Java 21
-
Spring Boot 3
-
H2 Database
(Default values are provided below)Default H2 Database Url
: http://localhost:8080/h2-consoleusername
:sa
password
:sa
url
:jdbc:h2:mem:MB_TEST;DB_CLOSE_DELAY=-1
-
Flyway
for database migration -
Centralize exception handling by
ControllerAdvice
-
Mapstruct
to map different type of objects to each other -
Micrometer
dependencies were added to track the logs easily -
Testcontainers
dependencies were added for integration tests -
docker-compose.yml
containsGrafana
,Prometheus
andZipkin
to track metrics,Kafka
for event-driven architecture,Redis
for caching,Elasticsearch
for search and analytics engineActuator
: http://localhost:8080/actuatorKafka UI
: http://localhost:9091/Grafana
- Login Credentials
- Url: http://localhost:3000/
- Email or username:
admin
- Password:
admin
- Add
Prometheus
Datasource - Add Dashboards
- Login Credentials
Prometheus
Actuator
: http://localhost:8080/actuator/prometheusPrometheus
: http://localhost:9090/graph
Zipkin UI
: http://localhost:9411Elasticsearch
: http://localhost:9200/Kibana
: http://localhost:5601/
-
Test via
Postman
(OPTIONAL):- Import Postman Collection
- Right-click the imported Postman Collection and click Run Collection section.
- On the right panel choose Functional or Performance section, edit Run configuration and click run to test the application.
- Please follow the following steps, if you want to build and run Spring Boot Application
*** Run the application by following these steps.
1 - cd live-data-service
2 - docker-compose up -d
3 - mvn clean install or mvn clean package
4 - mvn spring-boot:run
- Please follow the following steps, if you want to build and run Dockerfile
1 - cd live-data-service
2 - docker-compose up -d
3 - mvn clean install or mvn clean package --------THIS IS MUST---------
4 - docker build -t mb/live-data-service .
5 - docker run -p 8080:8080 mb/live-data-service
- Please follow the following steps, if you want to build and run
docker-compose.yml
- Remove
live-data-service
service comment inservices
section indocker-compose.yml
Docker
->Preferences
->Resources
->File sharing
-> click add button and selectprometheus
folder under the/src/main/resources
or just add/etc/prometheus
path ->Apply & Restart
1 - cd live-data-service
2 - mvn clean install or mvn clean package --------THIS IS MUST---------
3 - docker build -t mb/live-data-service .
4 - docker-compose up -d
-
The following command returns all matched data by
'keyPattern:*'
patternredis-cli --scan --pattern 'keyPattern:*'
-
The following command deletes all matched data by
'keyPattern:*'
patternredis-cli KEYS 'keyPattern:*' | xargs redis-cli DEL
-
The following command finds
TYPE
in redis withKEY
TYPE key
->TYPE xxx:hashedIdOrSomethingElse
-
The following commands search by
TYPE
- for
"string" TYPE
:get key
- for
"hash" TYPE
:hgetall key
- for
"list" TYPE
:lrange key 0 -1
- for
"set" TYPE
:smembers key
- for
"zset" TYPE
:zrange key 0 -1 withScores
- for
-
RedisInsight
: http://localhost:8001/
- Setup Firebase or Just follow the following steps
to Initialize the SDK, Create and Download Firebase Credentials JSON File
- After JSON file is downloaded, copy the content of downloaded file and replace
play-integrity-credentials.json
content with that copied text - Replace
application-name
value in application.yml file withproject_id
variable that is inplay-integrity-credentials.json
- HELPFUL LINK BUT IT SHOULD NOT BE NEEDED
- After JSON file is downloaded, copy the content of downloaded file and replace
- Metrics Made Easy Via Spring Actuator, Docker, Prometheus, and Grafana
- https://prometheus.io/docs/prometheus/latest/installation/#volumes-bind-mount
- Spring Boot Rest Controller Unit Test with @WebMvcTest
- Redis Commands
- Running RedisInsight using Docker Compose
- Google Play Integrity API
- A Guide to Querydsl with JPA