Virtualise Your Work: Virtual Machine Tips

Virtual Machines are an incredible resource in modern-day software development. This bird does all his development in VMs. Being contractors and servicing many disparate clients, VMs allow us to keep copies of various clients’ development environments, ready to run at a moment’s notice. No de-installing / re-installing, searching for the correct version of Visual Studio, etc. And nothing done during development can affect one’s everyday host environment. Testing an application on several different “clean installs” of Windows would be hugely resource and time intensive without VMs.

We use VMWare’s Workstation  and Fusion Pro products. There are others out there, and Oracle’s VirtualBox is a very capable free alternative. VMs allow us to do Windows development on Linux and Mac OSX–our preferred operating systems.

To get the most out of virtual machines, there are a few tips that will save heaps of time (while the tips below relate directly to VMWare, all the concepts apply to VirtualBox as well):

  • Understand the Terminology: Host versus Guest
    The first thing to do is understand the difference between your “host” OS and “guest” OS.  The “host” is your workstation and your usual OS, and the “guest” is whatever OS your running inside the VM.
  • Use Clones
    Clones are likely the most under-used feature of VMWare and VirtualBox. Cloning is making a copy of the VM under a different name. There are two major types of clones:

    • Full
      A complete, full-size copy that is totally independent of the original VM image.
    • Linked
      A smaller copy that is dependent upon the VM base image from which it was cloned. Linked Clones are extremely useful for working between two or more different hosts. Linked clones are a fraction of the size of the VM (“base image”) from which they were cloned, and they contain only the changes made since the clone operation. Once a linked clone is created, treat the base image as read-only and open the linked clone when starting the VM.
  • Increase Performance with Linked Clones
    To get the best performance possible, create a Linked Clone and store it on a separate drive/controller from the base image. This spreads the workload over two different disk controllers, increasing throughput.
  • Increase Portability with Linked Clones
    When working on two different hosts, say one’s laptop and one’s desktop or one’s “work” workstation and one’s “home” workstation, create a linked clone and store the base image on a read-only volume on each host.  Then all you need to do is carry the “clone image” back and forth between workstations. The clone image contains all the changes made, and it is able to run off either copy of the base image. No need to transport the base image which doesn’t change. Often a base image is 30GB in size while the clone image 3GB or less. Of course, it all depends on the number of changes and amount of work done on the clone, but the point is the 30GB+ base image never changes and doesn’t need to travel with you between workstations.
  • Snapshot after Cloning
    Snapshots save an image of the state and content of the VM at a point in time. They are very useful as rollback points. One may rollback to a snapshot at any time, completely restoring the state and content of the VM to what it looked like at that point in time. After creating any clone, it is beneficial to create a “baseline” snapshot. Indeed a snapshot is critical to the linked clone process because the linked clone images need a savepoint to refer to in the base image. When creating a linked clone in Windows VMWare, one can choose which snapshot to base the clone on.  I’ll expand on this topic in a subsequent post.
  • Use Shared Drives
    Share drives are another underutilized feature of VMs. It is possible to create drive mappings in the guest that refer to directories on the host. Anything saved to a shared drive gets saved directly to the host system instead of inside the VM. Of course it is possible to drag-and-drop from the host into the VM, and out of the VM onto the host, but Shared Drives allow applications to save to the host disk as well.
  • Mind the Linked Clone Size
    Because the liked clones record every disk-related action done during a VM session, they can grow quickly. One can use disk-cleanup to manage this, or the best way is to periodically create another full-clone from the linked clone. The full-clone process cleans-up the disk and shrinks the VM as much as possible into a new VM file. Then you repeat the linked clone process.
  • Clone Frequently
    Making frequent full-clones keeps the VM to a manageable size. Without making frequent clones, one will end up with a huge VM file that doesn’t perform well.
  • Use Snapshots
    As mentioned above, Snapshots are a great way to return to a know state or point in time. Snapshots may be made while the VM is running or powered down. Powering down the VM prior to taking a Snapshot is preferable primarily because it can be difficult to start a VM with a “running” snapshot on a different host and CPU.
  • Disk Clean-up and Defragment
    Frequent disk clean-up and defragmeting (of the VM disk) can recover large amounts of disk space otherwise occupied by the VM file. Defragmenting the VM disk increases the VM’s performance.
  • Power-Down before  Snapshots and Transport
    Always power-down the VM before transferring it to another host machine to avoid trouble caused by running up the “running” state of the VM on the destination host’s different CPU.

