Hosting a Build Enviromentment with Jenkins on Windows Azure
Run websites, check. Run background processing, check. Store structured and unstructured data, check. Run my build environmnt? Absolutely. Often cloud compute power is described as a way to offload computing tasks, or quickly scale out production work loads, but it also has a big role to play in building software develepment environments.
Azure cloud has specific features and characteristics that make it applicable to the software development lifecycle. All dev environmnets need test and certification environments that match the production environment. This is very difficult to provide and often this is skirted. In azure creating multiple parallel environments is easy…and these deployments can be made identical save one thing: public URL or domain address. Development environments also need to be able to test the current release, as well as future releases and perhaps multiple branches. Owning and configuring your own hardware to support this can be expensive. Azure allows us to spin up as many deployments as we like, run them only for the duration of the test period, and spin them back down again. Think flexibility. Finally, all agile focused development environments need one or more build servers. In this post I’ll show you how to run a Jenkins build server within the Azure cloud.
1. Create a virtual machine to host your Jenkins instance.
On the left menu select virtual machines. If this is your first time the console will indicate that you have no virtual machines and invite you to create one. You instance will be given a subdomain of your choosing. The passwords are for Remote Desktop which we’ll use later. I chose extra small, however, you can choose among 5 sizes of VM. When you choose done Azure will begin creating your VM…it will also create a storage account to host your disks, and create a disk to hold the OS for you. What’s new in this Azure launch is that these disks are persistent and will keep all changes you made between system resets. They are persistent. You see the status change from provisioning to Stopped, to Running.
Also note that a storage account was created. This hosts your OS disk, and potentially any data disks we create later.
2. Using IE, download and install Jenkins.
Win2008 servers have extremely high browsing security turned on, so you’ll either need to disable enhanced security, or add the domains you are accessing. The download for the Windows installer for Jenkins is http://mirrors.jenkins-ci.org/windows/latest . Download and expand the zip file, then run setup.
3. Specify a Public Port
Now you’ll notice that Jenkins is running after performing the install. Each time this VM is restarted, Jenkins will also be run as a service. What you may also not is that you cannot access the server externally. For this you need to either create a public port entry or a VIP. I’ll cover private networking in a follow-up post. To make an HTTP server visible from outside select “Virtual Machines” and click on the VM we’ve just created, then “Enpoints”. The public port can be anything, I recommend port 80, and the default private port Jenkins uses is port 8080.
4. Test your deployment.
It’ll take a few minutes, once ready you can click on the domain name of your VM and bring up the Jenkins opening screen. Clearly this isn’t ideal as we’ll need to protect our build environment so stay tuned and we’ll look more closely at Virtual Private networking with Azure.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)