Vagrant and VirtualBox
The project in this course (and some other work) can be deployed on virtual machines (most easily provided by VirtualBox) that are provisioned (by Vagrant) and configured (by Chef or similar) automatically.
Getting Set Up: your computer
You should be able to use any OS on your computer to set up the VMs: both of the tools we need are supported on Linux, OSX, and Windows.
Your computer needs to be powerful enough to do whatever you are using it for (web browser, IDE, etc.), plus provide resources to a small virtual machine: maybe one core and 1 GB of memory. If that doesn't describe your computer, then see the CSIL instructions below.
- Install VirtualBox. You can do this in Windows, OSX, or Linux. In Ubuntu, this can by done by installing the package
virtualbox-qtif you want the GUI tools too).
- Install Vagrant. You can also do this in Windows, OSX, or Linux. In Ubuntu, install the
- Get the code for the project. This will likely be from GitLab and should include a file named
Vagrantfilein the project root. See ProjectRepo for details on getting your repository set up.
- That means you'll need Git installed: use the command line tools for Linux or OSX. Git for Windows comes with the Git BASH shell, which is nice to work with and can do everything you need.
If you try to start a virtual machine and it seems to hang, you can try starting a VM from the VirtualBox GUI: you can see error messages there. The most likely cause is not having processor virtualization extensions, either because they're off in your BIOS, or because you're trying to run a VM inside another VM.
If you are having problems getting any VM to start, you have have your processor's virtualization extensions turned off in the BIOS. (This seems to be common in laptops, by default.) It should be easy enough to enable the extension.
Getting Set Up: CSIL Linux
Everything you need should be available on the Linux side of any of the CSIL workstations. You can use the
vagrant command as expected.
You may have to comment-in these lines near the end of the
chef.channel = "stable" chef.version = "12.10.24"
Getting Set Up: CSIL Linux Remotely
As above, the tools you need should be available on CSIL Linux machines. That includes
csil-cpu4.csil.sfu.ca, which you can connect to remotely with this command (or your SSH client's adaptation of it):
ssh -p24 -L 8080:localhost:8080 csil-cpu4.csil.sfu.ca
This will forward port 8080 from there to your localhost: adapt as necessary to get the port you're using for your HTTP server.
Working with VMs
vagrant command is used to work with your virtual machine(s).
- Start a VM, using configuration from the
Vagrantfilein the current directory. The first time you start a particular VM, this might take a while: it will download the box image and provision the VM.
- Re-run the provisioner (Chef, Puppet, etc) on the VM. This will need to be done if you (or your group members) update the recipes.
- SSH in to the VM so you get a command line there.
- Shut down the VM
- Destroy the VM image. You can (should be able to?) recreate it by doing a
vagrant upand letting it provision itself.