All of these tips apply to VirtualBox as well, although VirtualBox is somewhat more difficult to manage. It doesn’t accommodate host changes as well as VMware does, although most problems can be overcome with some editing of config files.

We hope these tips will encourage you to take advantage of all the benefits offered by virtual machines. Let us know if you have any favourite tips…

<peck><peck>

Wireless Tech in Hospitals

I just saw an advert for a company who is developing wireless monitoring telemetry for hospitals. Are they serious?

How many deaths will result from this? I can’t even get through one movie on AppleTV without my WIFI dropping out. I can imagine every time a nurse puts a burrito in the microwave, six patients flatline…

Why So Angry?

Often people ask what makes me the Angry Kiwi? Well plenty; but mostly it’s IT. Yes, our beloved IT. Dad shares my feelings. Between the two of us, we have almost 26 years in the industry. Doing consulting, programming, installation,  documentation, and all sorts of support. Dad describes a day of programming as “frustration and rage punctuated by moments of great satisfaction.” And what makes it frustrating? The tools, the layers, the constant innovation; the things that don’t work like they are supposed to.  <grrrr>

The reason Mankind hasn’t returned to the moon isn’t money, it’s technology. If we tried that trip today, everyone on board would be killed by a wireless router failure or null reference exception.

Today’s technology is simply not reliable enough, or so it often seems. Well, not like back in the day, anyway. Sure the whole LEM had the processing power of a handheld calculator, but there were relatively few “moving pieces;” simpler (but not “simple” by any means) and more predictable. The assembler source code for the Apollo Guidance Computer software, Luminary,  is about 1700 pages long and seriously complex, but it was reliable.  Not that their systems didn’t throw exceptions–they did–but not near the number of exceptions we deal with on a daily basis today. Today’s software seems to both benefit and suffer from innovation. No matter how many unit tests are run or how well software is architected, something still goes wrong. Often that something is even out of our direct control–some library that’s been referenced by our code, a library for which we do not have the ability (no source), time, nor inclination to debug. Maybe that’s the difference: when Luminary threw an exception, they could actually talk to/yell at the guy who wrote the offending line of code.

The tools are frustrating because they are trying to manage the complexities of the underlying frameworks which are constantly changing and evolving. Visual Studio is one of the most complex and useful development environments available today. But it seems to be spread pretty thin while it attempts to cover every latest innovation and framework coming out of Microsoft.

Innovation and evolution are generally considered good things, but they undeniably contribute to the unreliability of today’s software. And yes, we can do some amazing things nowadays with amazing UIs, web deployments, cloud computing, etc. But what about reliable data processing? There’s a reason COBOL is still running in so many bank mainframes.

So how do I get less angry?

  1. Unit Testing
    Definitely a worthy practice even when there’s only one developer involved
  2. Keep the toolset small
    Learn your tools and know their capabilities.
  3. Resist the urge to utilise every new technology that’s released
    Try to find what works, and stick with it. Go with industry standards.
  4. Dream
    Of the days when we only had to worry about 25 lines by 80 characters hahaha! Not really, but few people appreciate what can be accomplished in a mere 25 lines.
  5. Learn why COBOL programmers are still in demand today.

What makes you angry?

TK <peck> <peck>

 

VDSL: Upstream Joy

TK here, reporting on our internal infrastructure changes. This week it’s changes to our ADSL service. We had been using Telecom New Zealand’s ADSL service, which was a decent enough service, but we have decided to try their VDSL offering. Our ADSL speeds just before the upgrade were as follows 0.86 Mbps Upstream; 10.61Mbps Downstream: 2014-07-21_Telecom_Speed_Test   According to Telecom NZ, “Ultra VDSL™ is a new type of technology that uses the same copper phone line as ADSL broadband, but can provide a faster connection speed and greater capacity, so more people can get online at the same time using the same connection. And it’s now available on 60% of New Zealand’s broadband capable lines.

