This software is derived from Varying Vagrant Vagrants. It is an open source Vagrant configuration focused on CiviCRM development. Cividev inherits VVV's MIT License.
The primary goal of civicrm-buildkit-vagrant (cividev) is to provide a complete and easily installable development environment for CiviCRM with a standard server setup and CiviCRM configuration templates.
Cividev is ideal for testing new releases, developing extensions and contributing to CiviCRM core.
Cividev requires recent versions of both Vagrant (1.7+) and VirtualBox (4.3+) to be installed. If you use it for development, it will work with your favorite locally installed development environment.
Vagrant is a "tool for building and distributing development environments". It works with virtualization software such as VirtualBox to provide a virtual machine sandboxed from your local environment.
Once Vagrant and VirtualBox are installed, download or clone cividev and type vagrant up
to automatically build a virtualized Ubuntu server on your computer containing everything needed to test or develop with any combination of CMS and CiviCRM versions. See our section on The First Vagrant Up for detailed instructions.
Multiple projects can be developed at once in the same environment. Cividev is pre-configured with the following CiviCRM configurations:
- d7-master with Drupal 7 and the current development version of CiviCRM
- d7-46 with Drupal 7 and CiviCRM 4.6 (LTS)
- wp-master and wp-46 with WordPress
- d8-master with Drupal 8
- b-master with Backdrop
Cividesk's config
, database
, log
and www
directories are shared with the virtualized server.
These shared directories allow you to work, for example, in cividev/www/d7-master
in your local file system and have those changes immediately reflected in the virtualized server's file system and http://d7-master.test/. Likewise, if you vagrant ssh
and make modifications to the files in /srv/www/
, you'll immediately see those changes in your local file system.
- Start with any local operating system such as Mac OS X, Linux, or Windows.
- Install Git.
- Windows users: Be sure to add the Git executables to your path (See, e.g. this guide, under "Prerequisites")
- Install VirtualBox 4.3 or above
- Install Vagrant 1.7 or above
vagrant
will now be available as a command in your terminal, try it out.- Note: If Vagrant is already installed, use
vagrant -v
to check the version. You may want to consider upgrading if an older version is in use. - if you are on Windows, please install git with ssh as described here
- Windows Users - if using the bash shell (usually the Git Bash Shell) make sure the process runs as administrator.
- Windows users should be certain that their BIOS' virtualization settings are enabled. (Intel owners should enable VT-x while AMD owners should enable AMD-v. See here for a better explanation.)
- Install the vagrant-hostsupdater plugin with
vagrant plugin install vagrant-hostsupdater
- Note: This step is not a requirement, though it does make the process of starting up a virtual machine nicer by automating the entries needed in your local machine's
hosts
file to access the provisioned VVV (Varying Vagrant Vagrants) domains in your browser. - If you choose not to install this plugin, the following entries should be added to your local
hosts
file:192.168.123.10 cividev civi.test d7-master.test wp-master.test d7-46.test wp-46.test 192.168.123.10 d8-46.test b-46.test d8-master.test b-master.test
- Note: This step is not a requirement, though it does make the process of starting up a virtual machine nicer by automating the entries needed in your local machine's
- Install the vagrant-triggers plugin with
vagrant plugin install vagrant-triggers
- Note: This step is not a requirement. When installed, it allows for various scripts to fire when issuing commands such as
vagrant halt
andvagrant destroy
. - By default, if vagrant-triggers is installed, a
db_backup
script will run on halt, suspend, and destroy that backs up each database to adbname.sql
file in the{vvv}/database/backups/
directory. These will then be imported automatically if starting from scratch. Custom scripts can be added to override this default behavior. - If vagrant-triggers is not installed, VVV will not provide automated database backups.
- Note: This step is not a requirement. When installed, it allows for various scripts to fire when issuing commands such as
- Clone or extract the civicrm-buildkit-vagrant project into a local directory
git clone git://github.com/civicrm/civicrm-buildkit-vagrant.git cividev
- OR download and extract the repository master zip file to a
cividev
directory on your computer. - OR download and extract a stable release zip file if you'd like some extra comfort.
- In a command prompt, change into the directory where you placed the files. Use
cd
from the command prompt to do this. - Start the Vagrant environment with
vagrant up
- Be VERY patient as the magic happens (time for a coffee or lunch break?). This will take a while on the first run as your local machine downloads the required files and builds all.
- Watch as the script ends, as an administrator or
su
password may be required to properly modify the hosts file on your local machine.
- Visit any of the following default sites in your browser:
- http://d7-master.test/ for CiviCRM trunk on Drupal 7
- http://civi.test/ for a (minimal) dashboard containing several useful tools
- Build additional instances:
- ssh into your machine with 'vagrant ssh' from the cividev directory
- type 'civibuild create ' with one of the predefined configurations (ie. wp-46 for example)
- go to 'http://.test' in your local browser to acces the new instance (ie. http://wp-46.test)
Fancy, yeah?
The first time you run vagrant up
, a packaged box containing a basic virtual machine is downloaded to your local machine and cached for future use. The file used by Varying Vagrant Vagrants contains an installation of Ubuntu 14.04 and is about 332MB.
After this box is downloaded, it begins to boot as a sandboxed virtual machine using VirtualBox. Once booted, it runs the provisioning script included with VVV. This initiates the download and installation of around 100MB of packages on the new virtual machine. Then buildkit is downloaded, configured and the d7-master configuration is built (therefore pre-seeding all caches).
The time for all of this to happen depends a lot on the speed of your Internet connection. If you are on a fast cable connection, it will likely take around 30 minutes.
On future runs of vagrant up
, the packaged box will be cached on your local machine and Vagrant will only need to apply the requested provisioning.
- Preferred: If the virtual machine has been powered off with
vagrant halt
,vagrant up
will quickly power on the machine without provisioning. - Rare: If you would like to reapply the provisioning scripts with
vagrant up --provision
orvagrant provision
, some time will be taken to check for updates and packages that have not been installed. - Very Rare: If the virtual machine has been destroyed with
vagrant destroy
, it will need to download the full 100MB of package data on the nextvagrant up
.
Now that you're up and running, start poking around and modifying things.
- Access the server via the command line with
vagrant ssh
from yourvagrant-local
directory. You can do almost anything you would do with a standard Ubuntu installation on a full server.- MS Windows users: An SSH client is generally not distributed with Windows PCs by default. However, a terminal emulator such as PuTTY will provide access immediately. For detailed instructions on connecting with PuTTY, consult the VVV Wiki.
- From within a remote ssh to vagrant, you'll find the civicrm files in /srv/www/cms_branch/sites/all/modules/civicrm. For example, /srv/www/d7-master/sites/all/modules/civicrm. Careful, you may also find some civicrm files in /vagrant/www/... these are old artifacts, and aren't the right ones.
- Power off the box with
vagrant halt
and turn it back on withvagrant up
. - Suspend the box's state in memory with
vagrant suspend
and bring it right back withvagrant resume
. - Reapply provisioning to a running box with
vagrant provision
. - Destroy the box with
vagrant destroy
. Files added in thewww
directory will persist on the nextvagrant up
. - Start modifying and adding local files to fit your needs. Take a look at Auto Site Setup for tips on adding new projects.
The network configuration picks an IP of 192.168.123.10. It could cause conflicts on your existing network if you are on a 192.168.123.x subnet already. You can configure any IP address in the Vagrantfile
and it will be used on the next vagrant up
Cividev relies on the stability of both Vagrant and Virtualbox. These caveats are common to Vagrant environments and are worth noting:
- If the directory cividev is inside of is moved once provisioned, it will break.
- If
vagrant destroy
is used before moving, this should be fine.
- If
- If Virtualbox is uninstalled, cividev will break.
- If Vagrant is uninstalled, cividev will break.
The default memory allotment for the cividev virtual machine is 1024MB. If you would like to raise or lower this value to better match your system requirements, a guide to changing memory size is in the wiki.
Cividev is using a 64bit version of Ubuntu. Some older CPUs (such as the popular Intel Core 2 Duo series) do not support this. Changing the line config.vm.box = "ubuntu/trusty64"
to "ubuntu/trusty32"
in the Vagrantfile
before vagrant up
will provision a 32bit version of Ubuntu that will work on older hardware.
All CMS usernames and passwords for these installations are demo / demo
and admin / admin
by default.
The MySQL/phpMyAdmin username and password is root / root
by default.
Please note that cividev is a development and testing environment, it is NOT secure and NOT intended to be used in production or on any Internet-accessible server.
CD to /srv/www/d7-master/sites/all/modules/civicrm/tools/scripts Run phpunit /srv/www/d7-master/sites/all/modules/civicrm/tests/phpunit/HelloTest.php
A bunch of stuff!
- Ubuntu 14.04 LTS (Trusty Tahr)
- apache 2.4.x
- mysql 5.5.x
- php5 5.5.x and all extensions needed for CiviCRM
- memcached
- PHP memcache extension
- PHP xdebug extension
- PHPUnit
- git
- ngrep
- dos2unix
- Composer
- phpMemcachedAdmin
- phpMyAdmin (multi-language)
- Opcache Status
- Webgrind
- NodeJs
- grunt-cli
- Mailcatcher
- [buildkit] and all related tools
- Drupal 7 and 8, Wordpress latest version, Backdrop
- Let us have it! Don't hesitate to open a new issue on GitHub if you run into trouble or have any tips that we need to know.
Cividev is derivative work based on VVV. VVV is copyright (c) 2014-2015, the contributors of the VVV project under the MIT License.