A Vagrant project to setup Zivtech's Drupal development environment.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
custom-modules
docs
environments/dev
hiera
manifests
packer
www
.gitattributes
.gitignore
Puppetfile
Puppetfile.lock
README.md
Vagrantfile
default.config.yaml
ssh-add.rb

README.md

Zivtech LAMP Development VM

This repository manages Zivtech's development virtual server. It has a number of tools that we use to build Drupal sites. Drush is included as well as Drush Fetcher which is a tool used to sync copies of Drupal sites between environments. There are also other useful features such as an Apache Solr server for easy integration with search api or apachesolr. By default this tool builds an Ubuntu 16.04 server. See [#customizing](Customizing This VM below).

Features

Installation

Special note for macOS > 10.12 (Sierra)

Because Apple switched to the Apple Filesystem (APFS) format, NFS syncing will not correctly work. You can follow the issue on Vagrant's Github issue tracker.

Until a solution comes from vagrant, or a more workable solution is found on our end, we recommend using a separate disk image for running the VM. To set that up:

  1. Open Disk Utility, and create a new image by selecting File > New Image > Blank Image.
  2. Name the image as you wish, though a single string name will be less annoying for you later. Format it to Mac OS Extended (Journaled). Not case-sensitive and not APFS! The size should be at minimum 80GB, as that is the virtual size of our VM here.
  3. Once the image is created, it should be automatically mounted.
  4. You can now cd to your mounted image, which should be located at /Volumes/YOUR_IMAGE_NAME.

At this point, you can continue your install using the directions below.

Dependencies

You must have Vagrant and VirtualBox installed first. If they are already installed, update Vagrant and Virtualbox before you continue.

The puppet dependencies are managed via librarian-puppet which can automatically be managed for you if you install the vagrant-librarian-puppet vagrant plugin.

Complete instructions below:

sudo gem install puppet facter hiera librarian-puppet --no-document
git clone https://github.com/zivtech/vagrant-development-vm.git myvm
cd myvm
librarian-puppet install
vagrant up

You should now have a working Virtual Server! Create a new Drupal site by running drush fetcher-create yoursite (add the version of drupal as a second argument if you want Drupal 8!). Run vagrant ssh to get into your VM.

NOTE FOR WINDOWS USERS: There are known issues with getting librarian-puppet installed and running on windows and so for Windows users it is recommended that you DO NOT follow the installation instructions below but instead download the most recent full release via zip file from the releases page instead of installing that plugin or cloning the repository from source. Then you can cd into the directory and run vagrant up as normal.

Customizing this VM

Once this repository have been downloaded, running "vagrant up" from within this directory will build the virtual server and provision it. Two different categories of customizations can be performed on the dev vm. First there are vagrant settings such as Ubuntu version, local IP address, amount of RAM, hostname, etc. The second are tunables in the virtual server configuration.

Vagrant Settings

You can change settings such as the IP address of the server and the server's hostname in by creating a new file called config.yaml where you can define any value listed below (see default.config.yaml for formatting options.

  • hostname: The hostname that gets set inside the VM. Defaults to vm.
  • private_ipv4: The private IP to provision for this host. Defaults to 172.16.0.2.
  • box:The base box to use to build the puppet work on top of. Defaults to zivtech/ubuntu-16.04-server-puppet-4
  • memory: The amount of memory (in megabytes) to provision. Defaults to 2048.
  • sync_folder: Set this to false in order to not mount the www folder in this directory inside /var/www on the VM. Defaults to true.
  • sync_file_enabled_on_windows: If we detect we are running on windows, whether we should enable the sync folder. Note, this uses VirtualBox folder sharing which is not compatible with symlinks and some other important features. Defaults to false.

Server Configuration Settings

This project uses puppet to configure the virtual server. Many of the common tunables for a Drupal server are set in hiera/common.yaml and they can be overridden by creating a new file at hiera/custom.yaml and copying any line you would like to override into the second file. Any parameter on any of the classes utilized in this setup can be overridden using hiera, the settings in hiera/custom.yaml are overrides needed by this project or settings listed there for your easy reference in tuning the VM.

Fetcher Server Configuration

If you use a Fetcher Server, set its url as 'info_fetcher.config' 'host' in your hiera/custom.yaml file. See hiera/common.yaml.

Common Issues

On non-windows host systems, Vagrant tries to mount a shared NFS directory to the host machine (the physical computer). This has been known to fail in some cases. If you receive errors about a failed mount remove the virtual machine with "vagrant destroy" then create or edit a config.yaml file in the root of this project and add the following line:

sync_folder: false