Our initial impression is very good. The line speed is significantly faster, and the price is only $10 more than our previous plan with a similar data cap. The upgrade comes with a new Huawei HG630b Gateway and several 1m cables:

Huawei HG630b Gateway
Huawei HG630b Gateway

The gateway arrived soon after the call to Telecom; the technician to install it arrived about two weeks later. After 30 minutes or so of examining every phone/Ethernet jack in the office, a visit to the phone box at the top of the street to “change ports”, and 30 minutes of downtime, we were online with VDSL. All-in-all a painless experience despite having the technician turn up several hours late and stay through dinner time.

The result: a very nice increase in speed, most notably in upstream speed: 8.38Mbps Upstream; 26.41Mbps Downstream. Finally decent upstream speed! No more sub-Mbps upstream for this IT Bird:Test_your_speed_-_My_Internet_-_MyTelecom_-_Personal_-_Telecom_New_Zealand_ Thus far VDSL is recommended. Our impression is shared by TrueNet as well. They conclude that, “VDSL is shown to be very much better than ADSL for both Upload and Download speeds for the same locations“. See their post, “Speed Comparison: VDSL vs ADSL.

Granted it doesn’t do anything for traffic originating from or destined for overseas hosts, but it sure does improve access to local NZ hosts. And the price is right! Good job Telecom NZ—

Azure Custom Domains and (free!) SSL Certs

As part of our consolidation of hosted services onto Azure, we needed to enable SSL on our websites. Knowing the general procedure, we thought, “How hard can it be?” Well it turns out the hardest part is actually deciding on where to get the cert given the dizzying array of places selling them.

Selecting a Cert at the Right Price

A quick web search for “SSL Certs New Zealand” returns the following possibilities: GeoTrust, VeriSign, Symantec, RapidSSL, Trustico, Thawte, FreeParking, Digiweb, GoDaddy, WebDrive, and WebFarm. And that’s just on page 1 of the search results. The prices for a basic, no-frills certificate range from (yearly rates) $8.99 to $9.99 to $79.00 to $ 99.00 to $149 to $189 to $740! There is one CA which is not listed on page 1 of the search results, but should be. They offer a basic cert for $0.00 – Yes, believe it or not, free certificates are available! And they work! The company is StartSSL, and their certs work just as advertised. I know what you’re thinking, “what’s the catch?” That was my first thought as well, but as far as I can tell, there is none. You get a fully functional certificate that works in all modern browsers.

Start SSL Web Page

The CA’s Dirty Little Secret

In my opinion, the secret is that these CA’s are printing money! Well it’s not quite that simple, but hey, what does it really cost to create a cert? I guess you pay for a degree of trust, customer service, etc. This post, Difference between Certificate Authorities, is helpful in understanding the differences in price (thanks to Troy Hunt for tuning us on to that post). As a developer, I’m (initially anyway) most concerned with providing an encrypted channel to my site and getting the little “lock” symbol in the browser. And the StartSSL cert does that. So we’re going with the free option until we find a compelling reason to spend more.

How It’s Done

Troy Hunt has a fantastic post on creating free certificates and uploading them to Azure: “The complete guide to loading a free SSL certificate into an Azure website.” We highly recommend it. We’ve added multiple StartSSL certs to one of our sites, and they work like a charm. Troy’s step-by-step post makes a somewhat complex process easy to follow. Actually once done, it’s not that complex so give it a try. We noticed only two differences when going through Troy’s steps this week:

  1. Certificates are available instantly Troy’s post describes waiting for an email from StartSSL and then retrieving the certificate from their website. I guess they’ve optimised the process and can do it in a matter of seconds now.
  2. Azure Mode can be Basic Troy’s screenshots of Azure are a bit dated in the sense that they don’t show the latest “Web Site Mode” options. There is a new Basic mode and pricing tier which is cheaper than the Standard Mode referenced by Troy (at the time of writing his post, Standard was the only option that supported SSL; now both Basic and Standard will work).

