TurnKey Linux Virtual Appliance Library

TKLPatch for Jenkins (Hudson)

[Update 24-10-2011] Latest version here.

[Update 31-01-2011] I'll be changing to Jenkins on my second release of this TKLPatch. I really don't trust Oracle when it comes to opensource.

Continuous Integration comming to TurnkeyLinux! This TKLPatch will convert turnkey-core-11.0rc to a powerful Hudson Continuous Integration Server. I'm new to this topic but was in the need of this appliance, and after some research I decided to build this patch for Hudson. If anybody have experiencience with it and wants to share some recommendations to include, feel free to do so. I just did the basic deployment. I thought on making an inithook script to ask the hudsun manager password and secure the server on firstboot, but then I felt it was easiest to simply let the final user decide and create it's own admin user and permissions. 
 
Notes: I used tkl-core and not tkl-tomcat because of the default mysql server in tkl-tomcat is not needed and I prefered to install tomcat6 over remove mysql-server.
 

Features:

- Tomcat6 running in ports 80 and 443 (http and https respectly, using same config as tkl-tomcat)
- Hudson 1.389 (the main page link is pointing to 1.386 as the last one but the link is outdated)
- Application deployed to tomcat's root. 
 

What it does:

 
1. Set Hostname to hudson
HOSTNAME=hudson 
echo "$HOSTNAME" > /etc/hostname 
sed -i "s|127.0.1.1 \(.*\)|127.0.1.1 $HOSTNAME|" /etc/hosts 
2. Update package information 
apt-get update
3. Install tomcat6 and openssl to generate certs. Also installed authbind to bind tomcat to ports 80 and 443. 
install tomcat6 openssl authbind
4. Remove tomcat6 default app
rm -Rf /var/lib/tomcat6/webapps/ROOT/
5. Download hudson 1.389 war. The lastest link in Hudson's homepage is outdated :S
mkdir -p /opt/hudson && cd /opt/hudson
wget http://updates.hudson-labs.org/download/war/1.389/hudson.war
6. Deploy hudson on tomcat's root
ln -s /opt/hudson/hudson.war /var/lib/tomcat6/webapps/ROOT.war
7. Enable authbind to bind tomcat to ports lower than 1024
echo "AUTHBIND=yes" >> /etc/default/tomcat6
8. Set hudson home in jvm params.
echo JAVA_OPTS=\"\${JAVA_OPTS} -DHUDSON_HOME=/var/lib/tomcat6/webapps/hudson\" >> /etc/default/tomcat6
9. Shutdown tomcat
service tomcat6 stop
10. Clean apt cache
apt-get clean
 
Enjoy!
Attached: 
Liraz Siri's picture

Hopefully we'll manage to squeeze this into part 2

We're working on part 2 of the release right now so I'm hoping we can get Hudson in there. I haven't had the pleasure of using this myself. Are you using it for anything yourself?

Hurray!

I was ashamed to ask to include hudson but I reaaally wanted to happen! To be honest, I'll start using it this month, that's why I prepared this tklpatch, to give it a ride. I just can't install something without making the patch :P

I tell you how it goes, I'm also waiting for the final openldap appliance for a super-secret project I'm working on mwahahaha...

Great effort Adrian!

I am using Hudson on a daily basis. Unfortunately, I have to run it on windoze:(, so cannot be of much help. However, I can offer some observations for what it worth.

Hudson is essentially a build server with Java being the favorite (but by no means the only) target. To do something useful you would want to include some build tools as well as unit testing, logging and documentation tools for every target language.

Examples:
Java: JDK, Ant, Maven, jUnit, javadoc, log4j...
Cpp: gcc, make, CMake, cppUnit, doxygen ...
Python: py.test, nose, sphinx, epydoc...
...

You would also want to install Hudson plugins for version control systems (except SVN and CVS, which are included.)

There is about a million of other plugins, good luck with that.


Thanks!

That's the kind of feedback I was waiting for! Just today I haven't finished deploying my hudson server at home, but yes, reading a bit I found that at least ant should be in there. 

I'll follow your suggestions, right now I'm interested in having support for java, ruby, python and php. 

But I'll try not to include the most used generic plugins as it's important to keep it light and let the final users customize as they see fit.

Thanks for your suggestions!

Liraz Siri's picture

Jenkins vs Hudson should we wait?

Adrian, I see you added a note saying you would update the patch to use Jenkins. Does that mean we should delay building a new appliance for TKL 11 part 2 based on Jenkins? If we push out test builds of part 2 in batches we could just defer this to the end.

Yes, you should

Jenkins is about to release their first version (latest hudson) and I think we should go with them. I'm also adding new things to the patch, so please wait until I complete a new version this week. My plans for this next release are to:

- Add plugins for the TKL supported scm (git, svn, hg, ?)

- Add ant, rake, gcc, make and openjdk (I haven't decided yet on maven). 

- Add xUnit support for java/php/python/ruby (still need to research what's available)

- Add inithook to secure jenkins on firstboot (best practice)

 

As you can see in Vyacheslav Rafalskiy's comment, he suggest some other things, but I'll need some help on deciding, as there are lots of plugins there, but my main idea is to support java, php, ruby, and python, but maybe I should include C++ also?. But I agree with him on including at least a build tool, a unit testing library, and a documentation tool for autogenerating docs. I'm not really sure how useful is logging tool? My lack of experience on the subject doesn't help. 

So yes, please wait a bit to see what can be added. 

The Python part

As for the Python part, both py.test and nose support output in xUnit format.

I outline below the way I configure my environments. You may find it helpful.

# a workaround to avoid using broken version of setuptools (python-setuptools)
apt-get install python-pip  # package manager
pip install distribute      # this will bring the patched version of setuptools

# the rest of packages are installed from PyPI
# from this point both 'easy_install' and 'pip install' will work

easy_install virtualenv # de-facto standard for creating independent development and deployment environments
easy_install nose    # unit test framework
easy_install pytest  # unit test framework
easy_install sphinx  # documentation tool
easy_install epydoc  # API documentation tool


Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)