Friday, December 28, 2012

Vim Plugin Management with Vundle

Vundle is a open source package management utility that aims to be a one stop tool for searching, trying and installing plugins. “Vundle is short for Vim bundle…” as documented in the about section of the project homepage at github. The project can be found at [gmarik/vundle]. The quick start requires git to clone vundle and then subsequently you will need to configure the .vimrc file, this file is usually found in a users home folder. The dot at the front of the .vimrc file indicates it is a hidden file. Each operating system has a different way to make hidden files visible, however usage of .vimrc file in vim is a common practice, further information can be found in the vim wiki about .vimrc file page. Completing the installation will enable the following commands in vim.

:BundleInstall – Required to initially install the tool.
:BundleSearch – Allows for searching for plugins. You can install them inline within the search to try them out, however the .vimrc file is not modified by the installation.

Plugin List

  • Xml.Vim – Editing xml with this plugin is made easier with shortcuts, automatic tag completion, and functionality to keep the xml syntactically correct. (REMEMBER: file being edited must be “.xml”)
  • XmlPretty – Formats the xml in a file. (REMEMBER: file being edited must have be “.xml”)
  • fugitive.vim – Git integration with vim, a lot of features.
  • gitv – builds on fugitive to allow browsing all diffs in the history of commits within a git repo.
  • NERDTree – File Browser integration allowing for easy navigation and opening of files from within vim.

Saturday, December 22, 2012

Prallel: DevOps Practices and Matthew 7:3

In a recent article by Michael Stanhke, he specifies that one of the practices of a DevOps culture includes "Admit Failure, Build Trust". This got me thinking about how similar DevOps intends to be the embodiment of teachings in the bible about human interaction. His article can be found here: ""Day 12 - Devops is a Mindset; a Cultural Case Study" on SysAdvent.

DevOps is a movement for improving the cultural interactions of technologists. Especially those of different distinct roles, for example developers and operations persons.

Matthew 7:3 - This is part of the bible, an individual sentence in the teaching of Jesus, in the well known section "Sermon on the mount".  The American Standard Version provides the following translation: "And why beholdest thou the mote that is in thy brother's eye, but considerest not the beam that is in thine own eye?"

In Michael's blog post the "Admit Failure, Build Trust" section says the following:
Post-mortem meetings were a major exercise in blame-storming. I decided that instead of redirecting blame or telling customer groups to design for failure, I would just own the failure. I walked in and said, “hey, we totally screwed up,” continuing with a prepared statement in how we misconfigured some enterprise storage and totally blew up many lines of business when it went wrong. 
The response was amazing. People were left with “oh...um ok then.” No blame and no problems. Honesty panned out! That success drove me to run every post-mortem like that: If was our fault, we shouted it. 
Transparency builds trust.

These type of writings help to bridge the gap between the theological and practical in the work place. Along with bringing truth documented about 2000 years ago into the presence.  Both are difficult to accomplish.  Being part of the DevOps movement as a DevOps Engineer myself and being a believer in Jesus, I appreciate the parallels, maybe you do too. Comments welcome on this post.

Wednesday, May 23, 2012

Jenkins Development by a DevOps Engineer

Contents

Setting Up Eclipse on Ubuntu Linux
I have a Ubuntu Linux running in Virtual Box. It works well, I don’t currently have Eclipse installed so I will be going over that now.  I found the following page, it has step by step instructions:
https://help.ubuntu.com/community/EclipseIDE
Now I’m going to do them in sequence, I will call out any additional information I find helpful. First thing I realized is that it expects you to have working knowledge of the package manager. The following page should help you become familiar with it:
What is a package manager?
I thought I would do this from the command line, since it usually ends in the most beneficial interface for engineers in general. First I will search for the “eclipse” package.
$ apt-cache search eclipse
It prints out a long list of packages that I guess are related to eclipse, I scroll through the output until I come across the following:
eclipse-jdt - Eclipse Java Development Tools (JDT)
Lets try to install that one.
$ sudo apt-get install eclipse-jdt
First thing it does is print out in detail the modifications it will make in detail. Towards the bottom, you’ll find a summary “5 upgraded, 74 newly installed, 0 to remove and 352 not upgraded.” Then it asked me “Do you want to continue [Y/n]?” Well, “Y”, I’d like to continue. Well that took a little while, when I returned I noted the execution of the command had completed, but now a dialog to make updates was present:
image
Ok, well since I’m updating anyways, lets go ahead and see if I can get my system up to date. Still going…this could be a while. Looks like my internet connection dropped half way through, I’ll try to get the rest. Failed again, lets try to exclude those updates:
image
Well that didn’t work, well for whatever reason I can’t get anymore updates right now, the internet is working but getting updates isn’t.  Regardless back to working on Eclipse. So I navigated to the “/usr/bin” folder and ran “eclipse”, and it started up. Great. I created my initial workspace “EclipseWorkspace”.

