A Vagrant server for Joomla! core and extension development.
ATTENTION: We consider this to be always work in progress. Backup your data before spinning up this dev box.
NO WARRANTY. I wrote and documented this for my personal use. It's what I use to create servers for development and testing. I accept no responsibility or liability whatsoever if any third party decides to use it. If something broke and you know how to fix it feel free to send me a Pull Request through GitHub.
In other words, here's what you get when you install a server using this repository.
- Ubuntu Server
- MySQL
- Apache, with automatic subdomain hosting
- Four different PHP versions (PHP 5.3, 5.4, 5.5, 5.6), one domain per PHP version: vagrant53.up for PHP 5.3, vagrant54.up for PHP 5.4, vagrant55.up for PHP 5.5, vagrant56.up for PHP 5.6. All compiled from scratch.
- XDebug, one port per PHP version: 9053 for PHP 5.3, 9054 for PHP 5.4, 9055 for PHP 5.5, 9056 for PHP 5.6. Compiled from scratch.
- PEAR
- Phing
- Composer
- PHPUnit
- PHP Code Sniffer (phpcs)
- PHP Mess Detector (phpmd)
- phpMyAdmin at http://phpMyAdmin.vagrant54.up
- Pimp My Log at http://pml.vagrant54.up
- MailCatcher at http://vagrant.up:1080
- Two latest Joomla! 3 sites freshly installed at dev3.vagrant54.up and test3.vagrant54.up (and the respective vagrant53.up, vagrant55.up and vagrant56.up for testing with other PHP versions)
- Optional: Joomla! CMS development site freshly installed at jdev.vagrant54.up (and the respective vagrant53.up, vagrant55.up and vagrant56.up for testing with other PHP versions) from sources you've already provided yourself – See below
- Optional: Automatic build, install and symlinking of Akeeba extensions to the dev3 site. If you're not Akeeba staff you can ignore that part.
- VirtualBox
- Vagrant 1.5 or later (built on 1.6)
- Vagrant Cachier plugin. Install with
vagrant plugin install vagrant-cachier
. Used to cache the Ubuntu packages used to build the Virtual Machines. - Vagrant HostManager plugin. Install with
vagrant plugin install vagrant-hostmanager
. Used to modify your hosts file to let you access your Virtual Machine.
You can configure the server build process by editing the vagrant/config.yaml
file. Fine tuning of server configuration files (for expert users only) requires editing the files under vagrant/files
.
Edit the vagrant/config.yaml
file.
Things you MUST change:
source: ~/Projects
under "myProjects". Change~/Projects
to the path of your local computer's directory where you put your extensions' source code. This path is mounted to/mnt/Projects
inside the virtual machinelinkextensions: 1
Set to 0 if you're not Akeeba staff. Don't ask why.source: /mnt/Projects/master/joomla-cms
Change master/joomla-cms to the relative path inside your project's directory where the Joomla! CMS working copy is. If it is the Projects directory itself, this line should readsource: /mnt/Projects
Run vagrant up
from the main directory to build the server. WARNING: Building the server can take up to one hour since we're compiling all PHP versions from source.
Things you MUST change:
source: ~/Projects
under "myProjects". Change~/Projects
to the path of your local computer's directory where you put the project files. There MUST be a directory calledakeeba
inside it where you check out the Akeeba repos. You also need a directorymaster/joomla-cms
inside the Projects folder; this is where the latest Joomla! staging branch lives.- You may want to remove installsites/jdev and/or edit the source of installsites and extensions if you do not follow the recommended directory layout in Projects.
Run vagrant up
from the main directory to build the server. WARNING: Building the server can take up to one hour since we're compiling all PHP versions from source.
The system user is vagrant
with password vagrant
. You can use it for SSH and SFTP.
All sites run under the www-data
user and group. The /mnt/Projects
directory is owned by www-data
to let you develop with ease.
The database administrator username is root
with an empty password. Please note that phpMyAdmin doesn't allow you to connect with an empty password. Do not change the root password, it will prevent provision scripts from running.
Each Joomla! site's database name, username and password is named after the site. For example, the dev3 site has its data installed in the dev3
database accessible with username dev3
and password dev3
.
Each Joomla! site's Super User username and password is named after the site. For example, the dev3 site has a Super User with username dev3
and password dev3
.
If you want to manage your database server you should preferably use a tool such as Sequel Pro. Just connect with hostname vagrant.up, username root and no password. Alternatively you can use phpMyAdmin at http://vagrant54.up/phpmyadmin
The database administrator username is root
with an empty password. Please note that phpMyAdmin doesn't allow you to connect with an empty password. Please use one of the already created users instead.
You can view the Apache and PHP log files by going to http://pml.vagrant54.up This is a tool called Pimp My Log. If you're using a modern browser it can send you desktop notifications when a new log entry is created. Do note that there are different log files for each PHP version's CLI and web server messages.
MailCatcher catches emails sent from your site instead of sending them over the Internet. This allows you to perform tests with email sends without burning your email quota or accidentally sending messages to real people.
You can access MailCatcher's interface at http://vagrant.up:1080
Each Joomla! site is already configure to use MailCatcher. As you can see, we use Sendmail as the mail server type and a special programme to act as the sendmail command. Note that the email address after the -f parameter must match the From Email setting in Joomla!'s Global Configuration. The default sendmail command for MailCatcher is /usr/bin/env catchmail -f server@vagrant.up
where server@vagrant.up
is the From Email address configured in Joomla! Global Configuration.
The PHP version used to serve your site depends on the domain name you use. We have four domain names:
vagrant53.up
for PHP 5.3vagrant54.up
for PHP 5.4vagrant55.up
for PHP 5.5vagrant56.up
for PHP 5.6
This means that the dev3 site can be served by four different URLs:
http://dev3.vagrant53.up
for PHP 5.3http://dev3.vagrant54.up
for PHP 5.4http://dev3.vagrant55.up
for PHP 5.5http://dev3.vagrant56.up
for PHP 5.6
The subdomain (leftmost part of the domain name in the URL) is the same as the /var/www subdirectory where the site's files are located in. You can create as many sites as you want, as long as you've added the necessary aliases in your computer's host file.
Each PHP version also has a different XDebug port it listens to:
- 9053 for PHP 5.3 (vagrant53.up domain)
- 9054 for PHP 5.4 (vagrant54.up domain)
- 9055 for PHP 5.5 (vagrant55.up domain)
- 9056 for PHP 5.6 (vagrant56.up domain)
Got it? It's 90 and the PHP major and minor version. It's very simple to remember.
Beware! This is a development environment. XDebug is configured to allow anyone to connect to it, no matter what their IP address is.
If you cannot access the vagrant.up, vagrant53.up etc domains you need to edit your hosts file yourself and add the following lines:
192.168.64.3 phpmyadmin.vagrant53.up phpmyadmin.vagrant54.up phpmyadmin.vagrant55.up phpmyadmin.vagrant56.up
192.168.64.3 pml.vagrant53.up pml.vagrant54.up pml.vagrant55.up pml.vagrant56.up
192.168.64.3 dev3.vagrant.up test3.vagrant.up www.vagrant.up vagrant.up
192.168.64.3 jdev.vagrant53.up dev3.vagrant53.up test3.vagrant53.up www.vagrant53.up vagrant53.up
192.168.64.3 jdev.vagrant54.up dev3.vagrant54.up test3.vagrant54.up www.vagrant54.up vagrant54.up
192.168.64.3 jdev.vagrant55.up dev3.vagrant55.up test3.vagrant55.up www.vagrant55.up vagrant55.up
192.168.64.3 jdev.vagrant56.up dev3.vagrant56.up test3.vagrant56.up www.vagrant56.up vagrant56.up
How to do that depends on your operating system:
- Mac OS X: Use GasMask
- Linux: edit the file
/etc/hosts
, e.g.gksudo gedit /etc/hosts
- Windows: Use HostsEditor
Further information on editing your hosts file can be found on HowToGeek.