Posts

Showing posts from 2019

Streaming Spring boot logs to ELK stack

Image
In my previous blog , we have done ELK installation on windows 10 and we have even tried to push messages from input console to Elastic Search and finally viewed on Kibana Server. I will write a separate blog on why do we need ELK? In this blog, I’ll show you how can we push spring boot application log directly to Elastic search using Logstash which we can analyze on Kibana and If you don’t know how to install ELK on windows 10 then you can refer my previous blog and start Elastic Search and Kibana server. Prerequisite Elastic Search and Kibana running on your machine Basic knowledge of Spring boot application If you don’t want to start your application from scratch then you can download one spring boot application from my GitHub repository as well. I am assuming that the Elastic Search and Kibana server are running on your machine and you have a fair idea of how to start the Logstash server and what is Logstash conf file. So, to push spring boot logs cont...

ELK (ElasticSearch Logstash and Kibana ) Installation on Windows 10

Image
In this blog, I’ll show you how can we install ELK on our windows 10 machine - that is ElasticSearch, Logstash, and Kibana. These three different products are most commonly used together for log analysis. Using ELK stack, we can achieve centralized logging which helps in identifying the problems.  ELK is heavily used in microservices architecture where your docker images are running on 1000's of POD and you can't go to each pod to trace the logs. Logstash: It is the data collection pipeline tool. It is the first component of ELK Stack which collects data inputs and feeds it to the Elasticsearch. It collects various types of data from different sources, all at once and makes it available immediately for further use. Elasticsearch: It is a NoSQL database which is based on Lucene search engine and is built with RESTful APIs. It is a highly flexible and distributed search and analytics engine. Also, it provides simple deployment, maximum reliability, and easy managemen...

How to create Docker Image and push java app in a Docker Engine

Image
In this blog, I am going to share my knowledge on the creation of a docker image and how can we run in a Docker Engine. Prerequisite Basic Knowledge of Docker Docker must be running on your machine. Good to aware of Spring boot application. I already have one spring boot application in my IntelliJ which expose one endpoint /users/{id}. We will see how can we push and run this application in a docker container.  We need to create one file named Dockerfile to add docker instruction (Check above image). Now go to Terminal and check whether the docker is running or not on your machine. Run docker build to create an image and push it to the container using the command. docker build -f Dockerfile -t docker-spring-ehcache . The above command will execute all the operations that we have mentioned in our Dockerfile like pulling OpenJDK 8 from the docker hub if not exist. Let's see if our image got pushed to docker containers or not by listing all d...

Sonar Integration with Maven

Image
In my previous blog , we have already seen how to setup SonarQube server on Windows 10. We have also seen that how can we generate sonar report using sonar-scanner . In this blog, I’ll show you how to generate sonar report by configuring sonar dependency to maven project.  Steps to setup sonar in Maven We have to configure pluginManagement and Profile for Sonar in pom.xml file Add below pluginManagement dependency to your pom.xml  <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.1</version> </plugin> <plugin> <groupId>org.sonarsource.scanner.maven</groupId> ...

Code Analysis using SonarScanner on Windows 10

Image
In my previous blog , we have already seen how to setup SonarQube server on Windows 10. In this blog, I’ll show you how to generate sonar report using SonarScanner.  Step to setup SonarQube Download SonarScanner from https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/ . Set SonarScanner to PATH under Environment Variable. Unzip it and open sonar-scanner.properties which are under conf directory. Edit the below lines Now, go to your project folder directory, open command prompt and run sonar-scanner.bat. It will do the analysis and then post the result to the SonarQube server http://locathost:9000/ having the project name as sonar key that we have configured in sonar-scanner.properties file. You can check the JUnit test code coverage as well by clicking on Coverage. Happy Coding..!!!

SonarQube setup on windows 10

Image
Overview SonarQube is an automatic code review tool to detect bugs, vulnerabilities and code smell in your code. It can integrate with your existing workflow to enable continuous code inspection across your project branches and pull requests.  Prerequisite Make sure you have JAVA 11 or higher version installed on your window machine. Step to setup SonarQube Download Community edition from https://www.sonarqube.org/downloads/ Extract it and go to the bin folder. Choose windows-x86–32 or windows-x86–64 based on your machine configuration. Run StartSonar.bat which will start the SonarQube server.  Open browser and hit http://localhost:9000 If you want, you can start the sonarQube server to a different port by just updating the port number (sonar.web.port=9070) to sonar.properties which is present under conf directory. You can login to the portal using default credential (admin:admin). Congratulation! SonarQube server is up and running on loca...

Postman API – Tips and Tricks

Image
I have seen many people using POSTMAN tools but very few of them know how to exactly use all the features of POSTMAN application. So, in this article, I am going to share a few tips/tricks which can be really helpful in our API testing. Set Environment Variables Let’s assume we have an endpoint to get some data after authenticating yourself bypassing username/password. Now, you have to test this endpoint which is deployed on multiple environments like a local machine, test environment and on SIT environment as well. Also, the credential is different for each environment. So, how are we going to test it? Most of the time, I have seen that people create one-one requests for each environment or create one request and then modify the existing username/password and hostname to point to a different environment. The Simple Solution is to set changing parameters as an Environment variable and switch environment to test for different regions. E.g.  http://<HOSTNAME:POST>/t...