Bedrock Vagrant/Ansible released

Yeah, in that case, it makes sense to keep them on separate VMs since you archive them/finish work. What I said was mostly going on what others had wanted. Starting new VMs all the time takes longer and also takes up a lot more space. But really, once you’ve created them vagrant up is fast and ~700MB per site extra isn’t really that much in 2014.

@swalkinshaw – would you mind telling me what version of Vagrant, VirtualBox you’re using and if you’re using the vbguest vagrant plugin? I’m not able to get mine working and I’m using:
Vagrant 1.5.4
VirtualBox 4.3.10 r93012
I have the following vagrant plugins installed
vagrant-login (1.0.1, system)
vagrant-share (1.0.1, system)
vagrant-vbguest (0.10.0)

I keep getting weird errors:

Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:

mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` /vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` /vagrant /vagrant

I already looked up the fixes online but none are working for me, so I’m curious as to how you’re setup is and what versions you’re using. Thanks!

VirtualBox 4.3.2 r90405
Vagrant 1.5.1
vagrant-aws (0.4.1)
vagrant-cachier (0.7.0)
vagrant-login (1.0.1, system)
vagrant-omnibus (1.3.1)
vagrant-share (1.0.1, system)
vagrant-vbguest (0.10.0)

You can disregard aws, cachier, and omnibus though. I’ve gotten that error before but used vbguest to fix it.

Hello, I have hit the same issue. “502 bad gateway” after a vagrant halt and vagrant up. Have also tried restarting both php5-fpm and nginx but no luck. Did you find a solution?

@callerc1

Nope - I actually stopped working on getting this specific framework up and running, will be continuing on it today.

In the process of trying to figure out what was wrong, I downgraded Vagrant, Virtual Box and messed with the vb-guest plugin and just Guest Additions downloaded from the VirtualBox site. I ended up totally breaking my environment for my current workflow using puPHPet. As of last night, I think I’ve fixed it. Doing a few more tests and then back to Bedrock/Ansible.

I don’t know why it goes 502 bad gateway on a reload (halt and up) and also has a bunch of WordPress errors when you go to the Dashboard. I’ll let you know if I figure something out.

Since I’m using this alongside my working puPHPet setup, I’ll need to stick with these versions of everything, here’s what I’m using:

  • VirtualBox 4.3.10 r93012
  • Vagrant 1.5.4
  • vagrant-login (1.0.1, system)
  • vagrant-share (1.0.1, system)
    I might install vagrant-vbguest but this was a suspect in messing up my other setup, need to investigate
  • ansible 1.5.5
  • Guest Additions downloaded from
    http://download.virtualbox.org/virtualbox/4.3.10/VBoxGuestAdditions_4.3.10.iso
    and then copied to replace the Guest Additions in the VirtualBox
    applications folder.

sudo cp ~/Downloads/VBoxGuestAdditions_4.3.10.iso /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso

After looking into this further, I’m noticing some weird stuff happening with php5-fpm. The site is working upon the initial vagrant up but upon halting and bringing it back up a few things are happening that I am still trying to sort out:

  1. vagrant@bedrockhub:~$ sudo service php5-fpm restart stop: Unknown instance: php5-fpm start/running, process 2852

  2. sudo service php5-fpm start php5-fpm start/running, process 3015

  3. I check the processes with ps -ef and I do not see php5-fpm running anywhere and certainly not as pid 3015 (or whatever ID it happens to have at that moment).

  4. vagrant@bedrockhub:~$ sudo service php5-fpm stop stop: Unknown instance:

@Jaace I can confirm I am running the same versions of VB, Vagrant and Ansible as yourself. For now i have just opted not to run vagrant halt whilst i continue with my project and revisit this issue later. So essentially i just ended up running vagrant destroy and vagrant up to get my VM back. vagrant provision seems to work well and i haven’t had any issues with this.

Thanks for the debugging guys. I’ll do some testing with halt and try to find out what’s going on.

