Showing posts with label LINUX. Show all posts
Showing posts with label LINUX. Show all posts

Thursday, May 28, 2015

Jenkins | Deploy & Configure for Play Applications in RHEL 6.x


Jenkins is an open source server which is for continuous integration and written by JAVA. This is a world famous CI(Continuous Integration) tool. This tutorial guides you through the steps to deploy jenkins server on RHEL(Red Hat Enterprise Linux) server. The steps are given below.


  1. Check the JAVA is available on the RHEL server.
    # java -versionOutput :
    java version "1.8.0_45"Java(TM) SE Runtime Environment (build 1.8.0_45-b14)Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
  2. If there is no JAVA is installed on your, install java and get it confirmed that’s installed.# yum install java
  3. Add the Jenkins repository to the host machine, then install the rpm file.wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
  4. Install Jenkins server
    # yum install jenkins
  5. Adding jenkins to system boot
    # chkconfig jenkins on
  6. Start Jenkins and check the port 8080 is opened from the server side.
    # service jenkins start# netstat -tnlp | grep 8080
  7. Open your browser and load Jenkins server http://<server_ip>:8080
  8. After successfully deploy the Jenkins server, you can setup the server to build scala applications. In here the application code will be retrieved from the git server, so git server should have a separate user for jenkins. In order to achieve that user have to generate a SSH key file from the host machine.
    # 
    ssh-keygen -t jenkin@localhost.com
    #
     ls -al ~/.ssh/
  9. Open the rsa.pub file and copy the content to the clip board then update the Github user in Github dashboard.  Go to Github -> Your Profile -> SSH Keys -> Add New
  10. Install the git plugin in Jenkins server.
    Go to Jenkins -> Manage Jenkins -> Manage Plugins -> Install git Plugin
  11. Create a job in Jenkins with you project details.
    Jenkins Dashboard -> New Item
  12. After creating the job, you will see the git server settings on configuration on the specified project.
     Go to project -> configure
13.  Under git settings in configuration page you can add the specific git configurations.

14. In Git credentials you have to add the Private key you generated at step number 8, copy the RSA         key content to the clip board, then go to Add -> select SSH Username with private key. Then add       username, private key value.
15. Then add the build step with “execute shell” and add the command to execute scala application.

16. Now add the scala command to build play applications.

17. In order to execute the play application build command in Jenkins, SBT should be installed on the       host machine. Go to this link http://www.scala-sbt.org/download.html and get the latest SBT.zip         file and extract it in a suitable directory (e.g.: /srv/sbt).
      # cd /srv/sbt/bin/
      # ./sbt

Output : 

18. Now time to build the play application, go to Jenkins server and run the "Build Now”, then you           will see the console output. Finally if you are getting message “success”, then you are done. :) 

Tuesday, April 14, 2015

Configure VisualVM on Ubuntu 14.10

VisualVM is a kind of data gathering software for application which are running under the Java Virtual Machines (JVM). This retrieve information related to the Java application, like heap size, heap dumps, RAM utilisation, CPU utilisation, thread count and so on. There is an special interface that they use for getting information from application ends and gathered information is analysed and displayed on the VisualVM dashboard. Remote application also can be monitored via VisualVM. Specially user can get snapshot of heat dumps also.

Follow the steps to install VisualVM on Ubuntu server.
# sudo apt-get install visualvm
# which viaualvm
# java -version

You can check the java is up & running up using the commands given above. And for testing purpose, I’m here using a Java testing application in the same host. Let’s open the visualVM and configure it to get the information of running applications.

# visualvm

if you need any help related to visualVM you can us,
# visualvm - -help


After open the VisualVM, then you will see the terms and condition that should be accepted. Please accept it and go ahead.


After you agreed to the license agreement you will be displayed the VisualVM home page. In this home page you can see the options that you are having on VisualVm. In the Left side all the options are available. The image given below shows the sample home page of VisualVM.


To test an application, here I’m going to run a test application which contains a digital clock. 

Download this file and extract, then run the testing java application on a terminal, then you will see the Digital clock on a particular application window.
# sudo unzip demo.zip
# cd src/
# javac DemoApp.java
# java DemoApp

After running the testing application, you will see the analytics of the application on the VisualVM dashboard. Locally running all the applications are added automatically to the VisualVM. Sample dashboard image is given below.


How to Add a Remote Host’s Application 


In order to create a connection with a remote Java Application, can be used JMX connection with the remote host. JMX is Java Management Framework, which is used to monitoring, or manage any java based application which running remotely or locally. So this is a best way to use to monitor remotely running Java Application.
In order to run a particular Java application using JMX you have to add several settings on commands.

  1. com.sun.management.jmxremote.port :state which port is assigned to the Application.
  2. com.sun.management.jmxremote.ssl : State the SSL certificate settings.
  3. com.sun.management.jmxremote.authenticate : State the remote Authentication settings.

As an example, here the command that was used to open the DemoApp,
java -Dcom.sun.management.jmxremote.port=3333 -Dcom.sun.management.jmxremote.ssl=false -
Dcom.sun.management.jmxremote.authenticate=false DemoApp

Before adding the remote application for VisualVM, user needs to add the remote host to the VisualVM dashboard. Go to the “Application" on left side and right-click on the "Remote Host”, then click on "Add Remote Host”, then you will be displayed window to add the remote host.
After adding the remote host, you can add whatever the application which are running on added remote host. So right-click on the remote host name and select "Add JMX Connection”, then enter the remote host name and the port number which was assigned previously. After adding those things you can see the added application is displayed under the remote host (Image given below).


After you double-click on the Application, dashboard will be loaded and retrieve analytics and data according to the application weight. In following image you can see, both application are in same dashboard.


In Visual VM dashboard consist of the four tabs. The descriptions for each tabs are given below. 

  • Overview : Contains PID, Host name, arguments, heap dumb, so on, this provides basic idea of the running application.
  • Monitor : Processor consuming, memori consuming likewise utilisation detail.
  • Threads : List of entire threads, state of threads, running time, and so on.
  • Sampler : Sampling information, like CPU, memory.

Finally, I can state that VisualVM can be used to get analytics and mange Java based applications for maximum throughput. 

Thank You.

Rolling Updates & Releases

Rolling update in the sense, update the existing version of an Application, Operating system etc, without interrupting the running systems. 
Most of the LINUX distribution are consisted of the rolling updated and rolling releases, they would be able to attend the updating process while running. So the users and developers are served by best patches and updates for the existing systems.
This rolling updates used several methodologies for updates the systems. one is deliver frequent small updates and patches, as an example arch LINUX would be taken. Another one is replace the old image of the operating system with the new changes, the changes are added to the updating process. The Ubuntu cover versions is an example for this.

Benefits of using Rolling updates and releases.

  1. Easy to maintain the  enterprise level servers and datacenter and clouds with the rolling releases and updates.
  2. Automatically  software applications and servers are get updated without any interruption.
  3. Does not take too long time to upgrade to major releases as the fixed releases. Because the system updates frequently.
And there also a major disadvantage of having rolling updates, because if there is a bug in a update or new release that would be directly affected to the entire system.


But according to the review and experience most of the IT industries uses the rolling update supported systems.