Credit card invoice query microservice

A service using Rest API in Java (Quarkus) that provides invoice data information from a credit card available in a database.

💻 Getting started

# Build 
$ mvn clean package

# Local execution
$ mvn quarkus:dev -Ddebug=false

Getting started Docker

# Install image from file build_docker_push.sh 
$ ./build_docker_push.sh 

# Started and attaches to containers for a service
$ docker-compose --env-file ./.env up

Getting started Docker (Native Image)

# Install image from file build_docker_push.sh 
$ ./build_docker_native.sh 

# Started and attaches to containers for a service
$ docker-compose -f docker-compose-native.yml --env-file ./.env up

✔️ Required

  • Maven: 3.8.4
  • Java version: 17
  • Docker version: 20.10.17
  • Docker-compose version: v2.2.2

Docker Image:

  • Minikube: v1.29.0
  • Keycloak: 19.0.3
  • postgres: 13
  • jaegertracing/all-in-one: 1
  • grafana/grafana: latest
  • elasticsearch: 8.4.1
  • Kibana: 8.4.1
  • azul/zulu-openjdk: 17-latest

Integrated tools:

Observability:

  • smallrye-openapi
  • smallrye-metrics
  • smallrye-health
  • opentelemetry

Database:

  • hibernate-reactive-panache
  • reactive-pg-client

Authentication and Security:

  • oidc-client
  • keycloak-authorization

Other integrations:

  • resteasy-reactive-jackson
  • lombok
  • mapstruct

Unit and Integration testing:

  • testcontainers
  • keycloak-admin-client
  • test-oidc-server
  • rest-assured

Swagger

image

Generating private key

openssl genrsa -out rsaPrivateKey.pem 2048

Generating public key

openssl rsa -pubout -in rsaPrivateKey.pem -out publicKey.pem

Converting private key to PKCS#8 format:

openssl pkcs8 -topk8 -nocrypt -inform pem -in rsaPrivateKey.pem -outform pem -out privateKey.pem

Indicadors

image

Test performance with (hey)

hey -z 10s -H "Authorization: Bearer ACCESS_TOKEN" http://localhost:8080/credit-cards-accounts/api/v1/accounts/8dcb8be4-bf5a-11ed-a85b-0242c0a89002/123/transactions

image

Test performance with ApacheBench

ab -k -n 10000 -c 10 -H "Authorization: Bearer ACCESS_TOKEN" http://localhost:8080/credit-cards-accounts/api/v1/accounts/8dcb8be4-bf5a-11ed-a85b-0242c0a89002/123/transactions

image

Tracing no Jaeger

image

Indicadors Kubernetes

image

Project Structure

image

Test in container

image

Autor

Reinaldo Jesus Santana - reinaldojsantana@gmail.com