Skip to content
Snippets Groups Projects
user avatar
authored
Name Last commit Last update
manifests
phpstorm
variables
README.md
clean.sh
setup.sh

WCMS Vagrantfile setup

CAUTION! This Vagrant box is meant for local development only. This set up is not hardened and is not secure, so only us it as a local development environment.

Running setup.sh creates a Vagrantfile that will allow you to create a VirtualBox virtual machine that (currently) runs Ubuntu 16.04 LTS with Apache 2.4.18, MySQL 5.7 and PHP 5.6.19/7.1.6 as well as Drupal currently at 7.55/8.3. Please note, this setup only allows local logins to sites. CAS doesn't work "out of the box". You will need to add an additional file if you require CAS which you will need to contact a WCMS team member to get.

A few things to be aware of:

  1. You need to have Git (https://git-scm.com/downloads), Vagrant (https://www.vagrantup.com/downloads.html) and VirtualBox https://www.virtualbox.org/wiki/Downloads) installed on your host system to create the dev environment. If you are on a Mac you will also need Xcode installed.

  2. You need to create a Host-only Network in VirtualBox. To do that go to Preferences -> Network and select the Host-Only tab. On the right you will see a green +, click that and then enter:

        IPv4 address        192.168.101.1
        IPv4 network mask   255.255.255.0
  3. You will need to run the setup.sh file first. This will create a Vagrantfile that you then use to create your virtual machine. When you run setup.sh it will ask you for a hostname, an IP address (which needs to start with 192.168.101), what you want your sites to be called, eg. fdsu, www or test and what your server will be eg. d7 or k7 etc. You can leave the defaults if you want but if you are running or plan to run multiple wcms virtual machines then you should change some of the defaults for each one. It will also ask you to chose a version of PHP. If you are planning on doing Drupal 8 development then you should chose option 2, 7.1 or 1, for 5.6. NOTE You may need to run the vagrant commands as an administrator for your local dev site to build correctly.

After running setup.sh:

  1. Before running vagrant up you should make sure that the base box is updated (if you just downloaded wcms-vagrant you can skip this step):

    $ vagrant box update

    You should also add the vbguest vagrant plugin. If you are on a Windows machine you should also add the winnfsd plugin:

    $ vagrant plugin install vagrant-vbguest
    $ vagrant plugin install vagrant-winnfsd

    Once you've run the setup.sh file (which creates the Vagrantfile and the manifests) from the command prompt type:

    $ vagrant up

    This will create your dev environment, after a few minutes it will complete and you can then log in over ssh using the IP address you created earlier.

  2. The login for your local development server is user: vagrant password: vagrant.

  3. You will need to add your Gitlab key to the VM so you can access the git repos. Here are the instructions from Gitlab for adding the key:

    https://git.uwaterloo.ca/help/ssh/README

  4. You may need to add the LDAP config settings if you need CAS to work. If you are part of the WCMS team you should already have access to this, if you are an on-campus developer you can contact the WCMS and ask how to set this up.

  5. You should go to one of your drupal folders, located at /var/www/drupal7/profiles/uw_base_profile (or drupal7alt) and pull down the latest version of the wcms base profile or the version you need to work with:

    $ git pull

You should also do a rebuild of the profile to update any modules: sh $ ./rebuild.sh NOTE Drupal 8 is included as one of the options, but it is currently not supported by the WCMS. It is included for investigative purposes only 6. On a Windows machine you will need to add the defaults or if you changed the defaults, what you set the IP, host-name and sites to into your windows hosts file (C:\Windows\System32\drives\etc).

You're Windows hosts file should look something like this:
```sh
  192.168.101.20 wcms-vagrant d7 d7alt d7rel d7lrel d7os d8
```
  1. If you have or are planning to have multiple vm's running using this script you should be aware that you will need to change the name of you're sites when you run setup.sh and not rely on the defaults. That way on Windows your computer can route the sites correctly with the Windows hosts file.

    You're Windows hosts file should look something like this:

      192.168.101.20 wcms-vagrant d7 d7alt d7rel d7lrel d7os d8
      192.168.101.21 wcms-vagrant1 test7 test7alt test8 test7rel test7lrel test7os test8
      192.168.101.35 wcms-vagrant2 p7 p7alt p7rel p7lrel p7os p8
  2. If you run into an issue when using drush to clear caches the first time after you create a site, it could be that the permissions of the files folder for that site have changed. Either change the permissions for that specific file directory or just change the permissions at the /var/www level:

    $ sudo chown -R vagrant:www-data /var/www
  3. Xdebug is disabled by default because it affects performance of Xhprof, to enable it you need to remove the semi-colon from the zend_extension line of:

    $ sudo nano /etc/php5/mods_available/xdebug.ini
  4. Be aware that OpenScholar takes a lot of memory to install, the VM has 3072MB of memory allocated to it because of this, so running multiple VM's could cause performance issues.

  5. You should periodically make sure that your dev environment is up to date. You can do that when you are logged in to your server by doing an update and upgrade:

    $ sudo apt-get update
    	
    $ sudo apt-get upgrade
  6. If you don't want your VM any more type (from within the wcms-vagrant folder):

    $ vagrant destroy

This will destroy your dev environment and remove it from VirtualBox but it keeps the settings you set when you ran setup.sh. If you want remove those settings as well then you nee to run clean.sh which will remove all the config files and allow you to start again from scratch.