Go get secure! <peck> <peck>

Azure and Custom Domains

Today we’ll continue our previous post about setting up WordPress on Microsoft Azure. Provisioning a new website was a breeze, but we ended up with a “.azurewebsites.net” address for the site. Not so bad, but we want to personalise it with our own domain name, “www.edmondson.kiwi” in this case.

Microsoft has a helpful page entitled, Configuring a custom domain name for an Azure Web Site. Basically we need to modify our domain’s DNS records to point to the newly created website.  Specifically, we need to create the following records:

  • A Record
    Points to the IP address given to use by Microsoft Azure
  • CNAME Record
    Adds the “www” subdomain to our root domain and points to the canonical name, .azurewebsites.net, given to use by Azure.

Azure Website Mode

In order to associate a custom domain with the Azure website, we first need to change its Scale Mode attribute to one of the non-free modes including Shared, Basic, or Standard.

Note: be aware that this changes the website from its initial “free” status to one that incurs charges. See the Azure Pricing details for more info.

Start at the Azure Management Portal, click on the “WEB SITES” icon on the left menu, and then click on your website. Once your website is selected, click on the “SCALE” tab at the top.

4-AzureScale

Select “Shared” or one of the other, non-free, modes.

While you’re on the Azure Management Portal page, record the following two pieces of information about your website. Both items are available from the Dashboard page of the Management Portal:

  1. Site URL
    “edmondsonblog.azurewebsites.net” in our case. This is located under the “quick glance” section of the Dashboard page.
  2. IP Address
    To find this, click on the “MANAGE DOMAINS” button at the bottom of the Dashboard page. Then scroll all the way to the bottom of the resulting, “Manage custom domains” dialog:
    5-IPAddress
    It’s not easy to find, but obvious once you find it.

These two items will be used later in the DNS Record configuration.

Domain Registrar DNS Records

The next step involves your domain DNS records and is performed through your domain registrar. Since we are in New Zealand, we use FreeParking.co.nz as our domain registrar. It turns out there are heaps of authorised registrars, but this IT Bird (and his dad) find Free Parking easy to use and relatively low cost. If you already have a domain name or you want to register a new one, you need to go to your registrar. If your domain name is already “hosted,” the registrar may or may not be the same as your hosting company. In our case, FreeParking is the registrar but not the host; Microsoft (Azure) will be the hosting company. Whatever your registrar, you need to do the following:

  1. Login to your account
  2. Find the DNS Settings page
  3. Add or modify the DNS records for your domain

The following examples will be from FreeParking.co.nz.

First we login and click on the “Services” tab. The we click on “MY DOMAINS”. Find the appropriate domain name, and then click on the “Manage” button beside it:

1-MyDomains

Next scroll down to the “Name Server Records” section, and click “Modify“:

2-NameServerRecords

In the “Edit Domain Name Server (DNS) Records” screen, add the following records:

