Do you want to build a homestead?

Posted by Darwin Biler on July 4, 2014

What is "homestead" in the first place. Well, its the official vagrant box of Laravel, it can be found in the official Laravel documentation

Homestead allows you create a development environment with a single "vagrant up" command. This basically downloads the "base box" from the https://vagrantcloud.com/laravel/homestead and run the configuration files in the Vagrantfile and other sort of scripts.

The secret recipe for all the sort of the functionality of homestead lies on how the base box itself was built. By surprise, the script that build this is not a secret! it's called Settler in the official Laravel github account.

All the sorts of installation procedures can be found in the provision.sh
https://github.com/laravel/settler/blob/master/scripts/provision.sh

Which installs all the necessary software like PHP, Nginx, Redis, MySQL etc. The advantage of this is, since its just a plain shell script, unlike others that use Puppet or Chef (which is itself has a learning curve), you only need to know basic shell scripting in able to customize the box.

If you are thinking ahead, you can easily conclude that, in able to customize my homestead box one could just easily fork this project, add your own commands in the provision.sh and that's it, you have your own homestead version!

But how do I make the box available in vagrant command?
There are two ways to do that, you can add the vagrant box locally

$ vagrant box add my-box /path/to/the/new.box

or publish it to https://vagrantcloud.com
If you do the latter, your box can be accessed by just

vagrant box add USER/BOX

since by default, vagrant will look for vagrantcloud.com for available boxes with that name (kinda some sort of packagist.com eh)

Don't forget to study the guidelines on creating a basebox in here
http://docs.vagrantup.com/v2/boxes/base.html

It's also recommended that you read this article for a complete workflow on building the box down to packing it to base box format that vagrant can read.


Did you find this useful?

I'm always happy to help! You can show your support and appreciation by Buying me a coffee (I love coffee!).