<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>code&#039;s life</title>
	<atom:link href="http://codeslife.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://codeslife.com</link>
	<description>Better Code, Better Life</description>
	<lastBuildDate>Sat, 31 Mar 2012 09:52:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>groovy template example for email-ext plugin inside jenkins</title>
		<link>http://codeslife.com/2012/03/31/groovy-template-example-for-email-ext-plugin-inside-jenkins/</link>
		<comments>http://codeslife.com/2012/03/31/groovy-template-example-for-email-ext-plugin-inside-jenkins/#comments</comments>
		<pubDate>Sat, 31 Mar 2012 09:52:16 +0000</pubDate>
		<dc:creator>larrycai</dc:creator>
				<category><![CDATA[Continuous Delivery]]></category>
		<category><![CDATA[email-ext]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[jenkins]]></category>
		<category><![CDATA[travis-ci]]></category>

		<guid isPermaLink="false">http://codeslife.com/?p=619</guid>
		<description><![CDATA[Receiving clean build information from CI server is very important to me, it is learning from http://travis-ci.org , so I want to have this in jenkins server as well since it is just html format. How it works You need to install “email-ext” plugin https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin for your jenkins first, and follow the guideline to configure [...]]]></description>
			<content:encoded><![CDATA[<p>Receiving clean build information from CI server is very important to me, it is learning from <a href="http://travis-ci.org">http://travis-ci.org</a> , so I want to have this in jenkins server as well since it is just html format.</p>
<h4>How it works</h4>
<p><img style="display: inline; margin-left: 0px; margin-right: 0px" height="104" src="http://groovy.codehaus.org/images/groovy-logo-medium.png" width="208" align="right">You need to install “email-ext” plugin <a href="https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin">https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin</a> for your jenkins first, and follow the guideline to configure the basic setup first.</p>
<p>Now this plugin sopport html template using jelly/js/groovy, jelly looks complex to me, so I decided to choose groovy (<a href="http://groovy.codehaus.org/">http://groovy.codehaus.org/</a>), which is an agile and <strong>dynamic language</strong> for the JVM.</p>
<p>In order to use groovy customized html template, we need do extra</p>
<h5>Create template directory</h5>
<p>The template directory doesn’t exist, need to be created first, you can copy the <a href="https://github.com/jenkinsci/email-ext-plugin/blob/master/src/main/resources/hudson/plugins/emailext/templates/groovy-html.template">template file from github</a> directly</p>
</p>
<pre><code>$ mkdir $JENKINS_HOME\email-templates # put the template inside</pre>
<p></code></p>
<h5>Enable groovy template inside project</h5>
<p>Then in the jenkins, configure the post action in the job like below</p>
<p><a href="http://codeslife.com/wp-content/uploads/2012/03/image.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="131" alt="image" src="http://codeslife.com/wp-content/uploads/2012/03/image_thumb.png" width="366" border="0"></a> </p>
</p>
<h5>Bugs in groovy</h5>
<p>Unfortunately there are some bugs in the default template, and I provided one fix (<a href="https://issues.jenkins-ci.org/browse/JENKINS-13191">issue #13191</a>) there. Others needs more time to fix. Don’t worry, since we will redesign the html anyway, don’t need so care about the old one. </p>
<p>Anyway, you should receive html report in ugly format like below</p>
<p><a href="http://codeslife.com/wp-content/uploads/2012/03/image1.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="155" alt="image" src="http://codeslife.com/wp-content/uploads/2012/03/image_thumb1.png" width="244" border="0"></a>&nbsp; </p>
<h4>Design my own html</h4>
<p>Inspired by travis-ci’s report, I want to better html report from jenkins as well, below is my sketech for this.</p>
<p><a href="http://codeslife.com/wp-content/uploads/2012/03/image2.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin-left: 0px; margin-right: 0px; border-right-width: 0px" height="174" alt="image" src="http://codeslife.com/wp-content/uploads/2012/03/image_thumb2.png" width="223" border="0"></a></p>
<ul>
<li>news: is used in header for general remindings
<li>status/main/detail: are all build information from job
<li>support: extra line for support information, like email, faq, etc ..</li>
</ul>
<p>With the help from my friend @haojii, we got final html/css like below</p>
<p><a href="http://codeslife.com/wp-content/uploads/2012/03/image3.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="170" alt="image" src="http://codeslife.com/wp-content/uploads/2012/03/image_thumb3.png" width="244" border="0"></a> <a href="http://codeslife.com/wp-content/uploads/2012/03/image4.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="165" alt="image" src="http://codeslife.com/wp-content/uploads/2012/03/image_thumb4.png" width="270" border="0"></a> </p>
<p>I don’t want to go detail on the groovy, you just download the artifact: <a href="https://raw.github.com/larrycai/email-ext-plugin/master/src/main/resources/hudson/plugins/emailext/templates/groovy-html-larry.template">groovy-html-larry.template</a> from my cloned <a href="https://github.com/larrycai/email-ext-plugin">email-ext repo@github</a> and give a try.</p>
<p>It works for git, and skip some information in groovy standard template since it covers more cases, anyway it works for me and it is good enough.</p>
<h5>DIY</h5>
<p>You can tune with html file groovy-html-larry.html on your css and structure and apply to groovy template when it works</p>
<h4>Summary</h4>
<p>Better email report will help team to find their information quickly, and make it fun.</p>
<p>This is the first learning from travis-ci.org, and there are more ideas will be copied to jenkins.</p>
<p>Leave comments here if it works for you.</p>
<p>&nbsp;</p>
<p><a href="http://codeslife.com/wp-content/uploads/2012/03/image5.png"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://codeslife.com/2012/03/31/groovy-template-example-for-email-ext-plugin-inside-jenkins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CI on demand &#8211; learn from travis-ci</title>
		<link>http://codeslife.com/2012/02/23/ci-on-demand-learn-from-travis-ci/</link>
		<comments>http://codeslife.com/2012/02/23/ci-on-demand-learn-from-travis-ci/#comments</comments>
		<pubDate>Thu, 23 Feb 2012 05:56:33 +0000</pubDate>
		<dc:creator>larrycai</dc:creator>
				<category><![CDATA[Continuous Delivery]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[jenkins]]></category>
		<category><![CDATA[travis-ci]]></category>

		<guid isPermaLink="false">http://codeslife.com/?p=606</guid>
		<description><![CDATA[Didn’t blog for long time, mainly due to I am learning to many new things , let’s start the CI part. In short http://www.travis-ci.org gives me the new thinking of CI, and I think it is the evoluation as well, originally I think CloudBee (jenkins behind it) http://www.cloudbees.com/ is great to put development into cloud. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://codeslife.com/wp-content/uploads/2012/02/image.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin-left: 0px; margin-right: 0px; border-right-width: 0px" height="149" alt="image" src="http://codeslife.com/wp-content/uploads/2012/02/image_thumb.png" width="244" align="right" border="0" /></a>Didn’t blog for long time, mainly due to I am learning to many new things <img src='http://codeslife.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> , let’s start the CI part.</p>
<p>In short <a href="http://www.travis-ci.org">http://www.travis-ci.org</a> gives me the new thinking of CI, and I think it is the evoluation as well, originally I think CloudBee (jenkins behind it) <a href="http://www.cloudbees.com/">http://www.cloudbees.com/</a> is great to put development into cloud. But that is just next normal step, not evolution (at least in CI part). </p>
<p>Let’s see how traditional CI works</p>
<h4>Normal CI server like Jenkins</h4>
<p><img style="display: inline; margin-left: 0px; margin-right: 0px" height="108" src="https://wiki.jenkins-ci.org/download/attachments/753667/jenkins-screenshot.png" width="187" align="right" />Everytime we talk about CI, we will have 2 steps in mind</p>
<p>- prepare the CI server with needed 3pp installed.    <br />- CMer will create the job for related tasks towards code repository</p>
<p>Looks good and smoothly, and we are used to it. </p>
<p>It had some limitations</p>
<h5>Multi platform or package dependance</h5>
<p><img style="display: inline; margin-left: 0px; margin-right: 0px" src="http://www.adderview.com/images/AdderView_Matrix_MP.jpg" align="right" />It will be quite trickly if you want your software to be built and verified in different OS, mostly we need prepare the same machines, if you are good at jenkins, then master/slave mode is used.</p>
<p>Then go further for multi 3pp and different dependance, then this make environment preparation is very hard, since the matrix will be large.</p>
<p>You may think about cross compiler, one solution for building.</p>
<p>Surely as I demoed before, you can use vagrant/virtualbox inside jenkins server, yes, it is good, just not elegant</p>
<h5>Jobs are managed by CMer</h5>
<p>It is named jobs to each build task, and since it is central, mostly only CMer had permission to create jobs and let CI server run for you, it covers mainly on master/main branch. Since server is limited, running CI for your private branch is expensive on adminstrative.</p>
<p>And who understand best on building and testing environment ? It should be developers, so why not let developers to configure what they want and build for it ?</p>
<h4>Awesome Travis-CI</h4>
<p><a href="http://codeslife.com/wp-content/uploads/2012/02/image1.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin-left: 0px; margin-right: 0px; border-right-width: 0px" height="99" alt="image" src="http://codeslife.com/wp-content/uploads/2012/02/image_thumb1.png" width="244" align="right" border="0" /></a>So what it is really needed for good CI ?</p>
<p>As a developer, I can write down which os/environment that build is needed, just like right, I need several extra packages and two ruby platform on Ubuntu OS. Also I know how to execute the build.</p>
<p>That’s good enough for a build, so CI will do the rest all, this is what <a href="http://travis-ci.org">http://travis-ci.org</a> ‘s job</p>
<p>- After I put this configuration besides source codes and push to github    <br />- travis-ci load virtual machine from pool via vagrant/virtualbox, currently it supports Ubuntu 11.04 only     <br />- travis-ci apply your configuration into virtual machine using chef     <br />- travis-ci run you job, and give report, see example: <a href="http://travis-ci.org/#!/larrycai/sdcamp">http://travis-ci.org/#!/larrycai/sdcamp</a>    <br />- travis-ci distroy the vm and put back into pool</p>
</p>
</p>
</p>
<p>That’s all the CI should do and this is exactly I want !</p>
<h5>What’s the benefit</h5>
<p>No CMer is involved, not only time is saved, but also I don’t need to spend time to communicate with them on which kind of environment (package), because it is my business, not their focus.</p>
<p>I can trigger build as much as possible with full control, and since the build normally last shorted, other developers will reuse the machine after my time slot, Even they use total different platform.</p>
<h4>Summary</h4>
<p>I don’t want to say jenkins is bad, actually it is quite powerful and flexibility. I just want to indicate travis-ci understand better for the future of the build</p>
<p>Go there, try it and even fork it to run by yourself.</p>
<p>I love opensource, innovation comes from competition! Well done both to jenkins and travis-ci.</p>
<p>And I want to name this is “CI on deman” or “Private CI”.</p>
]]></content:encoded>
			<wfw:commentRss>http://codeslife.com/2012/02/23/ci-on-demand-learn-from-travis-ci/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>From requirement to live document ? can we remove waste ?</title>
		<link>http://codeslife.com/2012/01/06/from-requirement-to-live-document-can-we-remove-waste/</link>
		<comments>http://codeslife.com/2012/01/06/from-requirement-to-live-document-can-we-remove-waste/#comments</comments>
		<pubDate>Fri, 06 Jan 2012 07:39:48 +0000</pubDate>
		<dc:creator>larrycai</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[Specification by Example]]></category>

		<guid isPermaLink="false">http://codeslife.com/?p=599</guid>
		<description><![CDATA[I had some discussion in previous blog Specification by Example – The way to enhance testing &#38; Requirement for this. Let’s continue. Background Now let’s take a look at in normal product development, what’s work flow for the requirement towards customer document and system document. Requirement is put into focalpoint (or others) and bring to [...]]]></description>
			<content:encoded><![CDATA[<p>I had some discussion in previous blog <a href="http://codeslife.com/2011/12/28/specification-by-example-the-way-to-enhance-testing-requirement/">Specification by Example – The way to enhance testing &amp; Requirement</a> for this.</p>
<p>Let’s continue.</p>
<h4>Background</h4>
<p>Now let’s take a look at in normal product development, what’s work flow for the requirement towards customer document and system document. </p>
<p><a href="http://codeslife.com/wp-content/uploads/2012/01/image2.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="135" alt="image" src="http://codeslife.com/wp-content/uploads/2012/01/image_thumb2.png" width="244" border="0" /></a> </p>
<p><strong>Requirement</strong> is put into focalpoint (or others) and bring to R&amp;D, scrum is mostly used, <strong>product backlog </strong>and<strong> Sprint backlog </strong>will be generated in excel or agile tools (including redmine, teamforge, jira, whiteboard), it covers from high level requirement to user story level.</p>
<p>Testers start to analysis the requirement and generate<strong> test specification</strong> level document in word, it will be reviewed by senior group and put stamp – go!. <strong>test case description</strong> is more detail on use case testing level, mostly they will be converted into real <strong>test case script</strong> for automation inside CI.</p>
<p>When the project goes to end, <strong>test report </strong>is requested to be finalized and stored somewhere.</p>
<p>CPI technical writer will collect all the information and write in tagtool for <strong>CPI</strong> (product customer document)</p>
<p>System managers will collect information to update <strong>system document</strong> like System Architecture Description.</p>
<h5>Observation</h5>
<p>Every document exists for some reason, while from agile/lean point of view.</p>
<p>Do you see any waste here ? waste on the documentation and waste on time to write the document ?</p>
<p>Do you still understand the purpose of those documentation ?</p>
<p>And please don’t think from your roles (testers, managers, technical writters), stand from of your product.</p>
<p>From my point of view, the designer area (coding) is much improved compare to before, most of APIs are genrated into documentation automatically, quality is promised via tools like CI, sonar.</p>
<h4>Specification by example</h4>
<p>I don’t want to repeat the famous free delivery for bookstore example from “Specification by example” on how it could work with less waste, please read it <a href="http://www.manning.com/adzic/">sample chapter 2</a> from manning directly.</p>
<p><a href="http://codeslife.com/wp-content/uploads/2012/01/image3.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="148" alt="image" src="http://codeslife.com/wp-content/uploads/2012/01/image_thumb3.png" width="244" border="0" /></a> </p>
<h4>Possible solution for us</h4>
<p>I don’t state it can 100% work for us, just give idea how it can work</p>
<p>We can combine all the test documents to cucumber (one nice tool) feature files like below</p>
<p><a href="http://codeslife.com/wp-content/uploads/2012/01/image4.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="193" alt="image" src="http://codeslife.com/wp-content/uploads/2012/01/image_thumb4.png" width="244" border="0" /></a> </p>
<p>below the Feature title, we can add detail background for the requirement, it can surve as test spec.</p>
<p>All the scenarios are exactly the same as test case description on detail enough for testing.</p>
<p>This specification (test case) could be directly executed by cucumber driver.</p>
<p>When the test case is executed, it could be automatically generated into html file, it could be test report</p>
<p><a href="http://codeslife.com/wp-content/uploads/2012/01/image5.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="169" alt="image" src="http://codeslife.com/wp-content/uploads/2012/01/image_thumb5.png" width="244" border="0" /></a> </p>
<p>And if we had some scripts to convert .feature to latex/docbook, it can be automatically generated high-quality documents like pdf, since we can predefine some structure, which can be mapped to end result.</p>
<p>See good example from <a href="http://progit.org/">Pro Git</a> book.</p>
<p><a href="http://codeslife.com/wp-content/uploads/2012/01/image6.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="207" alt="image" src="http://codeslife.com/wp-content/uploads/2012/01/image_thumb6.png" width="199" border="0" /></a> <a href="http://codeslife.com/wp-content/uploads/2012/01/image7.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="205" alt="image" src="http://codeslife.com/wp-content/uploads/2012/01/image_thumb7.png" width="173" border="0" /></a> <a href="http://codeslife.com/wp-content/uploads/2012/01/image8.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="205" alt="image" src="http://codeslife.com/wp-content/uploads/2012/01/image_thumb8.png" width="147" border="0" /></a>&#160; </p>
<p>From left to right: markdown plaintext, simple html, ebook pdf format. (it is coverted by <a href="http://johnmacfarlane.net/pandoc/">pandoc</a> to latex and <a href="http://www.tug.org/texlive/">texlive</a> to pdf)</p>
<p>Furthermore, .epub (iPad), .mobi (Kindle) are supported as well, and everything is automatically.</p>
<p>And this could happen for us as well.</p>
<h4>Summary &amp; Go ahead</h4>
<p><a href="http://codeslife.com/wp-content/uploads/2012/01/image9.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin-left: 0px; margin-right: 0px; border-right-width: 0px" height="130" alt="image" src="http://codeslife.com/wp-content/uploads/2012/01/image_thumb9.png" width="111" align="right" border="0" /></a> Probably you want to challenge again that it doesn’t work for you because blah, blah, then I recommend to buy the book <a href="http://specificationbyexample.com/">“Specification by example” from Gojko Adzic</a></p>
<p>I will continue to look into this area and I will try my best to remove useless project document using “Specification by example” and Cucumber.</p>
]]></content:encoded>
			<wfw:commentRss>http://codeslife.com/2012/01/06/from-requirement-to-live-document-can-we-remove-waste/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Share folders with Virtual machine using Virtualbox</title>
		<link>http://codeslife.com/2012/01/04/share-folders-with-virtual-machine-using-virtualbox/</link>
		<comments>http://codeslife.com/2012/01/04/share-folders-with-virtual-machine-using-virtualbox/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 06:09:01 +0000</pubDate>
		<dc:creator>larrycai</dc:creator>
				<category><![CDATA[tool]]></category>
		<category><![CDATA[virtualbox]]></category>

		<guid isPermaLink="false">http://codeslife.com/2012/01/04/share-folders-with-virtual-machine-using-virtualbox/</guid>
		<description><![CDATA[Since we use Windows Vista as default, we are used to load virtual machines to try linux stuff, and it will be nice if we can share folders between host (windows) and guest (linux) machines. The document “shared folders” had some traps, and I can’t make it work, below are list some important steps to [...]]]></description>
			<content:encoded><![CDATA[<p>Since we use Windows Vista as default, we are used to load virtual machines to try linux stuff, and it will be nice if we can share folders between host (windows) and guest (linux) machines.</p>
<p>The document <a href="https://www.virtualbox.org/manual/ch04.html#sharedfolders">“shared folders”</a> had some traps, and I can’t make it work, below are list some important steps to get it work </p>
<h5>Envrionment</h5>
<p>Ubuntu 11.04 (Natty) as guest OS and Virtualbox as virtual machine management tools</p>
<h5>Install Guest Additions</h5>
<p><a href="http://www.virtualbox.org/manual/ch04.html">Virtualbox Guest Additions</a> should be installed for shared folders, it is a .iso files to be mounted, when it is mounted in guest OS (Ubuntu), it can be executed </p>
<p><a href="http://codeslife.com/wp-content/uploads/2012/01/image.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="135" alt="image" src="http://codeslife.com/wp-content/uploads/2012/01/image_thumb.png" width="244" border="0" /></a> </p>
<h5>Install linux kernel</h5>
<p>I met the following error when I try to install the guest additional </p>
<pre>[guest] # cat /var/log/vboxadd-install.log
Makefile:23: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=&lt;directory&gt; and run Make again..&#160; Stop.</pre>
<p>After googled, I found the good article <a href="http://blog.oracle48.nl/adding-shared-folders-to-virtual-box-guest-using-the-command-line/">http://blog.oracle48.nl/adding-shared-folders-to-virtual-box-guest-using-the-command-line/</a>, later I noticed it existed inside chapter 4 as well.</p>
<p>Therefore I need to install dkms package and related headers (it depends on which kernel you use)</p>
<pre>apt-get install dkms
apt-get install linux-headers-2.6.38-11-generic</pre>
<h5>Shared folder from host to guest</h5>
<p>it can be easily configured in virtual machines’ setting, if you set it automatically, it will exist when reboot</p>
<p><a href="http://codeslife.com/wp-content/uploads/2012/01/image1.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="180" alt="image" src="http://codeslife.com/wp-content/uploads/2012/01/image_thumb1.png" width="244" border="0" /></a> </p>
<p>If it goes well, you will see it <code>/media/sf_sdcamp</code>, which works if you run in root id, and as documented, you can also mount it for normal user.</p>
<pre>mount –t vboxsf sdcamp /mnt/sdcamp</pre>
<p><code>/mnt/sdcamp</code> should be created in advance</p>
<p>Anyway, now it works very well, I edited in Windows Environment, and run some specical commands under linux environment</p>
]]></content:encoded>
			<wfw:commentRss>http://codeslife.com/2012/01/04/share-folders-with-virtual-machine-using-virtualbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Specification by Example &#8211; The way to enhance testing &amp; Requirement</title>
		<link>http://codeslife.com/2011/12/28/specification-by-example-the-way-to-enhance-testing-requirement/</link>
		<comments>http://codeslife.com/2011/12/28/specification-by-example-the-way-to-enhance-testing-requirement/#comments</comments>
		<pubDate>Wed, 28 Dec 2011 15:18:59 +0000</pubDate>
		<dc:creator>larrycai</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[Specification by Example]]></category>

		<guid isPermaLink="false">http://codeslife.com/2011/12/28/specification-by-example-the-way-to-enhance-testing-requirement/</guid>
		<description><![CDATA[Probably you are playing with agile for a while and notice some problems for testing and requirement handling, then I want to recommend “Specification by Example” Let’s start with problem Problem in requirement handling and testing Testers are used to follow and verify the implementation In traditional software development, it is pure waterfall, system level [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://codeslife.com/wp-content/uploads/2011/12/image.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin-left: 0px; margin-right: 0px; border-right-width: 0px" height="223" alt="image" src="http://codeslife.com/wp-content/uploads/2011/12/image_thumb.png" width="171" align="right" border="0" /></a> </p>
<p>Probably you are playing with agile for a while and notice some problems for testing and requirement handling, then I want to <strong><font color="#008000">recommend “Specification by Example”</font></strong> </p>
<p>Let’s start with problem</p>
<h4>Problem in requirement handling and testing</h4>
<h5>Testers are used to follow and verify the implementation</h5>
<p>In traditional software development, it is pure waterfall, system level define the requirement, and testers write test specification on how to test it, designers are implementing it. After the coding is finished, the live system is verified by testers according to the test spec.</p>
<p>When we turns to agile way of working, mostly this model will be kept without change, some teams even use small waterfall inside the team.</p>
<p>Lots of technical debts come out in end of each iteration because there are gaps between testers’ understanding and designers’ undestanding, then people are used to complain on the requirement.</p>
<p>In the same time, tester’s motivation is used to be low, they just simple verify what has been done. Some senior testers used lots of method to make sure all the bugs can be found, which is great.</p>
<p><strong><font color="#ff0000">BUT do we testing the right thing ? !!!</font></strong></p>
<h5>No practical way to clarify the requirement</h5>
<p>Some sites may run agile better, they invited PO frequently to clarify the requirement, and had PBR “Product Backlog Refineworkshop” meeting (see Craig &amp; Bas’s book “Practices for Scaling Lean &amp; Agile Development”). While this is just the framework, people mostly had problem how to make it effiency, and how to get the requirement and make it clearly.</p>
<h5>ATDD doesn’t work</h5>
<p>When quick scan the “Specification by example”, most people will treat it is the same as ATDD and BDD, while in the book and his workshop, he clearly stated,” yes, they are quite similar, and there are more mind-set changes for SBE”.</p>
<p>The importance of SBE is to the practical way to clarify the specification by examples, here are the key process patterns, I used to use this pursuide my colleagues</p>
<p><a href="http://codeslife.com/wp-content/uploads/2011/12/image1.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="239" alt="image" src="http://codeslife.com/wp-content/uploads/2011/12/image_thumb1.png" width="289" border="0" /></a> </p>
<h4>Some tips to deploy Specification by Example</h4>
<p>it cannot be described easier in one blog, let give some tips that I used if you want to try</p>
<h5>Start without tool</h5>
<p>I made this mistake before as well, since mostly we will use tool to support your automation (this is good, but tough task), therefore I didn’t make ATDD works in my product.</p>
<p>It is quite easy to focus on automation instead of clarifying the requirement when you deploy it, so start without tool.</p>
<p>In my pilot, I just ask the testers (they are trainined for this concept for sure) to write specification with what SBE suggested, put the business value inside instead steps.</p>
<h5>Understand the tool, but it is not necessary </h5>
<p>People are used to lost why do this in this kind format, so you need to understand some tools to see how it can be automated to execute the specification and automate it easily. </p>
<p>There are lots of nice tool, like cucumber (<a href="http://cukes.info/">http://cukes.info/</a>), which is most popular and useful tool, and I push team members to write in its format.</p>
<p><a href="http://codeslife.com/wp-content/uploads/2011/12/image2.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="121" alt="image" src="http://codeslife.com/wp-content/uploads/2011/12/image_thumb2.png" width="244" border="0" /></a> </p>
<p>Fitnesse and RobotFramework are good, but I don’t recommend, since they are built long time ago, it can support SBE, but they are not generated by SBE concept, while cucumber do comes from that.</p>
<h5>Can do it as well for your products </h5>
<p>People are used to say, “yeah, it works for web application, but our product is different”, it is not true. The way to clarify the requirement is the same, surely it may be more difficult and not so straight, but it do works.</p>
<p>You can read his book as well for some patterns.</p>
<p>Start with small and you can get benefit directly</p>
<h4>Summary</h4>
<p>I list some benefits so far for my consultant service on this area after 1-2 months (surely other practices are applied as well)</p>
<ol>
<li>Testers get more motivation than before, since they drive the requirement clarification and notice the importance the role inside the team, they drive what to implement </li>
<li>Requirements are easier to be clear compare to before, therefore the technical debt from this is gone, less waste. </li>
</ol>
<p>Therefore, I do suggest</p>
<ul>
<li>Buy this book or at least read some free <a href="http://www.manning.com/adzic/">excellent sample chapters</a> from manning to understand it, if possible, join his workshop </li>
<li>Try it and it can work from day one, trust me. </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://codeslife.com/2011/12/28/specification-by-example-the-way-to-enhance-testing-requirement/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>create virtualbox on fly using veewee</title>
		<link>http://codeslife.com/2011/10/25/create-virtualbox-on-fly-using-veewee/</link>
		<comments>http://codeslife.com/2011/10/25/create-virtualbox-on-fly-using-veewee/#comments</comments>
		<pubDate>Tue, 25 Oct 2011 06:11:29 +0000</pubDate>
		<dc:creator>larrycai</dc:creator>
				<category><![CDATA[Continuous Delivery]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[vagrant]]></category>
		<category><![CDATA[veewee]]></category>
		<category><![CDATA[virtualbox]]></category>

		<guid isPermaLink="false">http://codeslife.com/2011/10/25/create-virtualbox-on-fly-using-veewee/</guid>
		<description><![CDATA[one headache of using vagrant is to have base box, and creating basebox from scratch is headache, and how to solve it ? You want to create by yourself for some framework, please wait for a minute, there already had one project veewee, and I don’t want to repeat the nice blog http://www.ducea.com/2011/08/15/building-vagrant-boxes-with-veewee/ as well. [...]]]></description>
			<content:encoded><![CDATA[<p>one headache of using vagrant is to have base box, and creating basebox from scratch is headache, and how to solve it ?</p>
<p>You want to create by yourself for some framework, please wait for a minute, there already had one project <a href="https://github.com/jedi4ever/veewee">veewee</a>, and I don’t want to repeat the nice blog <a href="http://www.ducea.com/2011/08/15/building-vagrant-boxes-with-veewee/">http://www.ducea.com/2011/08/15/building-vagrant-boxes-with-veewee/</a> as well.</p>
<p>Below just some tips when I tried this morning</p>
<h4>veewee tips</h4>
<h5>veewee directory structure</h5>
<p>I prefer to create one seperate <code>veewee</code> directory for this tasks.     <br />iso files should be download in advance, and make a softlink under created directory iso.     <br />then you can define your own basebox like below</p>
<pre>~/veewee$ vagrant basebox define 'ubuntu1104' 'ubuntu-11.04-server-i386'</pre>
<p>the directory will looks like below, you type command under veewee directory</p>
<pre>~/veewee$ find
.
./definitions
./definitions/myubuntubox
./definitions/myubuntubox/postinstall.sh
./definitions/myubuntubox/preseed.cfg
./definitions/myubuntubox/definition.rb
./definitions/ubuntu1104
./definitions/ubuntu1104/postinstall.sh
./definitions/ubuntu1104/preseed.cfg
./definitions/ubuntu1104/definition.rb
./iso
./iso/ubuntu-11.04-server-i386.iso</pre>
<h5>virtualbox headless</h5>
<p>suppose it should work headless (without GUI), while when I create basebox, it pops error on keyboard permisson, and when I enable my X11 display (since I tried it in my local linux server), it pops up virtualbox GUI and start to install.</p>
<p>it is excellent feeling when you see it is under auto-installtion.</p>
<h5>configure apt proxy</h5>
<p>since I try this in the company, I need to setup the proxy, it is fine to add the line <code>export http_proxy=http://proxy:8080</code> in the beginning of <code>postinstall.cfg</code>, and it works fine.</p>
<h4>look inside of veewee</h4>
<p>the architecture of veewee looks great, it adds subcommand in vagrant, and all the majoy information are put into <code>definition.rb</code></p>
<pre>Veewee::Session.declare({
  :cpu_count =&gt; '1', :memory_size=&gt; '384',
  :disk_size =&gt; '10140', :disk_format =&gt; 'VDI', :hostiocache =&gt; 'off',
  <img src='http://codeslife.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> s_type_id =&gt; 'Ubuntu',
  :iso_file =&gt; &quot;ubuntu-11.04-server-i386.iso&quot;,
  :iso_src =&gt; &quot;http://releases.ubuntu.com/11.04/ubuntu-11.04-server-i386.iso&quot;,
  :iso_md5 =&gt; &quot;ce1cee108de737d7492e37069eed538e&quot;,
  :iso_download_timeout =&gt; &quot;1000&quot;,
  :boot_wait =&gt; &quot;10&quot;, :boot_cmd_sequence =&gt; [
    '<esc><esc><enter>',
    '/install/vmlinuz noapic preseed/url=http://%IP%:%PORT%/preseed.cfg ',
    'debian-installer=en_US auto locale=en_US kbd-chooser/method=us ',
    'hostname=%NAME% ',
    'fb=false debconf/frontend=noninteractive ',
    'keyboard-configuration/layout=USA keyboard-configuration/variant=USA console-setup/ask_detect=false ',
    'initrd=/install/initrd.gz -- <enter>'
  ],
  :kickstart_port =&gt; &quot;7122&quot;, :kickstart_timeout =&gt; &quot;10000&quot;, :kickstart_file =&gt; &quot;preseed.cfg&quot;,
  :ssh_login_timeout =&gt; &quot;10000&quot;, :ssh_user =&gt; &quot;vagrant&quot;, :ssh_password =&gt; &quot;vagrant&quot;, :ssh_key =&gt; &quot;&quot;,
  :ssh_host_port =&gt; &quot;7222&quot;, :ssh_guest_port =&gt; &quot;22&quot;,
  :sudo_cmd =&gt; &quot;echo '%p'|sudo -S sh '%f'&quot;,
  :shutdown_cmd =&gt; &quot;shutdown -P now&quot;,
  :postinstall_files =&gt; [ &quot;postinstall.sh&quot;], :postinstall_timeout =&gt; &quot;10000&quot;
})</pre>
<p>it will be used during boot time to trigger the auto-installation, different os will use own auto-installation method, <code>preseed.cfg</code> is used for ubuntu/debian, if for suse then kickstart is used. <code>postinstall.sh</code> is used when the os is installed and rebooted. </p>
<h4>summary</h4>
<p>with those tool stacks (virtualbox,vagrant,puppet, veewee), your work makes more easily, don’t reinvent the wheel, don’t DIY. Use others brain.</p>
]]></content:encoded>
			<wfw:commentRss>http://codeslife.com/2011/10/25/create-virtualbox-on-fly-using-veewee/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>make ci easier with jenkins CI and Vagrant</title>
		<link>http://codeslife.com/2011/10/21/make-ci-easier-with-jenkins-ci-and-vagrant/</link>
		<comments>http://codeslife.com/2011/10/21/make-ci-easier-with-jenkins-ci-and-vagrant/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 02:11:09 +0000</pubDate>
		<dc:creator>larrycai</dc:creator>
				<category><![CDATA[Continuous Delivery]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[jenkins]]></category>
		<category><![CDATA[vagrant]]></category>
		<category><![CDATA[virtualbox]]></category>

		<guid isPermaLink="false">http://codeslife.com/2011/10/21/make-ci-easier-with-jenkins-ci-and-vagrant/</guid>
		<description><![CDATA[Last time, I mentioned the nice tool for vagrant which can control virtualbox virtual machines easily, at once I start to think how it can be used in CI system easily. Also I noticed the question @ stackoverflow http://stackoverflow.com/questions/6941547/how-to-combine-vagrant-with-jenkins-for-the-perfect-continuous-integration-envir/7830173#7830173, and my suggestion is below Separate virtual machines environment Why Mostly your jenkins server is used [...]]]></description>
			<content:encoded><![CDATA[<p>Last time, I mentioned the nice tool for vagrant which can control virtualbox virtual machines easily, at once I start to think how it can be used in CI system easily.</p>
<p>Also I noticed the question @ stackoverflow <a href="http://stackoverflow.com/questions/6941547/how-to-combine-vagrant-with-jenkins-for-the-perfect-continuous-integration-envir/7830173#7830173">http://stackoverflow.com/questions/6941547/how-to-combine-vagrant-with-jenkins-for-the-perfect-continuous-integration-envir/7830173#7830173</a>, and my suggestion is below</p>
<h4>Separate virtual machines environment </h4>
<h5>Why</h5>
<p>Mostly your jenkins server is used for lots of tasks, therefore it is run mostly by restricted user, for example it is tomcat6 if running as servlet, or normal jenkins user, and mostly they don’t have shell access to avoid problem.</p>
<p>Vagrant may needs lots of 3pps which may different with normal jenkins user.</p>
<p>Therefore it is better to separate the virtual machine environment</p>
<h5>Jenkins master/slave mode</h5>
<p>This is the nice solution to solve this problem to isolate the environment, just new another node in your jenkins server (which is master) as below</p>
<p><a href="http://codeslife.com/wp-content/uploads/2011/10/image3.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="198" alt="image" src="http://codeslife.com/wp-content/uploads/2011/10/image_thumb3.png" width="330" border="0" /></a></p>
<p>It is communicated by ssh, and it will invoke the slave.jar automatically. And here I created the vagrant user for this, why ?</p>
<h5>Reuse the ssh public/private key</h5>
<p>If you played with vagrant, you know vagrant can access virtual machine via ssh without password, it because it uses the ssh public/private key.</p>
<p>Therefore I created the vagrant user and put the private/public key into ~vagrant/.ssh directory, mostly they are under /var/lib/gems/1.8/gems/vagrant-0.8.7/keys/, which is used by vagrant, if you don’t know where it is, please type vagrant ssh_config</p>
<p><a href="http://codeslife.com/wp-content/uploads/2011/10/image4.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="80" alt="image" src="http://codeslife.com/wp-content/uploads/2011/10/image_thumb4.png" width="244" border="0" /></a></p>
<h5>Prepare the base box under vagrant user</h5>
<p>Follow the normal vagrant guideline, and create one vm box, for example, I put it under ~/vm/ubuntu</p>
<h4></h4>
<h4>New the CI job to control VM</h4>
<p>Now it is time to configure a job to experience this, in jenkins master node, create a job in freestyle</p>
<p><a href="http://codeslife.com/wp-content/uploads/2011/10/image5.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="122" alt="image" src="http://codeslife.com/wp-content/uploads/2011/10/image_thumb5.png" width="244" border="0" /></a> </p>
<p>Label Expression is the category we defined in slave node.</p>
<p>In the task (Build – Execute shell), jenkins slave try to go to that directory and start vagrant, then doing some simple tasks to evaulate whether it is done in our vm box.</p>
<p><a href="http://codeslife.com/wp-content/uploads/2011/10/image6.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="145" alt="image" src="http://codeslife.com/wp-content/uploads/2011/10/image_thumb6.png" width="244" border="0" /></a> </p>
<p><font color="#008000"><strong>!! REMEBER, this is done in slave mode using vagrant user !!</strong></font></p>
</p>
<p>Now you can see the job is invoked in slave vagrant node</p>
<p><a href="http://codeslife.com/wp-content/uploads/2011/10/image7.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="165" alt="image" src="http://codeslife.com/wp-content/uploads/2011/10/image_thumb7.png" width="244" border="0" /></a> </p>
<p>In the console output, you can notice the result</p>
<p><a href="http://codeslife.com/wp-content/uploads/2011/10/image8.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="181" alt="image" src="http://codeslife.com/wp-content/uploads/2011/10/image_thumb8.png" width="244" border="0" /></a> </p>
<h4>Summary</h4>
<p>Using Vagrant in jenkins master/slave mode is perfect match for this job, you can get lots of flexibility using virtualmachine.    <br />veewee is another layer above vagrant to control vm box more easily.</p>
]]></content:encoded>
			<wfw:commentRss>http://codeslife.com/2011/10/21/make-ci-easier-with-jenkins-ci-and-vagrant/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>learn vagrant &#8211; manage your virtualbox</title>
		<link>http://codeslife.com/2011/10/13/learn-vagrant-manage-your-virtualbox/</link>
		<comments>http://codeslife.com/2011/10/13/learn-vagrant-manage-your-virtualbox/#comments</comments>
		<pubDate>Thu, 13 Oct 2011 07:50:35 +0000</pubDate>
		<dc:creator>larrycai</dc:creator>
				<category><![CDATA[Continuous Delivery]]></category>
		<category><![CDATA[puppet]]></category>
		<category><![CDATA[vagrant]]></category>

		<guid isPermaLink="false">http://codeslife.com/2011/10/13/learn-vagrant-manage-your-virtualbox/</guid>
		<description><![CDATA[Probably you remember that I did a lot of investigation on how to manage the virtualbox via command line before, unfortunately my solution is not so elegant and I almost gave up !! because I think it should be solution outside (don’t reinvent your wheel) And yes, vagrant (http://vagrantup.com/) is the toolkit for this purpose. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://codeslife.com/wp-content/uploads/2011/10/image1.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin-left: 0px; margin-right: 0px; border-right-width: 0px" height="244" alt="image" src="http://codeslife.com/wp-content/uploads/2011/10/image_thumb1.png" width="231" align="right" border="0" /></a> Probably you remember that I did a lot of investigation on how to manage the virtualbox via command line before, unfortunately my solution is not so elegant and I almost gave up !! because I think it should be solution outside (don’t reinvent your wheel)</p>
<p>And yes, vagrant (<a href="http://vagrantup.com/">http://vagrantup.com/</a>) is the toolkit for this purpose.</p>
<h4>Introduction</h4>
<p>From webpage, it is mentioned “Vagrant is a tool for building and distributing virtualized development environments” and it use virtualbox API to control the virtual machines, and I think the generated vm should be easily converted into other format, I quickly load the raw disk into vmware, it works as well (need check more)</p>
<p>The guideline from web is already clear enough, it needs ruby and virtualbox 4.1.*, and I download the box (I use <a href="http://www.vagrantbox.es/26/">http://www.vagrantbox.es/26/</a>) from the webpage in advance</p>
<pre><code>$ gem install vagrant
$ vagrant box add ubuntu-1104 </code>talifun-ubuntu-11.04-server-i386.box<code>$ vagrant init
$ vagrant up$ vagrant ssh</code></pre>
<p>and now I can visit the virtual machines !!!, so easy so nice.</p>
<p>The virtualmachines images are put under ~/.vagrant.d/boxes, the ovf is not recognized by vmware, but the raw disk vmdk is almost ok for virtual machines.</p>
<h4>Work with Puppet</h4>
<p>Besides the vm management, another most interesting part is it use puppet to do provisioning the system, everything is set in puppet configuration files. (check my previous blog)</p>
<p>Then when the vm loaded, it will apply the setting from your puppet configuration</p>
<p>Take a look at the nice slides for <a href="http://assets.en.oreilly.com/1/event/61/Vagrant%20_%20Puppet_%20Deploying%20Development%20Environments%20___%20Fast%20Presentation.pdf">how Vagrant &amp; Puppet works together</a></p>
<h4>Use cases</h4>
<p>I think this blog indicates exactly what I dreamed for longer time, <a href="http://paperairoplane.net/?p=240">How we use Vagrant as a throwaway testing environment</a></p>
<ol>
<li>load existing base VM (vagrant) </li>
<li>install product packages with wanted configuration (puppet) </li>
<li>testing your product using your test case (like cucumber) </li>
<li>finish the VM and update the relate webpage for the results. </li>
</ol>
<p>In your CI environment, it can automatically control lots of VM with lots of testing.</p>
<h4>Summary</h4>
</p>
</p>
<p><a href="http://codeslife.com/wp-content/uploads/2011/10/image2.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin-left: 0px; margin-right: 0px; border-right-width: 0px" height="172" alt="image" src="http://codeslife.com/wp-content/uploads/2011/10/image_thumb2.png" width="281" align="left" border="0" /></a>Vagrant is a very new toolkit and it is quicky got lots of attention in this area, take a look and use it in your testing lab, don’t reinvent your own wheel.</p>
<p>I think there should exist similar toolkits like vagrant for Amazon EC2, Xen with puppet.</p>
<p>And I will start experience real product soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://codeslife.com/2011/10/13/learn-vagrant-manage-your-virtualbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>learn puppet 2 &#8211; install tomcat with web app</title>
		<link>http://codeslife.com/2011/10/08/learn-puppet-2-install-tomcat-with-web-app/</link>
		<comments>http://codeslife.com/2011/10/08/learn-puppet-2-install-tomcat-with-web-app/#comments</comments>
		<pubDate>Sat, 08 Oct 2011 08:08:38 +0000</pubDate>
		<dc:creator>larrycai</dc:creator>
				<category><![CDATA[Continuous Delivery]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[puppet]]></category>

		<guid isPermaLink="false">http://codeslife.com/2011/10/08/learn-puppet-2-install-tomcat-with-web-app/</guid>
		<description><![CDATA[Deploying Apache Tomcat Applications With Puppet is a good start point for using puppet to install tomcat. Start without client/server mode It is much easy to use puppet as installation tool in single node as well, “puppet apply” mode can be used to practice your .pp files locally, as example above puppet --modulepath /srv/puppet-tomcat-demo/modules -v [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://codeslife.com/wp-content/uploads/2011/10/image.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin-left: 0px; margin-right: 0px; border-right-width: 0px" height="194" alt="image" src="http://codeslife.com/wp-content/uploads/2011/10/image_thumb.png" width="155" align="right" border="0" /></a> <a href="http://www.tomcatexpert.com/blog/2010/04/29/deploying-tomcat-applications-puppet">Deploying Apache Tomcat Applications With Puppet</a> is a good start point for using puppet to install tomcat.</p>
<h5></h5>
<h4>Start without client/server mode</h4>
<p>It is much easy to use puppet as installation tool in single node as well, “puppet apply” mode can be used to practice your .pp files locally, as example above</p>
<pre>puppet --modulepath /srv/puppet-tomcat-demo/modules -v /srv/puppet-tomcat-demo/site.pp</pre>
<p>it will automatically download the tomcat6 packages even openjdk packages for you.</p>
<p>The default port is 735 (&lt;1024), which seems have permission problem at least for me, I simple changed it to 3735, then it works very well for me.</p>
<p>And there are two tips, more check <a href="http://www.devco.net/archives/2009/08/19/tips_and_tricks_for_puppet_debugging.php">http://www.devco.net/archives/2009/08/19/tips_and_tricks_for_puppet_debugging.php</a></p>
<ol>
<li><code>--debug</code> is good option for more detail debug information under command line </li>
<li><code>--parseonly</code> is good to do syntax check </li>
</ol>
<h4>Client/server mode</h4>
<h5>ssl is still tricky</h5>
<p>the ssl authentication is still trick, my two working virtual machines doesn’t work again, I delete all “*.pem”, it still doesn’t work, “*.yaml” is deleted as well, and put full domain name in puppet.conf, and it works. Actually I still don’t know what’s the clue, anyway it works again after 1 hour (!!!).</p>
<h5>Put it as module</h5>
<p>Move the tomcat as module under /etc/puppet, and put site.pp information to node.pp, the path is hard-coded first</p>
<pre>path =&gt; '/srv/puppet-tomcat-demo/java_src/SimpleServlet.war'</pre>
<p>It should exist in agent node first to make testing easy, when it works, we start to deal with puppet source</p>
<h5>Puppet source</h5>
<p>The resource should exist in server side or nfs server, let’s use server first</p>
<pre>path =&gt; ‘puppet:///modules/tomcat/war/SimpleServlet.war’</pre>
<h5></h5>
<p>it indicates to use puppet protocol (only support protocol so far), and actually it maps to </code>/etc/puppet/modules/tomcat/files/war/SimpleServlet.war, and read the puppet wiki <a href="http://docs.puppetlabs.com/guides/file_serving.html">http://docs.puppetlabs.com/guides/file_serving.html</a> is more clear for this.</p>
<p>Then it is quite clean in client side, well done.</p>
<h4>Next step</h4>
<p>Just think about how to switch to Sun (oracle) JRE, which is more stable for system and also start to think how to deal with own package system since currently the package comes from public repo.</p>
<p>just a record for my learning on puppet for auto-deployment.</p>
]]></content:encoded>
			<wfw:commentRss>http://codeslife.com/2011/10/08/learn-puppet-2-install-tomcat-with-web-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>learn puppet &#8211; auto deployment</title>
		<link>http://codeslife.com/2011/09/30/learn-puppet-auto-deployment/</link>
		<comments>http://codeslife.com/2011/09/30/learn-puppet-auto-deployment/#comments</comments>
		<pubDate>Fri, 30 Sep 2011 06:47:28 +0000</pubDate>
		<dc:creator>larrycai</dc:creator>
				<category><![CDATA[Continuous Delivery]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[puppet]]></category>

		<guid isPermaLink="false">http://codeslife.com/2011/09/30/learn-puppet-auto-deployment/</guid>
		<description><![CDATA[In contiuous delivery, auto deployment is one key issue, and puppet is one popular tools to implement this, and I spent two days to learn it. Introduction Probably you can start with the slides http://www.slideshare.net/teyotyree/puppet-talk-at-oscon-2010, in short, Puppet is an open source framework and toolset for managing the configuration of computer systems, you may care [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://codeslife.com/wp-content/uploads/2011/09/image5.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin-left: 0px; margin-right: 0px; border-right-width: 0px" height="211" alt="image" src="http://codeslife.com/wp-content/uploads/2011/09/image_thumb5.png" width="171" align="right" border="0" /></a> In contiuous delivery, auto deployment is one key issue, and puppet is one popular tools to implement this, and I spent two days to learn it.</p>
<h4>Introduction</h4>
<p>Probably you can start with the slides <a href="http://www.slideshare.net/teyotyree/puppet-talk-at-oscon-2010">http://www.slideshare.net/teyotyree/puppet-talk-at-oscon-2010</a>, in short, <a href="http://puppetlabs.com/">Puppet</a> is an open source framework and toolset for managing the configuration of computer systems, you may care about the resource like ssh instead of real package, it is a nice weapon for sysadmin and our auto deployment.</p>
<p>Puppet itself is written by ruby, but mostly you just need to deal with configuration (DSL)</p>
<p>It may have other versions now, and I choose open source which is available for ubuntu.</p>
<h5>Getting started</h5>
<p>I prepare two virtual machines, which is created from ubuntu 11.04, one is puppet master (puppet, 192.168.56.100), another one acts as puppet agent (puppet1, 192.168.56.101).</p>
<p> <code>&gt; apt-get install puppet # agent/client    <br />&gt; apt-get install puppermaster # master</code>
<p>Then you can follow <a href="http://docs.puppetlabs.com/learning/manifests.html">http://docs.puppetlabs.com/learning/manifests.html</a> to write one simple puppet resource files like 1.file.pp to execute in agent machine to experience it.</p>
<p>So nice it will automatically regenerate it when the resource is not correct</p>
<h5>Connect from agent to master</h5>
<p>Next step is try to put the resource in master side, and auto install something from agent, I follow <a href="https://help.ubuntu.com/11.04/serverguide/C/puppet.html">https://help.ubuntu.com/11.04/serverguide/C/puppet.html</a> to define apache2 package in master side.</p>
<p>Then in agent side to run command to verify it, wooh, the ssh connection is so weird, I spend 1 day to figure it out, see lesson learned.</p>
<p> <code>&gt; pupper agent –t</code>
<p>it will call the default master server (puppet) to fetch resource information, and notice it needs apache2, it will call internal command (guess apt-get) to install apache2 for me.</p>
<p>After I remove the apache2 package and run above command again, it is back as expected !!</p>
<p> <code>&gt; apt-get autoremove apache2</code><br />
<h5>Module installation</h5>
<p>Mostly besides package, you need deal with other issues, therefore in puppet, we need to bind everything into one module, <a href="http://www.apress.com/9781430230571">Pro Puppet book</a> had a very good example on how to customize apache configuration after installation, please go there and download the source codes (chapter02\apache)</p>
<p> <code>user@puppet:/etc/puppet$ find modules/apache/    <br />modules/apache/manifests/init.pp     <br />modules/apache/manifests/install.pp     <br />modules/apache/manifests/service.pp     <br />modules/apache/manifests/vhost.pp     <br />modules/apache/templates/vhost.conf.erb
<p>user@puppet:/etc/puppet$ cat manifests/site.pp      <br />import 'nodes.pp' </p>
<p>user@puppet:/etc/puppet$ cat manifests/nodes.pp      <br />node &quot;puppet1.example.com&quot; {       <br />&#160; info &quot;In node for ubuntu&quot;       <br />&#160; include apache       <br />&#160; apache::vhost { 'puppet1':       <br />&#160;&#160;&#160; port =&gt; 80,       <br />&#160;&#160;&#160; docroot =&gt; '/var/www/puppet1',       <br />&#160;&#160;&#160; ssl =&gt; false,       <br />&#160;&#160;&#160; priority =&gt; 10,       <br />&#160;&#160;&#160; serveraliases =&gt; 'puppet1',       <br />&#160; }       <br />} </p>
<p> </code>
<p>When you put all these files under master node, and invoke it from agent node, it will install apache2 and customize the /etc/apache2/sites-enabled/10-puppet1 configuration automatically.</p>
<h4>Lesson learned</h4>
<p>When it works, puppet is very good, but the log system and his structure may be complex to the beginner, so be aware of this and learn it step by step, if the environment is not good, it doesn’t work, and it may not give you correct direction why it doesn’t work.</p>
<h5></h5>
<h5>ssl authentication is quite trick, be careful</h5>
<p>one headache is the error message is not so clear and ssl itself is always troublesome especially if you are not expert on this area, I think my problem mainly is changing the hostname after the CA cerfication (ca.pem) is generated.</p>
<p>You may need check <a href="http://www.madboa.com/geek/openssl/">http://www.madboa.com/geek/openssl/</a> to figure out what is the problem</p>
<h5>Be careful with the version</h5>
<p>make sure you use the version 2.6.*+, origianlly one of my ubuntu server is 10.x based, which use puppet 2.5.x, lots of commands are different, so please make sure the version</p>
<h4>Summary</h4>
<p>Puppet is a wonderful tool, don’t reinvent the wheel to create your own scripts to deploy the system from the scratch, and this is just the start, I will dig into more to see how to use it connected within product deployment inside CI</p>
]]></content:encoded>
			<wfw:commentRss>http://codeslife.com/2011/09/30/learn-puppet-auto-deployment/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

