Drupal in a virtual machine cheat sheet
This cheatsheet presumes you're already set up with VirtualBox and Vagrant, configured for Drupal. (Agaric has our own base box to have a head start on setting up for this purpose, but some of the magic is in the Vagrantfile stored with our projects.)
In a terminal, go to the directory holding your Vagrantfile and your project code. Then the fun begins.
vagrant up
to start the virtual machine.
vagrant ssh
To go inside the virtual machine. Once inside the VM, you'll usually be using lots of Drush commands like:
drush cc all
to clear cache, or
drush dis dblog
to disable the database logging module for Drupal's watchdog. Because
tail -f /var/log/syslog
will show you all the notices and errors from your Drupal site, as they occur.
(Hint: You can open more than one console into your virtual machine; just vagrant ssh
from a new console from your host machine, while at your project directory.)
Most files that you'll care about are shared between the virtual machine and your host machine. These are the files in your project folder on your host machine (where the Vagrantfile lives) and in /vagrant from the virtual machine.
Some files you may need to edit on the virtual machine, such as Drush aliases:
vi ~/.drush/test.aliases.drushrc.php
<?php
$command_specific['rsync'] = array('mode' => 'rlptz');
?>
(That can help the file sync command.)
Multisite
A Drupal multisite, if you are unlucky enough to be dealing with one, means some extra work: mostly, use drush aliases for everything.
drush -y sql-sync @nichq2.dev-coiin @test.nichq-coiin
drush -y rsync @nichq2.dev-coiin:%files/ @test.nichq-coiin:%files
Updates
If someone updates requirements in the virtual machine, do this from your host:
git pull
vagrant provision
If someone updates Drupal modules (core, contributed, or custom), git pull and then do this from within the virtual machine
drush -y updb
Or for multisite, something like drush @test.nichq-coiin -y updb
Comments
Post new comment