Chocolatey Presentation with the Puppets
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
demo
presentation
.gitignore
ReadMe.md

ReadMe.md

Puppet On Windows

Prerequisites

  • Vagrant 1.5.4 or greater. 1.8.x has linked clones so it is highly recommended.
  • VirtualBox 4.2.16 or VMWare Fusion 5
    • If you want to use VMWare Fusion you will also need the vagrant-vmware-fusion plugin for vagrant (which is not free). You also want the latest version (at least 0.8.5).
  • Vagrant-Windows
  • At least 20GB free on the host box.
  • Vagrant Sahara plugin for sandboxing.

Setup

  1. Install/upgrade Vagrant to 1.5.4+.
  2. Install/upgrade VirtualBox/VMWare to versions listed above.
  3. Install/upgrade required plugins for vagrant (if using VMWare you will need the non-free vagrant-vmware-fusion or equivalent).
  4. Vagrant 1.5.4 (and below) - Install/upgrade vagrant-windows vagrant plugin. Open terminal/command line and type vagrant plugin install vagrant-windows
  5. Install/upgrade sahara vagrant plugin - vagrant plugin install sahara.

Presentation

The presentation is in keynote but there are other formats in the Presentation directory.

Demo

Exercise 0 - Vagrant Box Prep

  1. Obtain a 2012 Windows vagrant box.
  2. You may need to update the box name to something from vagrantcloud/opentable.
  3. Now install the required modules (demo/puppet/modules/readme.md)
  4. Call vagrant up and wait for it to run the shell provisioner.
  5. Now we are ready to grab a snapshot for the demo. Call vagrant sandbox on
  6. In demo/Vagrantfile please comment out the shell provisioner and change the puppet provisioner to provision.pp that is currently set to puppet.manifest_file = "empty.pp".
  7. This concludes exercise 0.

Exercise 1 - Create a package

  1. From the Windows box, navigate to c:\vagrant\packages on the command line or powershell.
  2. Run choco new mypackage.
  3. Inspect the contents of the mypackage and mypackage\tools folder. Note a readme file that provides resources for creating packages.
  4. Edit mypackage\mypackage.nuspec to remove items that end in url.
  5. Change the version to 0.1.0.
  6. Save and close the nuspec.
  7. Edit mypackage\tools\chocolateyInstall.ps1. Make it look like: $packageName = 'mypackage' Write-Host "$packageName has been installed."
  8. Save and close the file.
  9. Delete mypackage\tools\chocolateyInstall.ps1
  10. Run choco pack.
  11. Note that there is now a .nupkg file in the directory.
  12. Optionally open it with NuGet Package Explorer if you have that installed and inspect how everything is laid out. NOTE: Certain newer items in the nuspec may cause this step not to work. You can alternative copy the nupkg over to a .zip file and unpack it normally and inspect the contents.
  13. This concludes exercise 1.

Exercise 2 - Create a package server.

  1. From the host, access http://localhost:8090 (unless it conflicted, adjust as vagrant tells you the port is forwarded to). It should show nothing.
  2. In demo/puppet/manifests/provision.pp, uncomment include chocolateyserver
  3. Run vagrant provision and wait for it to finish.
  4. Now access http://localhost:8090 again. Note the information displayed.
  5. On the box itself, access http://localhost. Note the additional information displayed when you are local.
  6. This concludes exercise 2.

Exercise 3 - Put a created package on the custom package server

Now that we've created a custom package and we've created a custom package server, it only makes sense that we want to get our package up on that server.

  1. Access http://localhost. Click on the link for packages. Show how their are none there.
  2. Navigate to the directory where you created the nupkg file from prior exercises.
  3. Run choco push pkgname.nupkg -s http://localhost. You should receive some errors.
  4. If you are on new choco, just add in the apikey to the push command -k chocolateyrocks. If you are on old choco:
  5. choco install nuget.commandline
  6. nuget setapikey chocolateyrocks -source http://localhost/chocolatey
  7. Run choco push pkgname.nupkg -s http://localhost -k chocolateyrocks. You will probably get an error here. Point out this is the most common mistake folks make. The location you query and the location you push to are always slightly different.
  8. Run choco push pkgname.nupkg -s http://localhost/chocolatey -k chocolateyrocks.
  9. Note how the command succeeds.
  10. Access http://localhost. Click on the link for packages. Note how there is package metadata now.
  11. Show the package in the folder at c:\tools\chocolatey.server\AppData\packages.
  12. This concludes exercise 3.

Exercise 4 - Install custom package

  1. Run choco install mypackage -s http://localhost.
  2. Note what happens.
  3. This concludes exercise 4.