Find Files And Delete Recursively

Problem Sometimes when using monorepos to host multiple services in a single repository, there may be a requirement to delete a file or list of files from each microservice. For example, I needed to delete application-dev.yml files for all the services after getting rid of dev environment in favor of acceptance. Solution Use following find command to find application-dev.yml files recursively and delete them. 1 find . -name "application-dev.yml" -type f -delete we may also use glob filters while using find:...

November 20, 2022 1 min

Nginx Ingress Controller forward headers

Error While moving to kubernetes, and migrating spring boot apps, we encountered a strange behavior that few of the webpages served by freemarker templates in spring boot were adding port :8080 instead of just using the hostname with SSL port :443 Fix After some investigation and trying to find some workaround, we found out that X-Forwarded-* headers needs to be forwarded by nginx ingress controller when it’s behind an azure app gateway(L7 load balancer)....

Spring Boot Request Header too large

How to solve IllegalArgumentException: Request header is too large in spring boot When migrating a spring boot application to cloud, multiple layers got added to serve traffic. On prem: nginx -> spring boot app (tomcat) Azure: nginx -> azure application gateway -> nginx ingress controller -> spring boot app(tomcat) In Azure, we noticed that some of http requests threw 400 http status code in our logs. While investigating further, we found the reason IllegalArgumentException: Request header is too large...

Fix Only_full_group_by_sql_error

Recently, I encountered sql state 42000 error in a spring boot application while moving from MySQL version 5.6 to 8.0. After inspecting stack trace and some googling, I got to know that few default configurations have changed in MySQL 8.0 (as expected 😃 ). This caused our poorly written queries to fail during migration. Background Lets look at sample query using spring-data jpa to gather some analytics by aggregating data about a customer ordering products...

Bash execute a command N times

How to run a command n times in bash 1 for i in {1..N}; do COMMAND; done

August 7, 2022 1 min

Nginx Ingress Sample Configurations for Helm values

Ingress configurations in helm values files. The following setup assumes that you have a helm chart which provides the configuration to deploy a service and an ingress for it Now, lets look at few of the sample helm values file configurations for ingress configurations with ingress-nginx. Enable Cors 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ingress:enabled:trueannotations:kubernetes.io/ingress.class:nginxnginx.ingress.kubernetes.io/enable-cors:"true"nginx.ingress.kubernetes.io/cors-allow-methods:"DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT"nginx....

Google Search Tips and Tricks

1. Exact phrase search Use double quotes "" to search for exact phrase match. e.g.: “JedisDataException: ERR unknown command CONFIG” 2. Exclude terms use hyphen (-) to exclude search terms which should not contibute to the search result. e.g.: coke -cola to exclude cola from search results. 3. Website search use search term site:sitename to search a site for the results. e.g. jedis site:ravikrs.com 4. Related website use link:ravikrs.com to find which sites have links for your website’s content...

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....