Being an experienced Linux guy I've not really had much cause to play with Windows (except for perhaps the occasional game that wouldn't work well in Wine. This was about to change when my boss asked me to do CI in Windows. It wasn't nice.
In a current contract position that I'm in I've been responsible for setting up their continuous integration. Initially this was great and it was in my comfort zone. I like nothing better than to be tinkering with Linux boxes, optimising them and automating them to an inch of their life. I had managed to set up vagrant and puppet scripts for the majority of their sites, most of which were Wordpress but one or two were Drupal or static. Easy peasy. Jenkins handled the deployment and puppet managed the infrastructure. I was basically starting on a green field here too. The original LAMP infrastructure was basic and not very mature so it was easy to rip it out and start again. Luckily GIT was used for these projects so source control was simple. Then the call came in.... They want me to help migrate their Windows boxes to using continuous integration too. One or two people would call me biased when it comes to Windows. They'd probably be right. But, in all fairness I've never given it a good try to properly judge it. I've almost imagined it as this slow dinosaur where the developer demanded an icon for every task they required. GUIs were king, automation and the poor command-line were relegated to relics. It was time for that preconception to change, or at least become justified. Vagrant is a delight when setting up development environments. Barring some edge-cases I can pretty reproduce any Linux server nicely into a VM that I can bring up and down at will. Dev will match Staging will match Live. You can imagine my optimism when I found that Vagrant in-fact now works with Windows! Fantastic. This is going to work brilliantly and it will provide the much needed convergence and healing that our two developer communities need! First, I started with just setting up a local virtual machine. First hurdle was found - licenses. How dare Microsoft charge money for their products! I grabbed a 120 day trial for Windows Server 2012 and turned it into a Vagrant base box. This would be my starting point. Windows doesn't have a package manager. This was actually one of the first reasons that attracted me to linux. Simply putting something like
sudo apt-get install mysql was magic. No such joy in Windows. There is though chocolatey. This claims to be the missing package manager for windows and it does a pretty good job at helping to automate some installation of software. First I needed to make a shopping list of packages I require on the box:
- SQL Server Express
Because it was a local virtual machine controlled by Vagrant I didn't have a need to connect it to a puppet master. Instead I used the inbuilt provisioning tools which are available in Vagrant. I created a puppet manifest utilising the puppet chocolatey module and I was on my way.
The progress did not last long...
Git and SVN was an easy install but looking at the packages that Chocolatey provides I could see that I will have to manage IIS a different way. I'm glad actually because in Linux I manage Apaches virtual hosts and installation via a puppet module. I quickly downloaded the IIS module for puppet. IIS is nothing like Apache. A few tutorials later I learned how IIS manages their concept of "Virtual Hosts". They use terms like application pools and virtual directories. Fair enough. I can see the benefits in App Pools. Again though puppet has been a life saver with managing IIS. The command line tools for IIS are ugly you get one command to rule them all with a thousand options that have no constant style. Thank the puppet master for that IIS module. Next was SQL Server. Bear in mind that I'm used to Linux. To do a basic install of mysql it's as easy as
sudo yum install mysql in CentOS or
sudo apt-get install mysql in Ubuntu. Can't be so hard in Windows surely? Well it is. To download SQL Server is one of the most over complicated long winded procedures I have ever endured in all of my career. I'm not alone in this opinion I couldn't do it. Puppet Enterprise does come with a SQL Server module. After hours of trying to find a solution I gave up and created my very own snowflake server. I'll automate that later I promised myself. But the good news is that I got it installed! Time for Jenkins and some deployment magic. I ripped out the puppet manifest and put it into my puppet master. I fired up a new VM that was on ESX with Windows Server on it and I had puppet provision it. Again, saddened that I had to install SQL Server Express manually. It took ages but eventually it all provisioned nicely.
Time to deploy a simple ASP.NET site.
In the Windows world in the company that I was contracted for they still use Subversion. So I wrote a simple Jenkins job that would run on the shiny new Windows server. After some battling with getting Jenkins to enslave the server (Java issues -- can't blame MS for that one!) I had successfully deployed some code to a windows box! Puppet was controlling IIS well and had created an app pool and virtual directory for me.
I dared to peak at the result...to be continued