Springdoc OpenApi3 Swagger

When working as a backend engineer, it is essential to document the REST APIs. It also helps in providing a UI(swagger-ui) to test the REST calls. Let us try to integrate springdoc-openapi to provide swagger documentation for a spring boot project using spring-security(OAuth2). Add the dependencies to build.gradle 1 2 3 implementation("org.springdoc:springdoc-openapi-ui:1.6.8") implementation("org.springdoc:springdoc-openapi-security:1.6.8") implementation("org.springdoc:springdoc-openapi-kotlin:1.6.8") Kotlin code example The following example showcases spring configuration to create OpenAPI bean which supports two authentication mechanism:...

JedisDataException ERR unknown command CONFIG

Error While trying to setup Azure Cache for Redis as spring session store, I encountered following exception: .JedisDataException: ERR unknown command CONFIG, with args beginning with: get, notify-keyspace-events": 1, Fix Found the solution in spring-session-gh-issue Kotlin 1 2 3 4 5 6 7 8 9 10 @Configuration class HttpSessionConfig() { companion object { // another solution could be to enable notify-keyspace-events for redis @Bean fun configureRedisAction(): ConfigureRedisAction { return ConfigureRedisAction....

Exec Format Error

Having encountered exec format error stacktrace for two times already, I definitely want to log it šŸ˜¤ First encounter I got this error when I got a new Mac M1 from my employer. I was using colima as docker desktop replacement for Mac. While working on a feature for a service, I built container image using colima; pushed the image to container registry and tried deploying to dev environment. And saw the exec format error in logs....

Configure hostname for local ingress

It is useful to configure hostnames for kubernetes ingresses when testing kubernetes application locally on a developerā€™s machine. We may add LoadBalancer IP address to /etc/hosts file to be able to open ingress hostname in browsers. Minikube Show IP of the LoadBalancer 1 2 minikube ip 192.168.49.2 update localhost /etc/hosts file example 1 2 192.168.178.50 demo.nginx.local 192.168.178.50 demo1.nginx.local Rancher Desktop Assuming ingress-nginx is installed following nginx-ingress-rancher-destop in ingress-nginx namespace....

Ansible introduction

Ansible introduction Modules Command module: Takes the command and executes it Shell module: Executes through a shell like /bin/sh Script module: Runs a local script on a remote node after transferring it. raw: executes a ssh command. useful for installation python3 Adhoc commands Examples: ansible all - ping ansible web -m command -a ā€œuptimeā€ ansible localhost -m setup Static inventory Sample inventory: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 [control] control ansible_host=10....

GitOps

GitOps Three pillars of GitOps Pipelines Observability Control ##Joined Up Pipelines CI CD Release Automation Git as source of truth Service Deployments are controlled using operator pattern in jubernetes Kubernetes pattern - Git config -> Deploy Operator > service/deployments Similarly now in gitops config is code and everything is config code and config must be version controlled kubectl get <object> -o yaml --export to extract existing configuration to bootstrap config repo in git Sometimes export is not perfect....

Kubernetes introduction

Kubernetes Introduction Build a docker image Dockerfile default filename FROM base image to be used for container ADD copies files/directories/remote file urls to container filesystem. Tarball and Remote URL (git, http) handling COPY same as ADD without tar and remote url handling CMD kubectl ā€“namespace <DEV|STAGING|PROD> get deployments,pods,svc,ingress cd scripts/ ./createServicePrincipal.sh tti-maps-k8s-sp Module 1 creating a cluster 1 2 3 4 5 6 minikube start minikube dashboard kubectl version kubectl cluster-info kubectl get nodes,pods kubectl get nodes --help Module 2 deploy an app Create a deployment using kubectl create deployment...

Docker introduction

Docker for Java Developers Basic Docker commands docker images ls to list docker images docker container ls to list containers Containers and Images Docker CLI docker info shows basic docker infor about containers/images/volumes, runtimes, kernal version, OS details, etc docker version client and server version for docker api docker --help list of commands available prefer to use management commands like: docker image ls docker container ls Run a container docker container run jboss/wildfly download wildfly and run it....

Prometheus

Prometheus Type of logs Transaction logs Request logs Application logs Debug logs Using Expression browser Metrics: up Gauges: process_resident_memory - metric type gauges . For a gauge, its current absolute value is important from a monitoring point of view Counters: prometheus_tsdb_head_samples_appended_total metric type - counter. Number of samples prometheus has ingested Rate: rate(prometheus_tsdb_head_samples_appended_total[1m]) to compute rate per minute. The rate function automatically handles counters resetting due to processes restarting and samples not being exactly aligned....