Thursday, July 25, 2013

Yes, M'Lord! Jenkins CI and AWS

A few weeks ago, I had a crazy idea: use the free tier of services that AWS provides to build a cloud based, accessible from anywhere development environment.

Had this development been in Java, this may have been feasible. Given this project requires Windows 2012 Server to build (because I need Code Contracts), that left me with not even close to enough hard disk space to install even Visual Studio Express.

How else could I use this amazing technology? Enter Jenkins:


Now, I know that creating a CI server may seem a bit out of the purview of this project, but it's so damn COOL! For those not in the know, Jenkins (available at http://jenkins-ci.org/) is an open source continuous integration server. Meaning, you can set Jenkins up to automatically pull down the most recent code changes and do stuff with it, whether this stuff be compiling, running tests, deploying the artifacts to a demo server or emailing people when a build fails.

So, what more perfect use could I put a free AWS server to?

Setting this up was moderately complicated so I'll outline the steps below:


  1. Set up your AWS instance with Windows 2012 Server.
  2. Install .NET 4.5 and Windows 8 SDK, all available from Microsoft's download site.
  3. Copy the MSBuild folder from C:\Program Files (x86)\MSBuild on your development machine to the same location on the AWS instance. This step is really only needed if your project is going to include any features for Windows 8 app development.
  4. Install Code Contracts.
  5. Install Jenkins using the MSI installer and follow the set up.
  6. Add TCP port 8080 to the Security Group associated with your AWS instance.
  7. Create an Elastic IP and associate it with your AWS instance.
  8. In a browser, navigate to port 8080 of the EIP you created above: http://<your EIP>:8080. You should be greeted by Jenkins.
  9. Install the MSBuild plugin, and a plugin to deal with whatever type of repository you have for your code base. Set up these plugins as per their instructions.
  10. Create a job that polls the repo and create a build step that builds the solution file for your project when it detects changes.
Optionally, you can set up Jenkins to email you on build failure, but there are plenty of tutorials on the net on how to do this.

I must say, I'm mightily impressed with how easy it is to set up Jenkins, what a cool piece of software! Okay, it's time for me to really get serious about coding, until next time!

No comments:

Post a Comment