Skip to main content

Posts

Breaking a Dinosaur (Monolithic)

Greetings! I have been working on this big monolithic application for a few years now. Some people called it a Dinosaur due to it is size and the old technical stack. I have improved my module by applying various modern-day techniques and this is one of those where I restructured all the main REST APIs. The problem When a system gets older without paying attention to technical details, development technologies, tools, hosting, and architecture, everything gets increasingly obsolete. Adding new features becomes very complex. Harder to scale, maintain, and release. In short, it takes months to complete and release a little change. The wrong way "Let's re-write this" is the normal way people think and that is the wrong way. Why? because it is a running business. It will not add value immediately. There are projects done this way and already years late to production. "Let's create a new UI with the latest web technologies" is the other wrong idea. Why do you tak

Reactive Spring - CRUD with MongoDB

Greetings! When we learn something, it is good to have something to play with. Now is the time to connect with a database. Working with Reactive Programming is fun but it brings extra challenges. Connecting to a database is such a challenge as we can't use blocking drivers. Lucky for us, Spring comes with Data Repository for MongoDB. Assumptions: You are comfortable with Spring Boot REST You have installed or have access to the MongoDB database The completed project is here -  reactive-super-heroes What to expect? We will follow Spring's usual layers. The main difference is we are using a Reactive Repository instead of the usual blocking repository. We will build a simple REST application with CRUD operations to store superheroes. Create the project Add database connection Create entity (document), dtos Create repository Create service Create controller Demo Create the project Go to start.spring.io and create a project with the below dependencies. S

AWS Spring - Deploy Spring Boot application to AWS EC2

Greetings! AWS and Spring are two of the most needed skills Java developer needs these days. It is no fun to just learn theory. Let's host our tiny Spring backed application in AWS. Assumption : You are comfortable with Spring, AWS but exploring how to deploy. In this basic setup, we are going to use the easiest way in contrast to learning. We had a running system in this way which had around 8~10 microservices. I missed those days anyway. It is very primitive but it works! Steps Let's define what we are going to do. Create an EC2 instance Create Spring Boot app Setup EC2 Copy Spring boot application into EC2 and run Create an EC2 instance I assume you already know this step. However, there are a few things to note. Make sure to download your keypair (mykeypair.pem) and set the correct permission (chmod +400) Security group - Add 2 rules to allow ssh (port 22) and HTTP access with port 8080 Create a Spring boot applicatio