Posts

Showing posts from January, 2020

Failed CQRS implement in Microservice architecture.

Image
CQRS is a useful pattern when having a complex business application where reading and writing have separate requirements. For an example, Write wants to maintain a model in normalised form in a RDB but Read can represent model as document in a Document database. But it is not easy to get head around about CQRS. It comes with  Reads, Writes, Events, Commands, DDD, Event Sourcing, Eventual Consistency . The common way of implementing CQRS is by creating two services communicating with Events. Our CQRS Implementation In order to bring CQRS into our custom framework we used  Axon framework.  At time when we evaluated CQRS frameworks, Axon was the easiest way to work with and had good support for  Spring Boot  framework. This is how Axon was used. CQRS implementation We ended up creating two separate services for Writes and Reads. These two services connected via RabbitMQ. Write Service Write service handles all the Updates. We did not try to convince developers that

Spinnaker Authentication with Keycloak

Image
Spinnaker Authentication with Keycloak In my previous  story  I explained how I deployed Spinnaker onto Kubernetes and enabled public access via ingress. In this short story I’m going to explain how I secure Spinnaker by enabling authentication with Keycloak. For this demo I used Kubernetes running on my Mac and also I’m not going to explain OAuth 2.0, OpenID Connect, all the features of Keycloak. Keycloak Keycloak is an Open Source software for Identity and Access Management. It is developed on the top of  Wildfly   server. It provides support for standard protocols like OpenID Connect, OAuth 2.0, and SAML. Authentication Spinnaker authentication involves three main components. They are, Deck  : Sinnaker UI. That is what you see when you access spinnaker. Gate : API gateway for Spinnaker. All the requests go through the Gate and check whether the request is coming from authenticated user. Identity Provider:  In our case this is Keycloak. Spinnaker Authen

Deploy Spinnaker onto K8S and access via Ingress

Image
Deploy Spinnaker onto K8S and access via Ingress In this small story, I would like to share how I deployed Spinnaker onto Kubernetes and accessed it via ingress. Spinnaker is a multi-cloud continuous delivery platform. It provides two main features. Application management Application deployment Back in my previous company we used Spinnaker to deploy our microservices onto Kubernetes clusters. I did not involve in setting up the Spinnaker but I created pipelines for microservices. But I always wanted to setup Spinnaker by my own. As usual I started reading Spinnaker documentation. According to the documentation the recommended way to setup Spinnaker is a distributed installation onto a Kubernetes cluster. So I wanted to try that. Instructions given by the Spinnaker  documentation , were followed. I installed  Halyard  using below 2 commands, curl -O https://raw.githubusercontent.com/spinnaker/halyard/master/install/macos/InstallHalyard.sh sudo bash

Scaling Jenkins on Kubernetes

Image
Scaling Jenkins on Kubernetes Jenkins running on K8s W hy do we want to run Jenkins in kubernetes? That might be your first question. You might not find a requirement to run Jenkins in K8s strait away. When your codebase grows larger or run many jobs parallelly, Jenkins will grow very largely. This will slow down your builds and lead to unnecessary resource utilization. Let’s assume that you have 3 Jenkins slaves and each can run 3 job parallelly. Then you can run maximum 9 jobs parallelly, other jobs have to wait. Solution for these is scaling Jenkins. Scaling Jenkins is vey easy. Jenkins has scaling feature out-fo-the-box. Jenkins comes with master/slave mode. Master is responsible for maintaining jobs, users, configurations, scheduling jobs in slaves and etc... Slaves are Jenkins agents, their primary task is executing jobs scheduled by the master. Every one knows K8s is container orchestration platform. So I’m going to implement this solution in K8s using its features. S

Docker sizing Java application

Image
Many developers put java in docker yet they face many issues from development to running containers. Docker sizing Java application As  a Java developer, I faced many issues when dockerizing and running java applications. Running dockrized java application When we start our development we used java 8 as our runtime environment. We ran jars as separate processes (yes using java -jar ) in VM, at that time there was no requirement to dockerize applications and everything worked without any major issues. Later we experienced the need for dockerizing applications. Then we faced many performance issues. Our initial docker environment was just docker containers running in a VM without any container orchestration. When we compared dockerized application with normal java application, the performance of dockerized application was not good. When we set the memory limits for docker application, most of the applications threw  java.lang.OutOfMemoryError: Java heap space .   When we inves