Posts

Building Cross Platform Docker

Building Cross Platform Docker Table of Contents Building Cross Platform Docker How to verify if BuildX already installed Supported platforms Tools required to build XPlatform Images Builder Instance Publish to Repository Building Cross Platform Docker By default, docker build creates images for the architecture that only matches host machine. with the evolution of ARM based architecture, it would be good if single docker images support different platforms such as X86/ARM/AMD. In order to achieve this we will use the docker BuildX command. BuildX is a Docker CLI plugin for extended build capabilities with BuildKit. By default, a build executed with Buildx will build an image for the architecture that matches your machine. This way, you get an image that runs on the same machine you are working on. In order to build for a different architecture, you can set the --platform flag, e.g. --platform=linux/arm64 . How to verify if BuildX...

How to add Resiliency to any APIs

Resiliency Handler Resiliency Handler This simple generic class helps to add resiliency to any APIs with follow delay strategies Exponential backoff and jitter strategy. Fixed delay strategy. ResiliencyHandler.java package circuitbreaker; import lombok.extern.slf4j.Slf4j; import java.util.concurrent.TimeUnit; import java.util.function.Supplier; /** * Generic ResiliencyHandler to simplify retry operations with fixed/exponential * backoff delay strategies * * <pre> * Student student = * ResiliencyHandler.buildFor(Student.class) * .usingJitterStrategy(3, 10L * 1000L) * .tryWithResiliency(() -> studentService.getStudent()) * .fallbackOnFail(() -> studentService.getDefaultStudent()) * .getResult();// return result * * </pre> * * @param <R> ResultType * * @author ThirupathiReddy Vajjala */ @Slf4j public class R...

Switch JDK Versions in Linux

Switching JDK Versions Switching JDK Versions If you want to switch between different JDK major versions that are available Try below command, choose option switch.sh $/> alternatives --config java There is 1 program that provides 'java'. Selection Command ----------------------------------------------- *+ 1 java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.372.b07-1.el7_9.x86_64/jre/bin/java) Enter to keep the current selection[+], or type selection number: 1 If you want to install new version new.sh yum install java-11-openjdk-devel Loaded plugins: tsflags, versionlock Resolving Dependencies --> Running transaction check ---> Package java-11-openjdk-devel.x86_64 1:11.0.19.0.7-1.0.1.el7_9 will be installed --> Processing Dependency: java-11-openjdk(x86-64) = 1:11.0.19.0.7-1.0.1.el7_9 for package: 1:java-11-openjdk-devel-11.0.19.0.7-1.0.1.el7_9.x86_64 --> Running transaction check ---> P...