Tag: HOMESTEAD

Using the Laravel Homestead "serve" command with Oh-My-Zsh

So I run an  "extras" script  after installing Laravel's Homestead that installs LDAP, Oracle Drivers, and Oh-My-Zsh among other things. But afterwards, I cannot run the "serve" command in the homestead VM to add new Nginx sites. I've finally figured out that the serve command is actually a bash shell alias function thingy inside .bash_aliases, so it's being ignored once I switch to Oh-My-Zsh.

Simply copying the serve function to .zshrc doesn't work due to some apparent syntax differences with bash and zsh. After digging around a bit, I've slightly modified the function to work now with zsh inside .zshrc:

Hopefully this helps someone else, or maybe someone has a better solution altogether.

Controlling Laravel Homestead VM From Any Folder in Terminal

Having a single Vagrant VM for all of my projects is nice, but I was used to controlling Vagrant from within a project's folder in Terminal and not having to go back to the central Homestead folder to run things like vagrant up or vagrant reload.

Adding these to my Oh-My-Zsh config (.zshrc) seems to do the trick:

alias devup="cd '/Users/gtaylor/Sites/Work/Homestead' && vagrant up && cd - 1> /dev/null"
alias devreload="cd '/Users/gtaylor/Sites/Work/Homestead' && vagrant reload && cd - 1> /dev/null"
alias devdown="cd '/Users/gtaylor/Sites/Work/Homestead' && vagrant halt && cd - 1> /dev/null"

I'm using these in conjunction with `alias dev='ssh [email protected] -p 2222'` from the Homestead documentation.

"Extending" Laravel's Homestead

I put off moving my existing vagrant dev VMs over to [Laravel's Homestead](http://laravel.com/docs/homestead) for a couple of reasons:

  1. It doesn't completely match my production environments (Ubuntu 14.04 instead 12.04, PHP 5.5 instead of 5.4, Nginx instead of Apache).
  2. I knew I'd need to customize the VM anyway and I already had that worked out with my existing VMs (note the plural).