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!

Thursday, July 4, 2013

AWS stands for AWesome Sauce



Quick update here: AWS is awesome. In between work tasks (waiting for tests to run, waiting for compilation, etc.) I've been playing with the free AWS stuff that Amazon is currently offering, specifically EC2. I've managed to create my own cloud based Windows 2012 server instance and am running VS2012 Express on it.

How. Cool. Is. That?

Once I get a clone of my project on this VM, I'll be able to remotely work on my code from any Windows machine (using Remote Desktop Connect). Even though the free speeds and disk space aren't great, it'll be more than perfect for getting a quick couple of lines out here and there and pushing them up to my repo so that I can pull them down on my actual development machine.

But, when I start raking in the dough, I won't have to do that. I may actually be able to forgo having a development machine altogether and just let Amazon manage my stuff for me. Sure, I'll have to pay for it (I believe the hourly rates are somewhere between 2 and 7 cents). But this will be perfect if I ever decide I can go back to using a netbook for all my online operations.

I could conceivably even code from a tablet or a PHONE! Especially in those times when I have a flash of inspiration about a particular project and need to code it out. As in, right now. This happens more often than one would think.

The future is really here.

Monday, July 1, 2013

Setting up VS2012, Git, and CodePlex

I figured that even though I found the process to be fairly straight forward, someone out there would benefit from a step by step about it.

  1. First things first: install Git. This is probably the step that some of my coworkers would cringe at. While CodePlex apparently has extensions for use with Mercurial, the set up page mentions that the Mercurial stuff doesn't work as well. I didn't try it personally (even though I'm more of a Mercurial guy), so this post won't cover it. This Google Code project has great installation instructions for TortoiseGit: https://code.google.com/p/tortoisegit/
  2. Next, Microsoft has made a handy Git plugin for VS2012, available here: http://visualstudiogallery.msdn.microsoft.com/abafc7d6-dcaa-40f4-8a5e-d6724bdb980c. This enables access to a Git repository from directly within VS, something that I found handy while using Eclipse and Mercurial. The plugin is fairly straightforward, neat and clean looking, so I'd have to recommend it.
  3. Go to your CodePlex project's source code tab. This assumes you've already made a project, but if you haven't it's not that hard (and it's free!) so go do it already! Click the Clone button and you should get a pop up similar to the following (taken from the CodePlex Git setup site available here, conveniently the same address I pulled the following picture from). Copy the address they conveniently highlight for you, you'll need it later.
  4. Open up Visual Studio and load whatever solution you want to add to CodePlex repository. If you haven't created the project or solution yet, or if there's something else you want to do, this page will probably be helpful. Right click on the project in the Solution Explorer.
  5. Select "Add Solution to Source Control..." and then select Git.
  6. Once this is set up, click the commits button for the repository. The first time you do this, VS will ask for an address for your repository. This is where you paste in the address that CodePlex gives you in Step 3. (Picture linked from http://blogs.msdn.com/b/visualstudioalm/archive/2013/02/06/set-up-connect-and-publish-using-visual-studio-with-git.aspx)


And that's it! You should be off and coding in no time. Once you commit, and push, the changes should go directly into your CodePlex repository and you should be able to see them in CodePlex's source browser. I hope you found this helpful, feel free to leave questions/comments below. Happy coding!