├── .gitattributes
├── .gitignore
├── README.md
├── Vagrantfile
└── environments
├── bootstrap.sh
├── files
└── suphp.conf
└── vagrant
└── manifests
└── site.pp
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.conf eol=lf
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /.vagrant/
2 | /wordpress/
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # WordPress Vagrant Boxes
2 |
3 | While we're fans of the popular [VVV](https://github.com/10up/varying-vagrant-vagrants)
4 | project, this [Vagrant](http://vagrantup.com) configuration takes a different approach.
5 | We like to think that VVV is great for up-to-date development tools, working on plugins
6 | and themes, and building entirely new websites. However, this configuration was built
7 | for the purpose of testing and debugging mostly WordPress core, and ensuring
8 | compatibility with older (but still supported) server configurations.
9 |
10 | This configuration also doesn't make any assumptions about your preferred development
11 | workflow. It does not checkout or install WordPress at all. It's up to you if you
12 | would like to unpack and install a ZIP, checkout from SVN, or clone from git. However,
13 | the web server is preconfigured to look for WordPress in a specific location.
14 |
15 | ## Configurations Provided
16 |
17 | ***wordpress-php53***
18 |
19 | * Ubuntu 12.04 (precise)
20 | * Apache 2.2.22 (suPHP, port 80 and 443)
21 | * PHP 5.3.10
22 | * PHP Extensions: curl, gd, imagick, mcrypt, mysql, xdebug
23 | * PHPUnit 4.8.36
24 | * MySQL 5.5.50
25 | * Subversion 1.6.17, Git 1.7.9.5
26 | * Node.js 6.12.0, Grunt
27 |
28 | ***wordpress-php54***
29 |
30 | * Debian 7.8 (wheezy)
31 | * Apache 2.2.22 (suPHP, port 80 and 443)
32 | * PHP 5.4.45
33 | * PHP Extensions: curl, gd, imagick, mcrypt, mysql, xdebug
34 | * PHPUnit 4.8.36
35 | * MySQL 5.5.50
36 | * Subversion 1.6.17, Git 1.7.10.4
37 | * Node.js 6.12.0, Grunt
38 |
39 | ***wordpress-php55***
40 |
41 | * Ubuntu 14.04 (trusty)
42 | * Apache 2.4.7 (suPHP, port 80 and 443)
43 | * PHP 5.5.9
44 | * PHP Extensions: curl, gd, imagick, mcrypt, mysql, xdebug
45 | * PHPUnit 4.8.36
46 | * MySQL 5.5.50
47 | * Subversion 1.8.8, Git 1.9.1
48 | * Node.js 6.12.0, Grunt
49 |
50 | ## Getting Started
51 |
52 | 1. Install both [VirtualBox](https://www.virtualbox.org/) and
53 | [Vagrant](http://www.vagrantup.com/).
54 | 2. Clone this repository to a convenient location for your development:
55 | * `git clone https://github.com/tierra/wp-vagrant.git`
56 | * `cd wp-vagrant`
57 | 3. Check out (or clone) the develop repo to the `wordpress` folder:
58 | * `svn checkout https://develop.svn.wordpress.org/trunk wordpress` or
59 | * `git clone git://develop.git.wordpress.org/ wordpress`
60 | 4. Add the following to your hosts file:
61 | * `192.168.167.10 wordpress-php53.local`
62 | * `192.168.167.11 wordpress-php54.local`
63 | * `192.168.167.12 wordpress-php55.local`
64 | 5. Start Vagrant: `vagrant up [box]`
65 | * Without naming a box, just the `wordpress-php55` box will be started.
66 | Specify `wordpress-php53`, or `wordpress-php54`, to start up instead.
67 |
68 | Note that Apache is configured to point to the `wordpress/build` directory,
69 | so you need to remember to run `grunt` from the WordPress directory after
70 | checking out the code. Optionally, you could also just install WordPress
71 | normally inside the `wordpress/build` directory without using the develop
72 | repository. All boxes are pre-configured with Node.js and Grunt, so if you
73 | don't have these tools installed locally, you can just SSH into the box, and
74 | run the following:
75 |
76 | ```
77 | cd /vagrant/wordpress && npm install && grunt
78 | ```
79 |
80 | With any of the boxes started, you can reach them at these locations:
81 |
82 | * http://wordpress-php53.local/
83 | * http://wordpress-php54.local/
84 | * http://wordpress-php55.local/
85 |
86 | ## MySQL Configuration
87 |
88 | The MySQL root password is "wordpress", and all boxes
89 | come with two pre-configured databases:
90 |
91 | * `wordpress` (this is meant for a regular installation)
92 | * `wordpress-tests` (this is meant for use with PHPUnit tests)
93 |
94 | A single account with rights to all databases for convenience:
95 |
96 | * Username: `wordpress`
97 | * Password: `wordpress`
98 |
--------------------------------------------------------------------------------
/Vagrantfile:
--------------------------------------------------------------------------------
1 | # -*- mode: ruby -*-
2 | # vi: set ft=ruby :
3 |
4 | def provision(node)
5 | node.vm.provider :virtualbox do |vb|
6 | vb.customize ['modifyvm', :id, '--memory', '512']
7 | end
8 | node.vm.provision :shell, :path => 'environments/bootstrap.sh'
9 | node.vm.provision :puppet do |puppet|
10 | puppet.environment_path = 'environments'
11 | puppet.environment = 'vagrant'
12 | puppet.facter = { 'fqdn' => node.vm.hostname }
13 | end
14 | end
15 |
16 | Vagrant.configure('2') do |config|
17 |
18 | config.vm.define 'wordpress-php53', autostart: false do |node|
19 | node.vm.box = 'puppetlabs/ubuntu-12.04-64-puppet'
20 | node.vm.box_version = '= 1.0.2'
21 | node.vm.hostname = 'wordpress-php53.local'
22 | node.vm.network :private_network, ip: '192.168.167.10'
23 | provision(node)
24 | end
25 |
26 | config.vm.define 'wordpress-php54', autostart: false do |node|
27 | node.vm.box = 'puppetlabs/debian-7.8-64-puppet'
28 | node.vm.hostname = 'wordpress-php54.local'
29 | node.vm.network :private_network, ip: '192.168.167.11'
30 | provision(node)
31 | end
32 |
33 | config.vm.define 'wordpress-php55', primary: true do |node|
34 | node.vm.box = 'puppetlabs/ubuntu-14.04-64-puppet'
35 | node.vm.hostname = 'wordpress-php55.local'
36 | node.vm.network :private_network, ip: '192.168.167.12'
37 | provision(node)
38 | end
39 |
40 | end
41 |
--------------------------------------------------------------------------------
/environments/bootstrap.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7F438280EF8D349F
4 |
5 | curl -sL https://deb.nodesource.com/setup_6.x | bash -
6 | apt-get install -y nodejs
7 | npm install -g grunt-cli
8 |
9 | mkdir -p /etc/suphp
10 | cp /vagrant/environments/files/suphp.conf /etc/suphp/suphp.conf
11 |
12 | if [ ! -d /etc/puppetlabs/code/modules/apache ]; then
13 | puppet module install --modulepath /etc/puppetlabs/code/modules --version 1.11.1 puppetlabs/apache;
14 | fi
15 |
16 | if [ ! -d /etc/puppetlabs/code/modules/mysql ]; then
17 | puppet module install --modulepath /etc/puppetlabs/code/modules --version 3.11.0 puppetlabs/mysql;
18 | fi
19 |
20 | if [ ! -f /usr/local/bin/phpunit ]; then
21 | curl --silent --show-error --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit-4.8.36.phar
22 | fi
23 | chmod +x /usr/local/bin/phpunit
24 |
--------------------------------------------------------------------------------
/environments/files/suphp.conf:
--------------------------------------------------------------------------------
1 | [global]
2 | ;Path to logfile
3 | logfile=/var/log/suphp/suphp.log
4 |
5 | ;Loglevel
6 | loglevel=info
7 |
8 | ;User Apache is running as
9 | webserver_user=www-data
10 |
11 | ;Path all scripts have to be in
12 | docroot=/
13 |
14 | ;Path to chroot() to before executing script
15 | ;chroot=/mychroot
16 |
17 | ; Security options
18 | allow_file_group_writeable=true
19 | allow_file_others_writeable=true
20 | allow_directory_group_writeable=true
21 | allow_directory_others_writeable=true
22 |
23 | ;Check wheter script is within DOCUMENT_ROOT
24 | check_vhost_docroot=false
25 |
26 | ;Send minor error messages to browser
27 | errors_to_browser=true
28 |
29 | ;PATH environment variable
30 | env_path="/bin:/usr/bin"
31 |
32 | ;Umask to set, specify in octal notation
33 | umask=0022
34 |
35 | ; Minimum UID
36 | min_uid=100
37 |
38 | ; Minimum GID
39 | min_gid=100
40 |
41 |
42 | [handlers]
43 | ;Handler for php-scripts
44 | application/x-httpd-suphp="php:/usr/bin/php-cgi"
45 |
46 | ;Handler for CGI-scripts
47 | x-suphp-cgi="execute:!self"
48 |
--------------------------------------------------------------------------------
/environments/vagrant/manifests/site.pp:
--------------------------------------------------------------------------------
1 |
2 | class { 'apache': }
3 |
4 | if $::lsbdistcodename == 'precise' {
5 | class { 'apache::mod::version': }
6 | }
7 |
8 | package { [
9 | 'build-essential',
10 | 'curl',
11 | 'git',
12 | 'php5-cli',
13 | 'php5-curl',
14 | 'php5-gd',
15 | 'php5-imagick',
16 | 'php5-mcrypt',
17 | 'php5-xdebug',
18 | 'subversion'
19 | ]: ensure => latest }
20 |
21 | include apache::mod::suphp
22 |
23 | apache::mod { 'rewrite': }
24 |
25 | apache::vhost { 'wordpress':
26 | servername => $fqdn,
27 | port => '80',
28 | docroot => '/vagrant/wordpress/build',
29 | docroot_owner => 'vagrant',
30 | docroot_group => 'vagrant',
31 | suphp_addhandler => 'application/x-httpd-suphp',
32 | suphp_engine => 'on',
33 | suphp_configpath => '/etc/php5/cgi',
34 | override => 'All',
35 | custom_fragment => @(APACHECONF)
36 |
37 | RewriteLogLevel 2
38 | RewriteLog /var/log/apache2/rewrite.log
39 |
40 | = 2.4>
41 | LogLevel warn rewrite:trace3
42 |
43 | | APACHECONF
44 | }
45 | apache::vhost { 'wordpress-ssl':
46 | servername => $fqdn,
47 | port => '443',
48 | docroot => '/vagrant/wordpress/build',
49 | docroot_owner => 'vagrant',
50 | docroot_group => 'vagrant',
51 | ssl => true,
52 | suphp_addhandler => 'application/x-httpd-suphp',
53 | suphp_engine => 'on',
54 | suphp_configpath => '/etc/php5/cgi',
55 | override => 'All',
56 | custom_fragment => @(APACHECONF)
57 |
58 | RewriteLogLevel 2
59 | RewriteLog /var/log/apache2/rewrite-ssl.log
60 |
61 | = 2.4>
62 | LogLevel warn rewrite:trace3
63 |
64 | | APACHECONF
65 | }
66 |
67 | class { 'mysql::server':
68 | root_password => 'wordpress'
69 | }
70 |
71 | class { 'mysql::bindings':
72 | php_enable => 'true',
73 | }
74 |
75 | mysql::db { ['wordpress', 'wordpress-tests']:
76 | ensure => present,
77 | charset => 'utf8',
78 | user => 'wordpress',
79 | password => 'wordpress',
80 | host => 'localhost',
81 | grant => ['ALL'],
82 | require => Class['mysql::server']
83 | }
84 |
--------------------------------------------------------------------------------