3-DNSRecs

  1. A Record
    Add a record for your “root” domain name (not including the “www.” prefix; “edmondson.kiwi” in our case. The A Record must resolve to the IP address listed on your website’s Azure Dashboard, “Manage Custom Domains” dialog (recorded above).
  2. CNAME Records
    Add two CNAME records, one for the “www.” subdomain/prefix and one for “awverify” subdomain. Each of these must resolve to a similar subdomain on the “.azurewebsites.net” domain. When creating your Azure website, you gave it a site name (“edmondsonblog” in our case); For this example, the full Azure website URL of our site is edmondsonblog.azurewebsites.net. You will need to reference this URL below as follows:

    1. Add an “awverify” record:
      awverify.edmondson.kiwi resolves to “awverify. edmondsonblog.azurewebsites.net”
    2. Add a “www” record:
      www.edmondson.kiwi resolves to “edmondsonblog. azurewebsites.net”.

The “awverify” record is something special for Azure to verify that you own the domain name. From the Azure docs, it seems that awverify may not be necessary if the A Record is properly defined; however we used both and it works so this IT bird is not going to mess with it further.

It takes some time for the DNS record changes to propagate throughout the Internet. It can be a matter of minutes or hours. In our case, it was a matter of five minutes or so. To verify when the DNS records have propagated, you can ping your www.<yourdomain> subdomain. When ping returns the IP Address recorded above on the Azure “Manage Custom Domains” dialog (or more accurately, the address you entered for the A Record), you’re ready for the next and final step.

Final Step: Azure Manage Domains

Once your DNS records have propagated, return to the Azure Management Portal, Dashboard tab, and click “MANAGE DOMAINS” at the bottom. On the resulting “Manage Custom Domains” dialog, enter your custom root domain and www. subdomain as shown:

6-ManageDomains

The “azurewebsites.net” entry (“edmondsonblog.azurewebsites.net” in our case) remains as well. You may register and configure additional domains for the same site if you wish. Click on the check/tick mark to save.

Congratulations! Your custom domain should now be hooked-up and ready to go.

WordPress Settings

One final bit of configuration should be done in WordPress. Go to your WordPress control panel (append “/wp-admin” to your URL; www.edmondson.kiwi/wp-admin” in our case) and select the “Settings” page. From there, change the following settings to match your custom domain name:

7-WPSettingsAddress

  1. WordPress Address (URL)
  2. Site Address (URL)

This ensures that WordPress uses your custom domain name when it references pages throughout the blog.

Enjoy your Microsoft Azure hosted custom domain! <peck> <peck>

 

Deploying WordPress on Microsoft Azure

In today’s entry, I’ll attempt to document the creation of this blog. In general, it was a breeze, and far easier than I would have guessed. The general tasks are:

  1. Create an Azure Website with the WordPress template
  2. Configure WordPress
  3. Configure DNS entries

A bit more detail follows.

Creating an Azure Website with the WordPress Template

Start by going to the Windows Azure Management Portal at https://manage.windowsazure.com

Click “+ New” from the lower, left toolbar:

New Task Button

Then select “Compute -> Website -> “From Gallery”:

AzureGallery

From the list of available application templates, scroll down and select “WordPress”:

AzureApps

 

Next you will need to fill-in a few Site Settings: (don’t you love the word, nonce?)

SiteSettings

Don’t forget to scroll down and continue the Deployment Settings section:

DeploymentSettings

Next, you will need to reference a MySQL Database, either create a new instance or use an existing one:

MySQLDB

Click the check/tick mark to continue, and that’s it! If all goes well, the site will be provisioned within a couple of minutes.

Configuring WordPress

When the site is available, go to the Dashboard page and click on the link listed under “SITE URL”. The site URL will be <yourSiteName>.azurewebsites.net.  WordPress will prompt you for an initial user name and password, and that’s it! You’re done with the Website and WordPress bit.

Configuring Custom Domains

In our next post, we’ll document the really fun bit: hooking up your own domain name such as tk-the-awesome-it-bird.com (ooh I think it’s available; must talk to dad) to the blog. In our case it was the somewhat more modest but still cool “www.edmondson.kiwi.”

 

The Early Bird

Kia Ora and Welcome to the Angry Kiwi Blog!

My name is TK (Te Kohe – the Tidy Kiwi), and this is my very first blog entry. This blog is dedicated to all things IT, but with a definite cloud affinity. I’m just learning this blogging stuff, but I will attempt to document at least a few valuable experiences in the days ahead.  Dad and I are endeavouring to move all of our hosted services to Windows Azure, and we will document our experiences here for others to learn from and/or laugh at.

My first task is helping my dad setup WordPress (this blog) on Microsoft Azure. Overall it’s gone very smoothly. We had only one error during creation of the MySQL database that gets created whilst creating the Azure Website, likely because we neglected to fill-in all the Deployment Settings fields.  Surprisingly, leaving many of the fields blank doesn’t work. Dropping the website and creating a second time (with complete Deployment Settings) did the trick. As you can see, it worked out well.

Azure is very exciting thus far. More soon… <peck> <peck>