We’ve had the free module series, the thirty bees (compatibility) partner series and here’s a new one: the “Upgrade your workflow” series. During the development of thirty bees we have come across many ways to speed up our development. We had to, since we are still a relatively small team, compared to what has to be produced. That made us very creative and also made us spend quite a lot of time on automation and workflow improvement. With these blog posts we want to share the valuable information we have found… with you! These posts can get pretty technical and are meant for developers and/or system administrators.
In the first post of the “Upgrade your workflow” series we are going to focus on Vagrant. It is a script that we have recently added to the thirty bees GitHub repository and is also available as a separate repository.
What is Vagrant?
Vagrant is a quick way to launch a local development environment that comes close to a production environment. Over the past couple of weeks we have seen a few developers having trouble with a local XAMPP installation on Windows due to faulty configurations and/or things being configured differently for Windows. That is when we have decided to build a Vagrantfile which allows you to quickly build a virtual machine with Vagrant. This virtual machine will then serve your local files and a database, so you can start testing on thirty bees right away, without all the configuration hassle!
How do I use it?
There are two ways to use Vagrant. You can start from the main thirty bees GitHub repository or you can clone the special vagrant repository. The main one will serve the files you already have on your hard disk right away and the version in the vagrant repository will download the latest thirty bees files first via git and install it.
Installation
First of all, make sure you have both Vagrant and VirtualBox (the virtual machines) installed. Optionally install git if you want to start from the vagrant repository.
Vagrant can be downloaded from this page: https://www.vagrantup.com/
VirtualBox is available on this website: https://www.virtualbox.org/
git can be found here: https://git-scm.com/
If you are on linux, you can install these tools directly via your package manager as well. The commands are:
Ubuntu/Debian:
$ sudo apt-get install vagrant virtualbox git
CentOS/RHEL:
$ sudo yum install vagrant virtualbox git
Main repository
When you are using the files from the main repository, make sure you have either cloned it from the master branch or version 1.0.2 (didn’t exist at the time of writing) or newer. Then chdir to the main directory. From here issue the command vagrant up and Vagrant will start building the virtual machine for you. The login credentials and IP address you can optionally add to your hosts file can be found in the README of the vagrant repository: https://github.com/thirtybees/vagrant#login
Vagrant repository
If you prefer the vagrant repository, issue the command vagrant up
and wait for it to launch the virtual machine, download thirty bees and install it. When it is done you will see that the thirty bees files have been downloaded into the thirtybees
folder. The changes you make in this folder are immediately visible. For more information, check the README of the repository.
Further tricks
You can suspend a Vagrant box just like any other virtual machine, but make sure you let Vagrant handle it. To do this, issue the command vagrant suspend
. You can then later resume this box via vagrant up
.
The Vagrantfile uses a provisioner called Ansible. For more information check out their website: https://www.ansible.com/. The ansible playbooks can be found in the playbooks
folder. These are essentially YAML configuration files that can be easily adapted to your needs. It is definitely worth checking out!
If you need more info or help with Vagrant be sure to visit our forum. We would love to help you develop faster!
I can’t wait to try this out. I tried MAMP (for the mac) and had several issues.
Does this work on the Mac?
Thanks for the great job with thirty bees!
https://www.alwayspaws.com/
Yes, this works on OS X as well.