Skip to content

webastien/dev-vm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Development virtual machine

This is my implementation of the nice couple Vagrant / Ansible to build a virtual machine for my developments (mainly using PHP with Drupal).

About

The generated server is not supposed to be used in production, it's not the perfect one ; It probably has security holes, lack of important packages, ... It's only fit my actual needs and will probably be improved in the future.

I didn't test it on other environment than mine, so if you try it, you could encounter errors (for example, synchronised folders could not properly), but... don't worry, it will not break your system, that's the power of Virtual machines.

My environment

MacBook pro / iMac with last MacOS version installed. I use iTerm2 for terminal, with default Mac Bash, and the less as possible dev tools installed on my Macs (no mysql for example). I prefer deferred them into the VM.

Requirements

Actualy, 2 Vagrant plugins are also required:

The first time you play the Vagrantfile, they will be automaticaly installed.

Note: Each time you up / down the VM, Vagrant Host Manager will ask your password to update the /etc/hosts file. If you don't want to type it again and again, follow this procedure. I recommand because with it, this lovely plugin becomes transparent.

Suggested vagrant plugins:

You vill be prompted to install it, you can accept (y) refuse once (n) or type "never".

Note: Choosing "never" add the plugin in configuration/yours/vagrant-plugins-ignored.yml. It's a simple YAML file you can edit or remove. All required plugins will not be affected by this one, only suggested. So, if you had choose "never" and change your mind, you just have to suppress the plugin name from this file. The next time you up / provision, it will be suggested again.

What's in the box?

  • Debian 8 (Jessie) with VB guest additions (*), Dotdeb and non-free packages repositories are activated
  • Mysql configured to use utf8
  • PHP-FPM (php7) as fastcgi
  • Apache2
  • Composer
  • Drush
  • Drupal console
  • Adminer
  • Easy install of Drupal 7/8 sites (D8 trusted hosts auto configured), adminer, phpinfo
  • Easy install of sites which have a git repository
  • You can add / modify sites "starters" (kind of templates)
  • My own config for my favorite editor: VIm

* : I had problems with sync folder when using boxes without those guest additions, so I choose garbetjie/debian8 from the public Vagrant box catalog. No time to test for now, but the Vagrant plugin vagrant-vbguest could solve the problem.

But keep in mind the playbook is configurable, so you can modify what the VM will have inside.

Why did I made this instead of using Drupal-VM?

My first tries to use Drupal-VM was unsuccessful because there were opened issues breaking its usage on my system (because of MacOS? don't remember... That was last year), so I've decided to write mine. But now, it's stable and configurable. Honestly, you should prefer this than mine, there is a large community around and it's actively maintened. If you have more time, try mine.

Other reasons: I wanted to understand how Vagrant/Ansible playbook work. Now, I can use mine, use yours, use Drupal-VM or whatever recipe given to me. I'm able to debug and modify Ansible playbook and Vagrant files, practice more Jinja2 syntax and Ruby language (the Vagrantfile use it). It's also a good way to learn how to install and configure some server softwares when I will need them before integrate them inside. I don't regret the experience and become an addict.

How to install?

Simply clone/copy this repository somewhere and, in this directory, run "vagrant up". Now, grab a cup of coffee because it takes a few minutes, depending on your internet connection and your hardware. That's it. You can optionaly override default settings, see below.

How to setup / extend

Read the Wiki pages first, then if you're brave, the source code, or at least the config YAML files in configuration/default/settings: I put lots of comments to explain options.

Quickfix temporary in place

  • Drupal 8 site name

There is a (minor) bug with Drupal 8 when installed by drush command and specify the site name: It's not taken in consideration. I've fixed this in drupal8.yml with a code not bad but which should not exists if the bug wasn't here. I'll suppress this later when fixed in Drush / Drupal8.

  • Drupal console autocompletion

When running console init from ansible, the generated console.rc file uses a wrong name for the binary ("sh" instead of "drupal" by default). This is fixed in drupalConsole-install.yml.