These days Chocolatey is pretty much the first thing I install when working on a new PC. The utility of having that tool you need just a few keystrokes away is something we've been missing on Windows for years.
It's getting to the point where if a package isn't on Chocolatey then it's dead to me.
That said with the package list hovering around the 1,200 mark there are gaps that you're going to run into sooner or later. It's up to the community to fill these gaps.
Today I'm planning on testing some VM configurations on Azure with a view to optimizing IO performance. I'm a big RavenDb fan but running it on an Azure VM is problematic due to IO issues. Both the main Raven hosted solution providers (CloudBird & RavenHQ) run on AWS so I thought I'd test the IO performance of some comparable VM instances on Azure & AWS.
In order to benchmark IO I'm using SQLIO but as it's not on the Chocolatey package gallery I thought I'd take 5 minutes out of my day to add it.
The Chocolatey package really just consists of some meta data in a nuspec file, an image to display on the gallery and 2 powershell scripts to silently install/uninstall the SQLIO MSI.
The first thing we need to do is setup a GitHub repository to host my Chocolatey packages. Then we create a directory to hold the sqlio package with the following 4 files.
1 2 3 4
The meta data in the nuspec file is all fairly self-explanatory, note that the iconUrl setting is the image that will be shown within the Chocolatey package gallery. This should be a png with a minimum size of 128x128.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
The PowerShell files are just small wrappers around the MSIs own install/uninstall functionality. On both install/uninstall we need to check the install state in the registry and in order to do this we need to know the GUID assigned to the MSI.
A quick way to get the GUID is to run the following PowerShell command after you've installed the MSI.
The install script just checks the install state in the registry and then calls the Chocolatey helper function
Install-ChocolateyPackage which will download and install the MSI.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
And then we handle the uninstall. Again we just check the install state using the same GUID as before and hand over to the appropriate Chocolatey helper function to uninstall the MSI. Chocolatey in turn will elevate admin access and use msiexec to perform the uninstall.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
With that we just need to create & test the package itself. To create the package we just run
cpack .\sqlio.nuspec in package directory, this will bundle our nuspec and PowerShell files into a package called
sqlio.1.0.nupkg. To test the package we can use
cinst sqlio -source %cd% which will tell Chocolatey to install the package using the current directory.
The final step is to push the package to the Chocolatey gallery. To do this we need to setup an account on http://chocolatey.org to obtain an api key. We then need to store the apikey for chocolatey.org and then push the package to the gallery.
With that we're done, now back to Azure & RavenDb...