Overview
The steps I’m using come from the Jenkins online help for building and setting up the development environment, you can find that page here: Building Jenkins

Building the Code
JDK 1.6 (version greater than 6u17) from Oracle
When I ran “$ java –version” on my system I received the following message:
OpenJDK Runtime Environment (IcedTea6 1.11pre) …
OpenJDK Client VM (build 20.0-b11, mixed mode, sharing)
I now need to switch this to use JDK from Oracle. I found these steps online, they are simple enough to just include in this post. Download the “tar.gz” file from Oracle. In my case I downloaded “jdk-7u3-linux-i586.tar.gz”.  It got downloaded to my “downloads” directory.  I navigated to that folder in the terminal and ran the following:
$ tar –xvf jdk-7u3-linux-i586.tar.gz
Then I moved the folder “jdk1.7.0_03” to its permanent location:
$ sudo mv ./jdk1.7.0_03 /usr/lib/jvm/jdk1.7_03
Now I set up the “update-alternatives”. I found useful information about this technology on the following man page.
$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7_03/bin/java" 1 

$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7_03/bin/javac" 1 

$ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7_03/bin/javaws" 1
Next we configure java,javac, and javaws:
sudo update-alternatives --config java   #also run with javac and javaws
When prompted select the newly installed java version. Finally run “java –version”
saasbook@saasbook:~/Downloads$ java -version
java version "1.7.0_03"
Java(TM) SE Runtime Environment (build 1.7.0_03-b04)
Java HotSpot(TM) Client VM (build 22.1-b02, mixed mode)
All that “update-alternatives” technology is great, however there is still a dependency on the JAVA_HOME environment variable that will need to be set. Add it to “/etc/environment” (Remember to do so using “sudo”)
JAVA_HOME=/usr/lib/jvm/jdk1.7_03

Maven 3.x
Download the latest version from the Maven Website. I downloaded “apache-maven-3.0.4-bin.tar.gz”. On the same page are a series of instructions that I go over here with any additional items I came across.
Create a parent directory for all maven versions “/usr/local/apache-maven”. Next extract the archive and move it, by using the following commands:
$ tar –xvf apache-maven-3.0.4-bin.tar.gz
$ sudo mv apache-maven-3.0.4 /usr/local/apache-maven
Next you will need to setup the environment variables, there is an article I found useful in explaining this at “Linux Environment Variables”. Add the following to the “/etc/environment” file (Remember to do so using “sudo”):
M3_HOME=/usr/local/apache-maven/apache-maven-3.0.4
M3=/usr/local/apache-maven/apache-maven-3.0.4/bin
MAVEN_OPTS=”-Xms256m –Xmx512m”
After modifying the “/etc/environment” file you can run the following to immediately update the environment:
$ source environment



Clone Repository from Jenkins

I navigated to the workspace “~/EclipseWorkspace” I created earlier. Once inside the directory I run the command to get a clone of  Jenkins repository:
$ git clone https://github.com/jenkinsci/jenkins.git
$ cd jenkins
$ mvn -Plight-test install

Making the Jenkins source code usable in Eclipse
You need to create the eclipse project files. You do so by the following:
$ mvn -DdownloadSources=true eclipse:eclipse
Next set the classpath variable for M2_HOME = “~/.m2/repository”:
image
Then you can import from the jenkins directory which is in the workspace:
image
image

Debugging Jenkins
At this point if you were following the directions you would be in the “jenkins” folder. From here you do the following:
$ cd war
$ mvnDebug hudson-dev:run
It will put a message on the screen as follows:
Preparing to Execute Maven in Debug Mode
Listening for transport dt_socket at address: 8000
Now open a remote debugging session from within Eclipse:
image
After you press Debug you will be able to see the Eclipse IDE running jenkins and also navigate to the jenkins website:
image