I’ve fixed the problem. There were a few issues but the main one was that PHP-FPM sockets were set to live in /var/run/php5-fpm/ which was created through Ansible on provision.

Problem is /var/run is reset on boot and PHP-FPM doesn’t handle creating the needed directory. Easiest fix was just to put sockets in the top level /var/run (example: /var/run/php5-fpm-example.dev.sock.

So the service failed to start since that dir didn’t exist. It all works now and I’ve tested it from scratch and halt then up.

Commit: https://github.com/roots/bedrock-ansible/commit/96ee139578eab8019352fb417f0ffc7c5ecd76ab

That seems to have done the trick for me! Thanks

Just an update:

I’ve made a new base Vagrant box with it already provisioned. Details here: https://github.com/roots/bedrock-ansible#vagrant-box

Thanks and double thanks for the box :smile:

@swalkinshaw I’m a bit confused. How is this suppose to work exactly? Does cloning the bedrock/ansible and running vagrant up give me a devbox with wordpress and everything needed. Instead wordpress should already be downloaded somewhere before? as here https://github.com/roots/bedrock-ansible/issues/1 ?
Thanks!

You need to download/clone Bedrock first and make sure the paths in the example Vagrantfile are correct relative to all your folders.

@swalkinshaw Did you get a chance to create an example Vagrantfile showing how to provision to DO? Im about to take the plunge myself so any help would be very much appreciated.

Trying to get this to work with the new box… for some reason I’m getting the error when I’m running the ansible provisioner. I recently upgraded to Mavericks but I cannot find anything about needing to change anything with ansible or how to fix this error… any ideas? I’ve been googling this error and coming up with nothing about how to change the path for ansible. I’ve verified it’s installed with homebrew and up-to-date.

==> default: Running provisioner: ansible...
The executable 'ansible-playbook' Vagrant is trying to run was not
found in the PATH variable. This is an error. Please verify
this software is installed and on the path.

UPDATE: I needed to do a brew uninstall ansible and then re-install it. For some reason brew update was not upgrading ansible to it’s latest version. After re-installing I was able to access it via the command line also with ansible --version(1.6.1) so I know it’s working now.

Performing a vagrant up now runs through the process fine.

I’ve done it with this Vagrantfile: https://gist.github.com/swalkinshaw/fcb08adfaf86a4be0806

You need this plugin installed: https://github.com/smdahlen/vagrant-digitalocean and the proper DO env vars set up as seen in the Vagrantfile for api keys etc.

But it requires more configuration that I don’t have right now. The prod box references a new prod.yml playbook instead of the normal site.yml. It’s basically the same but doesn’t run the wordpress-sites role.

So the steps would be something like this:

  1. Run vagrant prod up --no-provision
  2. Create a prod specific prod.yml playbook with the roles you want
  3. Create a new hosts file with a [wordpress-server-prod] group and the DO ip/host
  4. You could move the group_vars/all to be env specific at group_vars/wordpress-server-prod and group_vars/wordpress-server if you only want those vars to apply to each server
  5. Run vagrant prod provision
  6. Update Capistrano configs with the correct prod ip/host
  7. Run cap production deploy

The steps are something like that…

Honestly I don’t think production servers should be managed with Vagrant. Maybe if you want a remote dev server. I’d probably just set up the servers manually (if you only have 1 per site or 1 total) and then run ansible-playbook -i prod.yml hosts manually.

Thanks for that Scott. That makes sense will give it a go for a remote staging/dev server. For production are you saying essentially set up the server manually but provision it with ansible?

Correct. Then you can look into just doing everything with Ansible. It has a built-in Digital Ocean module to manage servers.

If I wanted to have more than one site on the Box, how would I change the hosts file on bedrock-ansible, /etc/hosts and the group_vars/all file? I tried adding a new IP address for each in the hosts file and the /etc/hosts file but I’m not sure if that’s the correct way… do you have an example of this?