From 24e6c307464fc29b10983330b8f8d2d29bb9c3ee Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sat, 16 Aug 2014 18:53:37 +0900 Subject: [PATCH 01/30] Configuration change from latest VVV --- Vagrantfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Vagrantfile b/Vagrantfile index 3a8235a..86503be 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -13,6 +13,8 @@ Vagrant.configure("2") do |config| # Configurations from 1.0.x can be placed in Vagrant 1.1.x specs like the following. config.vm.provider :virtualbox do |v| v.customize ["modifyvm", :id, "--memory", 512] + v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] + v.customize ["modifyvm", :id, "--natdnsproxy1", "on"] end # Forward Agent From 605116c47456f2a3623d83402ac76198ac27183f Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sat, 16 Aug 2014 18:56:27 +0900 Subject: [PATCH 02/30] Update VM box from Ubuntu 12.0.4 Precise 32 to Ubuntu 14.04 Trusty 64 --- Vagrantfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 86503be..f2096e5 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -25,11 +25,11 @@ Vagrant.configure("2") do |config| # Default Ubuntu Box # - # This box is provided by Vagrant at vagrantup.com and is a nicely sized (290MB) - # box containing the Ubuntu 12.0.4 Precise 32 bit release. Once this box is downloaded + # This box is provided by Ubuntu vagrantcloud.com and is a nicely sized (376MB) + # box containing the Ubuntu 14.04 Trusty 64 bit release. Once this box is downloaded # to your host computer, it is cached for future use under the specified box name. - config.vm.box = "precise32" - config.vm.box_url = "http://files.vagrantup.com/precise32.box" + config.vm.box = "ubuntu/trusty64" + config.vm.box_url = "https://vagrantcloud.com/ubuntu/trusty64" config.vm.hostname = "vvv" From f315bd75e2ebe90fb8d91f0653a19e8ed249aec3 Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sat, 16 Aug 2014 18:58:53 +0900 Subject: [PATCH 03/30] Shares mounted using NFS for improved performance. --- Vagrantfile | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index f2096e5..eed814c 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -83,6 +83,10 @@ Vagrant.configure("2") do |config| # for those as well. This includes other Vagrant boxes. config.vm.network :private_network, ip: "192.168.50.4" + # NFS configuration + config.nfs.map_uid = Process.uid + config.nfs.map_gid = Process.gid + # Drive mapping # # The following config.vm.synced_folder settings will map directories in your Vagrant @@ -98,11 +102,20 @@ Vagrant.configure("2") do |config| # a mapped directory inside the VM will be created that contains these files. # This directory is used to maintain default database scripts as well as backed # up mysql dumps (SQL files) that are to be imported automatically on vagrant up - config.vm.synced_folder "database/", "/srv/database" - if vagrant_version >= "1.3.0" - config.vm.synced_folder "database/data/", "/var/lib/mysql", :mount_options => [ "dmode=777", "fmode=777" ] - else - config.vm.synced_folder "database/data/", "/var/lib/mysql", :extra => 'dmode=777,fmode=777' + config.vm.synced_folder "database/", "/srv/database", type: "nfs" + + # If the mysql_upgrade_info file from a previous persistent database mapping is detected, + # we'll continue to map that directory as /var/lib/mysql inside the virtual machine. Once + # this file is changed or removed, this mapping will no longer occur. A db_backup command + # is now available inside the virtual machine to backup all databases for future use. This + # command is automatically issued on halt, suspend, and destroy if the vagrant-triggers + # plugin is installed. + if File.exists?(File.join(vagrant_dir,'database/data/mysql_upgrade_info')) then + if vagrant_version >= "1.3.0" + config.vm.synced_folder "database/data/", "/var/lib/mysql", type: "nfs" + else + config.vm.synced_folder "database/data/", "/var/lib/mysql", type: "nfs" + end end # /srv/config/ @@ -111,17 +124,23 @@ Vagrant.configure("2") do |config| # a mapped directory inside the VM will be created that contains these files. # This directory is currently used to maintain various config files for php and # Apache as well as any pre-existing database files. - config.vm.synced_folder "config/", "/srv/config" + config.vm.synced_folder "config/", "/srv/config", type: "nfs" + + # /srv/log/ + # + # If a log directory exists in the same directory as your Vagrantfile, a mapped + # directory inside the VM will be created for some generated log files. + config.vm.synced_folder "log/", "/srv/log", type: "nfs" # /srv/www/ # # If a www directory exists in the same directory as your Vagrantfile, a mapped directory - # inside the VM will be created that acts as the default location for Apache sites. Put all + # inside the VM will be created that acts as the default location for nginx sites. Put all # of your project files here that you want to access through the web server if vagrant_version >= "1.3.0" - config.vm.synced_folder "www/", "/srv/www/", :owner => "www-data", :mount_options => [ "dmode=775", "fmode=774" ] + config.vm.synced_folder "www/", "/srv/www/", type: "nfs" else - config.vm.synced_folder "www/", "/srv/www/", :owner => "www-data", :extra => 'dmode=775,fmode=774' + config.vm.synced_folder "www/", "/srv/www/", type: "nfs" end # Customfile - POSSIBLY UNSTABLE From 3f7f54adc826304bc0c1d90b5725dc0b3c7d3f84 Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sat, 16 Aug 2014 18:59:40 +0900 Subject: [PATCH 04/30] Change to triggers from latest VVV. --- Vagrantfile | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Vagrantfile b/Vagrantfile index eed814c..4740769 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -185,4 +185,31 @@ Vagrant.configure("2") do |config| if File.exists?(File.join(vagrant_dir,'provision','provision-post.sh')) then config.vm.provision :shell, :path => File.join( "provision", "provision-post.sh" ) end + + # Always start MySQL on boot, even when not running the full provisioner + # (run: "always" support added in 1.6.0) + if vagrant_version >= "1.6.0" + config.vm.provision :shell, inline: "sudo service mysql restart", run: "always" + end + + # Vagrant Triggers + # + # If the vagrant-triggers plugin is installed, we can run various scripts on Vagrant + # state changes like `vagrant up`, `vagrant halt`, `vagrant suspend`, and `vagrant destroy` + # + # These scripts are run on the host machine, so we use `vagrant ssh` to tunnel back + # into the VM and execute things. By default, each of these scripts calls db_backup + # to create backups of all current databases. This can be overridden with custom + # scripting. See the individual files in config/homebin/ for details. + if defined? VagrantPlugins::Triggers + config.trigger.before :halt, :stdout => true do + run "vagrant ssh -c 'vagrant_halt'" + end + config.trigger.before :suspend, :stdout => true do + run "vagrant ssh -c 'vagrant_suspend'" + end + config.trigger.before :destroy, :stdout => true do + run "vagrant ssh -c 'vagrant_destroy'" + end + end end From cd8e144c5cafac3bd484f1c952b858be35932309 Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sat, 16 Aug 2014 19:05:51 +0900 Subject: [PATCH 05/30] SVN, PHP 5.4, Git 1.8 removed. Node.js updated. Multiverse (for libapache2-mod-fastcgi), PageSpeed added. Link to PageSpeed PPA needs to be commented out once it has been installed because PageSpeed adds its own link. --- config/apt-source-append.list | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/config/apt-source-append.list b/config/apt-source-append.list index 4a012c6..efa414f 100644 --- a/config/apt-source-append.list +++ b/config/apt-source-append.list @@ -1,18 +1,17 @@ # Additional sources will be added here to help control the # versions of various packages that are installed -# Provides SVN 1.7.9 -deb http://ppa.launchpad.net/svn/ppa/ubuntu precise main -deb-src http://ppa.launchpad.net/svn/ppa/ubuntu precise main - -# Provides PHP 5.4 -deb http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu precise main -deb-src http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu precise main - -# Provides Git 1.8 -deb http://ppa.launchpad.net/git-core/ppa/ubuntu precise main -deb-src http://ppa.launchpad.net/git-core/ppa/ubuntu precise main +# Provides PageSpeed, but once installed PageSpeed adds its PPA to /etc/apt/sources.list.d +#deb http://dl.google.com/linux/mod-pagespeed/deb/ stable main # Provides Node.js -deb http://ppa.launchpad.net/chris-lea/node.js/ubuntu precise main -deb-src http://ppa.launchpad.net/chris-lea/node.js/ubuntu precise main +deb http://ppa.launchpad.net/chris-lea/node.js/ubuntu trusty main +deb-src http://ppa.launchpad.net/chris-lea/node.js/ubuntu trusty main + +# Multiverse +deb http://archive.ubuntu.com/ubuntu trusty multiverse +deb-src http://archive.ubuntu.com/ubuntu trusty multiverse +deb http://archive.ubuntu.com/ubuntu trusty-updates multiverse +deb-src http://archive.ubuntu.com/ubuntu trusty-updates multiverse +deb http://security.ubuntu.com/ubuntu trusty-security multiverse +deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse From c126b564aeecb6f4a15a1678be8eef0322589a7a Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sat, 16 Aug 2014 19:06:51 +0900 Subject: [PATCH 06/30] phpunit-composer no longer in VVV. --- config/phpunit-composer.json | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 config/phpunit-composer.json diff --git a/config/phpunit-composer.json b/config/phpunit-composer.json deleted file mode 100644 index 616cc30..0000000 --- a/config/phpunit-composer.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "vvv-phpunit", - "description": "VVV Global Composer packages", - "require": { - "phpunit/phpunit": "3.7.*", - "mockery/mockery": "0.8.0", - "hamcrest/hamcrest": "1.1.0" - }, - "config": { - "bin-dir": "/usr/local/bin/" - }, - "repositories": [ - { - "type": "package", - "package": { - "name": "hamcrest/hamcrest", - "version": "1.1.0", - "dist": { - "type": "zip", - "url": "https://hamcrest.googlecode.com/files/hamcrest-php-1.1.0.zip" - }, - "include-path": ["Hamcrest-1.1.0/"], - "autoload": { - "psr-0": { "Hamcrest_": "Hamcrest-1.1.0/" }, - "files": ["Hamcrest-1.1.0/Hamcrest/Hamcrest.php"] - } - } - } - ] -} From 3315f7fa840aaaee0b07d55766c3d41cb03ada08 Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sat, 16 Aug 2014 19:07:38 +0900 Subject: [PATCH 07/30] Changes necessary for Apache 2.2 to 2.4 upgrade. --- config/apache-config/apache2.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 config/apache-config/apache2.conf diff --git a/config/apache-config/apache2.conf b/config/apache-config/apache2.conf old mode 100644 new mode 100755 index 25f6cf5..30c4875 --- a/config/apache-config/apache2.conf +++ b/config/apache-config/apache2.conf @@ -53,7 +53,7 @@ ServerName localhost # # The accept serialization lock file MUST BE STORED ON A LOCAL DISK. # -LockFile ${APACHE_LOCK_DIR}/accept.lock +Mutex file:${APACHE_LOCK_DIR} default # # PidFile: The file in which the server should record its process @@ -212,7 +212,7 @@ Include mods-enabled/*.load Include mods-enabled/*.conf # Include all the user configurations: -Include httpd.conf +#Include httpd.conf # Include ports listing Include ports.conf From 92130c0c829b822636a1d742484d78345670a82a Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sat, 16 Aug 2014 19:09:17 +0900 Subject: [PATCH 08/30] New files from VVV. --- config/homebin/db_backup | 12 ++++++++++++ config/homebin/develop_git | 35 ++++++++++++++++++++++++++++++++++ config/homebin/vagrant_destroy | 14 ++++++++++++++ config/homebin/vagrant_halt | 14 ++++++++++++++ config/homebin/vagrant_suspend | 14 ++++++++++++++ 5 files changed, 89 insertions(+) create mode 100755 config/homebin/db_backup create mode 100755 config/homebin/develop_git create mode 100755 config/homebin/vagrant_destroy create mode 100755 config/homebin/vagrant_halt create mode 100755 config/homebin/vagrant_suspend diff --git a/config/homebin/db_backup b/config/homebin/db_backup new file mode 100755 index 0000000..cafe692 --- /dev/null +++ b/config/homebin/db_backup @@ -0,0 +1,12 @@ +#!/bin/bash +# +# Create individual SQL files for each database. These files +# are imported automatically during an initial provision if +# the databases exist per the import-sql.sh process. +mysql -e 'show databases' | \ +grep -v -F "information_schema" | \ +grep -v -F "performance_schema" | \ +grep -v -F "mysql" | \ +grep -v -F "test" | \ +grep -v -F "Database" | \ +while read dbname; do mysqldump -uroot "$dbname" > /srv/database/backups/"$dbname".sql && echo "Database $dbname backed up..."; done \ No newline at end of file diff --git a/config/homebin/develop_git b/config/homebin/develop_git new file mode 100755 index 0000000..5022efa --- /dev/null +++ b/config/homebin/develop_git @@ -0,0 +1,35 @@ +#!/bin/bash +# +# A script to convert the included develop.svn.wordpress.org repository into +# the git mirror, develop.git.wordpress.org. + +set -e + +if [[ $USER != 'vagrant' ]]; then + echo "Please run inside Vagrant" + exit 1 +fi + +cd /srv/www/wordpress-develop/ + +if [[ -e .git ]]; then + echo "Repo has already been converted to Git" + exit 1 +fi + +echo "Converting src.wordpress-develop.dev from SVN to GIT" + +echo "Rename .svn to .svn-backup" +mv .svn .svn-backup + +git clone --no-checkout git://develop.git.wordpress.org/ /tmp/wp-git +cd /tmp/wp-git +git reset -q . +cd /srv/www/wordpress-develop/ + +echo "Moving .git dir to /srv/www/wordpress-develop/" +mv /tmp/wp-git/.git .git +git config core.fileMode false +git config diff.noprefix true + +echo "Done" diff --git a/config/homebin/vagrant_destroy b/config/homebin/vagrant_destroy new file mode 100755 index 0000000..3b64e0a --- /dev/null +++ b/config/homebin/vagrant_destroy @@ -0,0 +1,14 @@ +#!/bin/bash +# +# This script is run whenever `vagrant destroy` is used to destroy +# the virtual machine. To customize this behavior, include a file +# in your local VVV/config/homebin directory: vagrant_destroy_custom +# +# Look for a custom trigger file. If this exists, we'll assume that +# all trigger actions should be handled by this custom script. If +# it does not exist, then we'll handle some basic tasks. +if [[ -f /home/vagrant/bin/vagrant_destroy_custom ]]; then + vagrant_destroy_custom +else + db_backup +fi \ No newline at end of file diff --git a/config/homebin/vagrant_halt b/config/homebin/vagrant_halt new file mode 100755 index 0000000..d24af89 --- /dev/null +++ b/config/homebin/vagrant_halt @@ -0,0 +1,14 @@ +#!/bin/bash +# +# This script is run whenever `vagrant halt` is used to power off +# the virtual machine. To customize this behavior, include a file +# in your local VVV/config/homebin directory: vagrant_halt_custom +# +# Look for a custom trigger file. If this exists, we'll assume that +# all trigger actions should be handled by this custom script. If +# it does not exist, then we'll handle some basic tasks. +if [[ -f /home/vagrant/bin/vagrant_halt_custom ]]; then + vagrant_halt_custom +else + db_backup +fi \ No newline at end of file diff --git a/config/homebin/vagrant_suspend b/config/homebin/vagrant_suspend new file mode 100755 index 0000000..870e60d --- /dev/null +++ b/config/homebin/vagrant_suspend @@ -0,0 +1,14 @@ +#!/bin/bash +# +# This script is run whenever `vagrant suspend` is used to suspend +# the virtual machine. To customize this behavior, include a file +# in your local VVV/config/homebin directory: vagrant_suspend_custom +# +# Look for a custom trigger file. If this exists, we'll assume that +# all trigger actions should be handled by this custom script. If +# it does not exist, then we'll handle some basic tasks. +if [[ -f /home/vagrant/bin/vagrant_suspend_custom ]]; then + vagrant_suspend_custom +else + db_backup +fi \ No newline at end of file From 56fc244ebf0fb12bf593c829b134c8bc7a7bf141 Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sat, 16 Aug 2014 19:10:11 +0900 Subject: [PATCH 09/30] MySQL hack apparently no longer needed. This change is from the latest VVV --- config/init/vvv-start.conf | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/config/init/vvv-start.conf b/config/init/vvv-start.conf index 8962803..3069c1f 100644 --- a/config/init/vvv-start.conf +++ b/config/init/vvv-start.conf @@ -8,14 +8,5 @@ script service apache2 start service php5-fpm start service memcached start -# Hack becuz we need to wait for MySQL dir to be mounted https://github.com/mitchellh/vagrant/issues/1776#issuecomment-25181024 -COUNTER=0 -while [ $COUNTER -lt 900 ]; do - sleep 5 - COUNTER=$(($COUNTER+1)) - if [ "$(ls -A /var/lib/mysql)" ]; then - service mysql start - COUNTER=1000 - fi -done -end script \ No newline at end of file +service mysql start +end script From 02990648da5aef0e6eb3ce059c1b33ae27587539 Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sat, 16 Aug 2014 19:14:40 +0900 Subject: [PATCH 10/30] I think I only added PageSpeed, tree, and packages for NFS. --- provision/provision.sh | 129 +++++++++++++++++++++-------------------- 1 file changed, 67 insertions(+), 62 deletions(-) diff --git a/provision/provision.sh b/provision/provision.sh index a9da852..e240242 100755 --- a/provision/provision.sh +++ b/provision/provision.sh @@ -18,7 +18,7 @@ start_seconds="$(date +%s)" # bunch of errors. ping_result="$(ping -c 2 8.8.4.4 2>&1)" if [[ $ping_result != *bytes?from* ]]; then - ping_result="$(ping -c 2 4.2.2.2 2>&1)" + ping_result="$(ping -c 2 4.2.2.2 2>&1)" fi # PACKAGE INSTALLATION @@ -35,67 +35,72 @@ apt_package_install_list=() # status before adding them to the apt_package_install_list array. apt_package_check_list=( - # PHP5 - # - # Our base packages for php5. As long as php5-fpm and php5-cli are - # installed, there is no need to install the general php5 package, which - # can sometimes install apache as a requirement. - php5-fpm - php5-cli - - # Common and dev packages for php - php5-common - php5-dev - - # Extra PHP modules that we find useful - php5-memcache - php5-imagick - php5-xdebug - php5-mcrypt - php5-mysql - php5-imap - php5-curl - php-pear - php5-gd - php-apc - php5 - - # Apache is installed as the default web server - apache2-mpm-worker - libapache2-mod-fastcgi - - # memcached is made available for object caching - memcached - - # mysql is the default database - mysql-server - - # other packages that come in handy - imagemagick - subversion - git-core - unzip - ngrep - curl - make - vim - colordiff - postfix - - # Req'd for i18n tools - gettext - - # Req'd for Webgrind - graphviz - - # dos2unix - # Allows conversion of DOS style line endings to something we'll have less - # trouble with in Linux. - dos2unix - - # nodejs for use by grunt - g++ - nodejs + # PHP5 + # + # Our base packages for php5. As long as php5-fpm and php5-cli are + # installed, there is no need to install the general php5 package, which + # can sometimes install apache as a requirement. + php5-fpm + php5-cli + + # Common and dev packages for php + php5-common + php5-dev + + # Extra PHP modules that we find useful + php5-memcache + php5-imagick + php5-mcrypt + php5-mysql + php5-imap + php5-curl + php-pear + php5-gd + mod-pagespeed-stable + + # Apache is installed as the default web server + apache2-mpm-worker + libapache2-mod-fastcgi + apache2-dev + + # memcached is made available for object caching + memcached + + # mysql is the default database + mysql-server + + # other packages that come in handy + imagemagick + subversion + git-core + zip + unzip + ngrep + curl + make + vim + colordiff + postfix + tree + + # Req'd for i18n tools + gettext + + # Req'd for Webgrind + graphviz + + # dos2unix + # Allows conversion of DOS style line endings to something we'll have less + # trouble with in Linux. + dos2unix + + # nodejs for use by grunt + g++ + nodejs + + # NFS + nfs-common + portmap ) echo "Check for apt packages to install..." From 2fd9191b998fee5dd391a3ab97413e9ac51964c6 Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sat, 16 Aug 2014 19:17:29 +0900 Subject: [PATCH 11/30] All these changes are from the latest VVV. --- provision/provision.sh | 644 ++++++++++++++++++++++------------------- 1 file changed, 342 insertions(+), 302 deletions(-) diff --git a/provision/provision.sh b/provision/provision.sh index e240242..6797ef0 100755 --- a/provision/provision.sh +++ b/provision/provision.sh @@ -108,16 +108,16 @@ echo "Check for apt packages to install..." # Loop through each of our packages that should be installed on the system. If # not yet installed, it should be added to the array of packages to install. for pkg in "${apt_package_check_list[@]}"; do - package_version="$(dpkg -s $pkg 2>&1 | grep 'Version:' | cut -d " " -f 2)" - if [[ -n "${package_version}" ]]; then - space_count="$(expr 20 - "${#pkg}")" #11 - pack_space_count="$(expr 30 - "${#package_version}")" - real_space="$(expr ${space_count} + ${pack_space_count} + ${#package_version})" - printf " * $pkg %${real_space}.${#package_version}s ${package_version}\n" - else - echo " *" $pkg [not installed] - apt_package_install_list+=($pkg) - fi + package_version="$(dpkg -s $pkg 2>&1 | grep 'Version:' | cut -d " " -f 2)" + if [[ -n "${package_version}" ]]; then + space_count="$(expr 20 - "${#pkg}")" #11 + pack_space_count="$(expr 30 - "${#package_version}")" + real_space="$(expr ${space_count} + ${pack_space_count} + ${#package_version})" + printf " * $pkg %${real_space}.${#package_version}s ${package_version}\n" + else + echo " *" $pkg [not installed] + apt_package_install_list+=($pkg) + fi done # MySQL @@ -142,14 +142,14 @@ ln -sf /srv/config/apt-source-append.list /etc/apt/sources.list.d/vvv-sources.li echo "Linked custom apt sources" if [[ $ping_result == *bytes?from* ]]; then - # If there are any packages to be installed in the apt_package_list array, - # then we'll run `apt-get update` and then `apt-get install` to proceed. - if [[ ${#apt_package_install_list[@]} = 0 ]]; then - echo -e "No apt packages to install.\n" - else - # Before running `apt-get update`, we should add the public keys for - # the packages that we are installing from non standard sources via - # our appended apt source.list + # If there are any packages to be installed in the apt_package_list array, + # then we'll run `apt-get update` and then `apt-get install` to proceed. + if [[ ${#apt_package_install_list[@]} = 0 ]]; then + echo -e "No apt packages to install.\n" + else + # Before running `apt-get update`, we should add the public keys for + # the packages that we are installing from non standard sources via + # our appended apt source.list # Launchpad Subversion key EAA903E3A2F4C039 gpg -q --keyserver keyserver.ubuntu.com --recv-key EAA903E3A2F4C039 @@ -163,100 +163,86 @@ if [[ $ping_result == *bytes?from* ]]; then gpg -q --keyserver keyserver.ubuntu.com --recv-key A1715D88E1DF1F24 gpg -q -a --export A1715D88E1DF1F24 | apt-key add - - # Launchpad nodejs key C7917B12 - gpg -q --keyserver keyserver.ubuntu.com --recv-key C7917B12 - gpg -q -a --export C7917B12 | apt-key add - - - # update all of the package references before installing anything - echo "Running apt-get update..." - apt-get update --assume-yes - - # install required packages - echo "Installing apt-get packages..." - apt-get install --assume-yes ${apt_package_install_list[@]} - - # Clean up apt caches - apt-get clean - fi - - # ack-grep - # - # Install ack-rep directory from the version hosted at beyondgrep.com as the - # PPAs for Ubuntu Precise are not available yet. - if [[ -f /usr/bin/ack ]]; then - echo "ack-grep already installed" - else - echo "Installing ack-grep as ack" - curl -s http://beyondgrep.com/ack-2.04-single-file > /usr/bin/ack && chmod +x /usr/bin/ack - fi - - # COMPOSER - # - # Install or Update Composer based on current state. Updates are direct from - # master branch on GitHub repository. - if [[ -n "$(composer --version | grep -q 'Composer version')" ]]; then - echo "Updating Composer..." - composer self-update - else - echo "Installing Composer..." - curl -sS https://getcomposer.org/installer | php - chmod +x composer.phar - mv composer.phar /usr/local/bin/composer - fi - - # PHPUnit - # - # Check that PHPUnit, Mockery, and Hamcrest are all successfully installed. - # If not, then Composer should be given another shot at it. Versions for - # these packages are controlled in `/srv/config/phpunit-composer.json`. - if [[ ! -d /usr/local/src/vvv-phpunit ]]; then - echo "Installing PHPUnit, Hamcrest and Mockery..." - mkdir -p /usr/local/src/vvv-phpunit - cp /srv/config/phpunit-composer.json /usr/local/src/vvv-phpunit/composer.json - sh -c "cd /usr/local/src/vvv-phpunit && composer install" - else - cd /usr/local/src/vvv-phpunit - if [[ -n "$(composer show -i | grep -q 'mockery')" ]]; then - echo "Mockery installed" - else - vvvphpunit_update=1 - fi - if [[ -n "$(composer show -i | grep -q 'phpunit')" ]]; then - echo "PHPUnit installed" - else - vvvphpunit_update=1 - fi - if [[ -n "$(composer show -i | grep -q 'hamcrest')" ]]; then - echo "Hamcrest installed" - else - vvvphpunit_update=1 - fi - cd ~/ - fi - - if [[ "$vvvphpunit_update" = 1 ]]; then - echo "Update PHPUnit, Hamcrest and Mockery..." - cp /srv/config/phpunit-composer.json /usr/local/src/vvv-phpunit/composer.json - sh -c "cd /usr/local/src/vvv-phpunit && composer update" - fi - - # Grunt - # - # Install or Update Grunt based on gurrent state. Updates are direct - # from NPM - if [[ "$(grunt --version)" ]]; then - echo "Updating Grunt CLI" - npm update -g grunt-cli &>/dev/null - npm update -g grunt-sass &>/dev/null - npm update -g grunt-cssjanus &>/dev/null - else - echo "Installing Grunt CLI" - npm install -g grunt-cli &>/dev/null - npm install -g grunt-sass &>/dev/null - npm install -g grunt-cssjanus &>/dev/null - fi + # Launchpad nodejs key C7917B12 + gpg -q --keyserver keyserver.ubuntu.com --recv-key C7917B12 + gpg -q -a --export C7917B12 | apt-key add - + + # Google PageSpeed key A040830F7FAC5991 + gpg -q --keyserver keyserver.ubuntu.com --recv-key A040830F7FAC5991 + gpg -q -a --export A040830F7FAC5991 | apt-key add - + + # update all of the package references before installing anything + echo "Running apt-get update..." + apt-get update --assume-yes + + # install required packages + echo "Installing apt-get packages..." + apt-get install --assume-yes ${apt_package_install_list[@]} + + # Clean up apt caches + apt-get clean + fi + + # Make sure we have the latest npm version + npm install -g npm + + # xdebug + # + # XDebug 2.2.3 is provided with the Ubuntu install by default. The PECL + # installation allows us to use a later version. Not specifying a version + # will load the latest stable. + pecl install xdebug + + # ack-grep + # + # Install ack-rep directory from the version hosted at beyondgrep.com as the + # PPAs for Ubuntu Precise are not available yet. + if [[ -f /usr/bin/ack ]]; then + echo "ack-grep already installed" + else + echo "Installing ack-grep as ack" + curl -s http://beyondgrep.com/ack-2.04-single-file > /usr/bin/ack && chmod +x /usr/bin/ack + fi + + # COMPOSER + # + # Install or Update Composer based on current state. Updates are direct from + # master branch on GitHub repository. + if [[ -n "$(composer --version | grep -q 'Composer version')" ]]; then + echo "Updating Composer..." + COMPOSER_HOME=/usr/local/src/composer composer self-update + COMPOSER_HOME=/usr/local/src/composer composer global update + else + echo "Installing Composer..." + curl -sS https://getcomposer.org/installer | php + chmod +x composer.phar + mv composer.phar /usr/local/bin/composer + + COMPOSER_HOME=/usr/local/src/composer composer -q global require --no-update phpunit/phpunit:4.0.* + COMPOSER_HOME=/usr/local/src/composer composer -q global require --no-update phpunit/php-invoker:1.1.* + COMPOSER_HOME=/usr/local/src/composer composer -q global require --no-update mockery/mockery:0.8.* + COMPOSER_HOME=/usr/local/src/composer composer -q global require --no-update d11wtq/boris:v1.0.2 + COMPOSER_HOME=/usr/local/src/composer composer -q global config bin-dir /usr/local/bin + COMPOSER_HOME=/usr/local/src/composer composer global update + fi + + # Grunt + # + # Install or Update Grunt based on current state. Updates are direct + # from NPM + if [[ "$(grunt --version)" ]]; then + echo "Updating Grunt CLI" + npm update -g grunt-cli &>/dev/null + npm update -g grunt-sass &>/dev/null + npm update -g grunt-cssjanus &>/dev/null + else + echo "Installing Grunt CLI" + npm install -g grunt-cli &>/dev/null + npm install -g grunt-sass &>/dev/null + npm install -g grunt-cssjanus &>/dev/null + fi else - echo -e "\nNo network connection available, skipping package installation" + echo -e "\nNo network connection available, skipping package installation" fi #echo -e "\nSetup configuration files..." @@ -297,15 +283,21 @@ a2enmod actions fastcgi alias a2enmod rewrite # Copy php-fpm configuration from local +cp /srv/config/php5-fpm-config/php5-fpm.conf /etc/php5/fpm/php5-fpm.conf cp /srv/config/php5-fpm-config/www.conf /etc/php5/fpm/pool.d/www.conf cp /srv/config/php5-fpm-config/php-custom.ini /etc/php5/fpm/conf.d/php-custom.ini -cp /srv/config/php5-fpm-config/xdebug.ini /etc/php5/fpm/conf.d/xdebug.ini -cp /srv/config/php5-fpm-config/apc.ini /etc/php5/fpm/conf.d/apc.ini +cp /srv/config/php5-fpm-config/opcache.ini /etc/php5/fpm/conf.d/opcache.ini +cp /srv/config/php5-fpm-config/xdebug.ini /etc/php5/mods-available/xdebug.ini +# Find the path to Xdebug and prepend it to xdebug.ini +XDEBUG_PATH=$( find /usr -name 'xdebug.so' | head -1 ) +sed -i "1izend_extension=\"$XDEBUG_PATH\"" /etc/php5/mods-available/xdebug.ini + +echo " * /srv/config/php5-fpm-config/php5-fpm.conf -> /etc/php5/fpm/php5-fpm.conf" echo " * /srv/config/php5-fpm-config/www.conf -> /etc/php5/fpm/pool.d/www.conf" echo " * /srv/config/php5-fpm-config/php-custom.ini -> /etc/php5/fpm/conf.d/php-custom.ini" -echo " * /srv/config/php5-fpm-config/xdebug.ini -> /etc/php5/fpm/conf.d/xdebug.ini" -echo " * /srv/config/php5-fpm-config/apc.ini -> /etc/php5/fpm/conf.d/apc.ini" +echo " * /srv/config/php5-fpm-config/opcache.ini -> /etc/php5/fpm/conf.d/opcache.ini" +echo " * /srv/config/php5-fpm-config/xdebug.ini -> /etc/php5/mods-available/xdebug.ini" # Copy memcached configuration from local cp /srv/config/memcached-config/memcached.conf /etc/memcached.conf @@ -317,11 +309,11 @@ cp /srv/config/bash_profile /home/vagrant/.bash_profile cp /srv/config/bash_aliases /home/vagrant/.bash_aliases cp /srv/config/vimrc /home/vagrant/.vimrc if [[ ! -d /home/vagrant/.subversion ]]; then - mkdir /home/vagrant/.subversion + mkdir /home/vagrant/.subversion fi cp /srv/config/subversion-servers /home/vagrant/.subversion/servers if [[ ! -d /home/vagrant/bin ]]; then - mkdir /home/vagrant/bin + mkdir /home/vagrant/bin fi rsync -rvzh --delete /srv/config/homebin/ /home/vagrant/bin/ @@ -331,6 +323,12 @@ echo " * /srv/config/vimrc -> /home/vagrant/.vimrc" echo " * /srv/config/subversion-servers -> /home/vagrant/.subversion/servers" echo " * /srv/config/homebin -> /home/vagrant/bin" +# If a bash_prompt file exists in the VVV config/ directory, copy to the VM. +if [[ -f /srv/config/bash_prompt ]]; then + cp /srv/config/bash_prompt /home/vagrant/.bash_prompt + echo " * /srv/config/bash_prompt -> /home/vagrant/.bash_prompt" +fi + # RESTART SERVICES # # Make sure the services we expect to be running are running. @@ -345,201 +343,243 @@ service php5-fpm restart # If MySQL is installed, go through the various imports and service tasks. exists_mysql="$(service mysql status)" if [[ "mysql: unrecognized service" != "${exists_mysql}" ]]; then - echo -e "\nSetup MySQL configuration file links..." - - # Copy mysql configuration from local - cp /srv/config/mysql-config/my.cnf /etc/mysql/my.cnf - cp /srv/config/mysql-config/root-my.cnf /home/vagrant/.my.cnf - - echo " * /srv/config/mysql-config/my.cnf -> /etc/mysql/my.cnf" - echo " * /srv/config/mysql-config/root-my.cnf -> /home/vagrant/.my.cnf" - - # MySQL gives us an error if we restart a non running service, which - # happens after a `vagrant halt`. Check to see if it's running before - # deciding whether to start or restart. - if [[ "mysql stop/waiting" == "${exists_mysql}" ]]; then - echo "service mysql start" - service mysql start - else - echo "service mysql restart" - service mysql restart - fi - - # IMPORT SQL - # - # Create the databases (unique to system) that will be imported with - # the mysqldump files located in database/backups/ - if [[ -f /srv/database/init-custom.sql ]]; then - mysql -u root -proot < /srv/database/init-custom.sql - echo -e "\nInitial custom MySQL scripting..." - else - echo -e "\nNo custom MySQL scripting found in database/init-custom.sql, skipping..." - fi - - # Setup MySQL by importing an init file that creates necessary - # users and databases that our vagrant setup relies on. - mysql -u root -proot < /srv/database/init.sql - echo "Initial MySQL prep..." - - # Process each mysqldump SQL file in database/backups to import - # an initial data set for MySQL. - /srv/database/import-sql.sh + echo -e "\nSetup MySQL configuration file links..." + + # Copy mysql configuration from local + cp /srv/config/mysql-config/my.cnf /etc/mysql/my.cnf + cp /srv/config/mysql-config/root-my.cnf /home/vagrant/.my.cnf + + echo " * /srv/config/mysql-config/my.cnf -> /etc/mysql/my.cnf" + echo " * /srv/config/mysql-config/root-my.cnf -> /home/vagrant/.my.cnf" + + # MySQL gives us an error if we restart a non running service, which + # happens after a `vagrant halt`. Check to see if it's running before + # deciding whether to start or restart. + if [[ "mysql stop/waiting" == "${exists_mysql}" ]]; then + echo "service mysql start" + service mysql start + else + echo "service mysql restart" + service mysql restart + fi + + # IMPORT SQL + # + # Create the databases (unique to system) that will be imported with + # the mysqldump files located in database/backups/ + if [[ -f /srv/database/init-custom.sql ]]; then + mysql -u root -proot < /srv/database/init-custom.sql + echo -e "\nInitial custom MySQL scripting..." + else + echo -e "\nNo custom MySQL scripting found in database/init-custom.sql, skipping..." + fi + + # Setup MySQL by importing an init file that creates necessary + # users and databases that our vagrant setup relies on. + mysql -u root -proot < /srv/database/init.sql + echo "Initial MySQL prep..." + + # Process each mysqldump SQL file in database/backups to import + # an initial data set for MySQL. + /srv/database/import-sql.sh else - echo -e "\nMySQL is not installed. No databases imported." + echo -e "\nMySQL is not installed. No databases imported." +fi + +# Run wp-cli as vagrant user +if (( $EUID == 0 )); then + wp() { sudo -EH -u vagrant -- wp "$@"; } fi if [[ $ping_result == *bytes?from* ]]; then - # WP-CLI Install - if [[ ! -d /srv/www/wp-cli ]]; then - echo -e "\nDownloading wp-cli, see http://wp-cli.org" - git clone git://github.com/wp-cli/wp-cli.git /srv/www/wp-cli - cd /srv/www/wp-cli - composer install - else - echo -e "\nUpdating wp-cli..." - cd /srv/www/wp-cli - git pull --rebase origin master - composer update - fi - # Link `wp` to the `/usr/local/bin` directory - ln -sf /srv/www/wp-cli/bin/wp /usr/local/bin/wp - - # Download and extract phpMemcachedAdmin to provide a dashboard view and - # admin interface to the goings on of memcached when running - if [[ ! -d /srv/www/default/memcached-admin ]]; then - echo -e "\nDownloading phpMemcachedAdmin, see https://code.google.com/p/phpmemcacheadmin/" - cd /srv/www/default - wget -q -O phpmemcachedadmin.tar.gz 'https://phpmemcacheadmin.googlecode.com/files/phpMemcachedAdmin-1.2.2-r262.tar.gz' - mkdir memcached-admin - tar -xf phpmemcachedadmin.tar.gz --directory memcached-admin - rm phpmemcachedadmin.tar.gz - else - echo "phpMemcachedAdmin already installed." - fi - - # Webgrind install (for viewing callgrind/cachegrind files produced by - # xdebug profiler) - if [[ ! -d /srv/www/default/webgrind ]]; then - echo -e "\nDownloading webgrind, see https://github.com/jokkedk/webgrind" - git clone git://github.com/jokkedk/webgrind.git /srv/www/default/webgrind - else - echo -e "\nUpdating webgrind..." - cd /srv/www/default/webgrind - git pull --rebase origin master - fi - - # PHP_CodeSniffer (for running WordPress-Coding-Standards) - if [[ ! -d /srv/www/phpcs ]]; then - echo -e "\nDownloading PHP_CodeSniffer (phpcs), see https://github.com/squizlabs/PHP_CodeSniffer" - git clone git://github.com/squizlabs/PHP_CodeSniffer.git /srv/www/phpcs - else - echo -e "\nUpdating PHP_CodeSniffer (phpcs)..." - cd /srv/www/phpcs - git pull --rebase origin master - fi - - # Sniffs WordPress Coding Standards - if [[ ! -d /srv/www/phpcs/CodeSniffer/Standards/WordPress ]]; then - echo -e "\nDownloading WordPress-Coding-Standards, snifs for PHP_CodeSniffer, see https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards" - git clone git://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git /srv/www/phpcs/CodeSniffer/Standards/WordPress - else - echo -e "\nUpdating PHP_CodeSniffer..." - cd /srv/www/phpcs/CodeSniffer/Standards/WordPress - git pull --rebase origin master - fi - - # Install and configure the latest stable version of WordPress - if [[ ! -d /srv/www/wordpress-default ]]; then - echo "Downloading WordPress Stable, see http://wordpress.org/" - cd /srv/www/ - curl -O http://wordpress.org/latest.tar.gz - tar -xvf latest.tar.gz - mv wordpress wordpress-default - rm latest.tar.gz - cd /srv/www/wordpress-default - echo "Configuring WordPress Stable..." - wp core config --allow-root --dbname=wordpress_default --dbuser=wp --dbpass=wp --quiet --extra-php <&1 ); + if [[ $svn_test == *"svn upgrade"* ]]; then + # If the wordpress-develop svn repo needed an upgrade, they probably all need it + for repo in $(find /srv/www -maxdepth 5 -type d -name '.svn'); do + svn upgrade "${repo/%\.svn/}" + done + fi; + + # Checkout, install and configure WordPress trunk via core.svn + if [[ ! -d /srv/www/wordpress-trunk ]]; then + echo "Checking out WordPress trunk from core.svn, see http://core.svn.wordpress.org/trunk" + svn checkout http://core.svn.wordpress.org/trunk/ /srv/www/wordpress-trunk + cd /srv/www/wordpress-trunk + echo "Configuring WordPress trunk..." + wp core config --dbname=wordpress_trunk --dbuser=wp --dbpass=wp --quiet --extra-php </dev/null - else - echo "Updating WordPress develop..." - cd /srv/www/wordpress-develop/ - svn up - npm install &>/dev/null - fi - - if [[ ! -d /srv/www/wordpress-develop/build ]]; then - echo "Initializing grunt in WordPress develop... This may take a few moments." - cd /srv/www/wordpress-develop/ - grunt - fi - - # Download phpMyAdmin - if [[ ! -d /srv/www/default/database-admin ]]; then - echo "Downloading phpMyAdmin 4.0.10..." - cd /srv/www/default - wget -q -O phpmyadmin.tar.gz 'http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/4.0.10/phpMyAdmin-4.0.10-all-languages.tar.gz/download' - tar -xf phpmyadmin.tar.gz - mv phpMyAdmin-4.0.10-all-languages database-admin - rm phpmyadmin.tar.gz - else - echo "PHPMyAdmin already installed." - fi - cp /srv/config/phpmyadmin-config/config.inc.php /srv/www/default/database-admin/ + wp core install --url=src.wordpress-develop.dev --quiet --title="WordPress Develop" --admin_name=admin --admin_email="admin@local.dev" --admin_password="password" + cp /srv/config/wordpress-config/wp-tests-config.php /srv/www/wordpress-develop/ + cd /srv/www/wordpress-develop/ + npm install &>/dev/null + else + echo "Updating WordPress develop..." + cd /srv/www/wordpress-develop/ + if [[ -e .svn ]]; then + svn up + else + if [[ $(git rev-parse --abbrev-ref HEAD) == 'master' ]]; then + git pull --no-edit git://develop.git.wordpress.org/ master + else + echo "Skip auto git pull on develop.git.wordpress.org since not on master branch" + fi + fi + npm install &>/dev/null + fi + + if [[ ! -d /srv/www/wordpress-develop/build ]]; then + echo "Initializing grunt in WordPress develop... This may take a few moments." + cd /srv/www/wordpress-develop/ + grunt + fi + + # Download phpMyAdmin + if [[ ! -d /srv/www/default/database-admin ]]; then + echo "Downloading phpMyAdmin 4.1.14..." + cd /srv/www/default + wget -q -O phpmyadmin.tar.gz 'http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/4.1.14/phpMyAdmin-4.1.14-all-languages.tar.gz/download' + tar -xf phpmyadmin.tar.gz + mv phpMyAdmin-4.1.14-all-languages database-admin + rm phpmyadmin.tar.gz + else + echo "PHPMyAdmin already installed." + fi + cp /srv/config/phpmyadmin-config/config.inc.php /srv/www/default/database-admin/ else - echo -e "\nNo network available, skipping network installations" + echo -e "\nNo network available, skipping network installations" fi # Look for site setup scripts for SITE_CONFIG_FILE in $(find /srv/www -maxdepth 5 -name 'vvv-init.sh'); do - DIR="$(dirname $SITE_CONFIG_FILE)" - ( - cd $DIR - bash vvv-init.sh - ) + DIR="$(dirname $SITE_CONFIG_FILE)" + ( + cd $DIR + source vvv-init.sh + ) done # RESTART SERVICES AGAIN @@ -559,22 +599,22 @@ mv /tmp/hosts /etc/hosts echo "Adding domains to the virtual machine's /etc/hosts file..." find /srv/www/ -maxdepth 5 -name 'vvv-hosts' | \ while read hostfile; do - while IFS='' read -r line || [ -n "$line" ]; do - if [[ "#" != ${line:0:1} ]]; then - if [[ -z "$(grep -q "^127.0.0.1 $line$" /etc/hosts)" ]]; then - echo "127.0.0.1 $line # vvv-auto" >> /etc/hosts - echo " * Added $line from $hostfile" - fi - fi - done < $hostfile + while IFS='' read -r line || [ -n "$line" ]; do + if [[ "#" != ${line:0:1} ]]; then + if [[ -z "$(grep -q "^127.0.0.1 $line$" /etc/hosts)" ]]; then + echo "127.0.0.1 $line # vvv-auto" >> /etc/hosts + echo " * Added $line from $hostfile" + fi + fi + done < $hostfile done end_seconds="$(date +%s)" echo "-----------------------------" echo "Provisioning complete in "$(expr $end_seconds - $start_seconds)" seconds" if [[ $ping_result == *bytes?from* ]]; then - echo "External network connection established, packages up to date." + echo "External network connection established, packages up to date." else - echo "No external network available. Package installation and maintenance skipped." + echo "No external network available. Package installation and maintenance skipped." fi echo "For further setup instructions, visit http://vvv.dev" From 76948c843e2577d830ed858f0b1f9ae66692ee5c Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sat, 16 Aug 2014 19:17:53 +0900 Subject: [PATCH 12/30] Changes from latest VVV. --- www/default/index.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/www/default/index.php b/www/default/index.php index 980d35d..579554b 100644 --- a/www/default/index.php +++ b/www/default/index.php @@ -20,18 +20,19 @@ - \ No newline at end of file + From ff84489faf661fb3cb6364fc6e2134a16cc7ea56 Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sun, 17 Aug 2014 15:29:58 +0900 Subject: [PATCH 13/30] Added Sexy Bash Prompt --- config/bash_profile | 3 + config/bash_prompt | 246 +++++++++++++++++++++++++++++++++++++++++ provision/provision.sh | 2 + 3 files changed, 251 insertions(+) create mode 100644 config/bash_prompt diff --git a/config/bash_profile b/config/bash_profile index 88c4fb2..7c4266c 100644 --- a/config/bash_profile +++ b/config/bash_profile @@ -13,6 +13,9 @@ if [ -n "$BASH_VERSION" ]; then fi fi +# Prompt +[[ -f "$HOME/.bash_prompt" ]] && source "$HOME/.bash_prompt" + # set PATH so it includes user's private bin if it exists if [ -d "$HOME/bin" ] ; then PATH="$HOME/bin:$PATH" diff --git a/config/bash_prompt b/config/bash_prompt new file mode 100644 index 0000000..8531e18 --- /dev/null +++ b/config/bash_prompt @@ -0,0 +1,246 @@ +#!/usr/bin/env bash +# Sexy bash prompt by twolfson +# https://github.com/twolfson/sexy-bash-prompt +# Forked from gf3, https://gist.github.com/gf3/306785 + +# If we are on a colored terminal +if tput setaf 1 &> /dev/null; then + # Reset the shell from our `if` check + tput sgr0 &> /dev/null + + # If you would like to customize your colors, use + # # Attribution: http://linuxtidbits.wordpress.com/2008/08/11/output-color-on-bash-scripts/ + # for i in $(seq 0 $(tput colors)); do + # echo " $(tput setaf $i)Text$(tput sgr0) $(tput bold)$(tput setaf $i)Text$(tput sgr0) $(tput sgr 0 1)$(tput setaf $i)Text$(tput sgr0) \$(tput setaf $i)" + # done + + # Save common color actions + prompt_bold="$(tput bold)" + prompt_reset="$(tput sgr0)" + + # If the terminal supports at least 256 colors, write out our 256 color based set + if [[ "$(tput colors)" -ge 256 ]] &> /dev/null; then + prompt_user_color="$prompt_bold$(tput setaf 27)" # BOLD BLUE + prompt_preposition_color="$prompt_bold$(tput setaf 7)" # BOLD WHITE + prompt_device_color="$prompt_bold$(tput setaf 39)" # BOLD CYAN + prompt_dir_color="$prompt_bold$(tput setaf 76)" # BOLD GREEN + prompt_git_status_color="$prompt_bold$(tput setaf 154)" # BOLD YELLOW + prompt_git_progress_color="$prompt_bold$(tput setaf 9)" # BOLD RED + else + # Otherwise, use colors from our set of 8 + prompt_user_color="$prompt_bold$(tput setaf 4)" # BOLD BLUE + prompt_preposition_color="$prompt_bold$(tput setaf 7)" # BOLD WHITE + prompt_device_color="$prompt_bold$(tput setaf 6)" # BOLD CYAN + prompt_dir_color="$prompt_bold$(tput setaf 2)" # BOLD GREEN + prompt_git_status_color="$prompt_bold$(tput setaf 3)" # BOLD YELLOW + prompt_git_progress_color="$prompt_bold$(tput setaf 1)" # BOLD RED + fi + + prompt_symbol_color="$prompt_bold" # BOLD + +else +# Otherwise, use ANSI escape sequences for coloring + # If you would like to customize your colors, use + # DEV: 30-39 lines up 0-9 from `tput` + # for i in $(seq 0 109); do + # echo -n -e "\033[1;${i}mText$(tput sgr0) " + # echo "\033[1;${i}m" + # done + + prompt_reset="\033[m" + prompt_user_color="\033[1;34m" # BLUE + prompt_preposition_color="\033[1;37m" # WHITE + prompt_device_color="\033[1;36m" # CYAN + prompt_dir_color="\033[1;32m" # GREEN + prompt_git_status_color="\033[1;33m" # YELLOW + prompt_git_progress_color="\033[1;31m" # RED + prompt_symbol_color="" # NORMAL +fi + +# Apply any color overrides that have been set in the environment +if [[ -n "$PROMPT_USER_COLOR" ]]; then prompt_user_color="$PROMPT_USER_COLOR"; fi +if [[ -n "$PROMPT_PREPOSITION_COLOR" ]]; then prompt_preposition_color="$PROMPT_PREPOSITION_COLOR"; fi +if [[ -n "$PROMPT_DEVICE_COLOR" ]]; then prompt_device_color="$PROMPT_DEVICE_COLOR"; fi +if [[ -n "$PROMPT_DIR_COLOR" ]]; then prompt_dir_color="$PROMPT_DIR_COLOR"; fi +if [[ -n "$PROMPT_GIT_STATUS_COLOR" ]]; then prompt_git_status_color="$PROMPT_GIT_STATUS_COLOR"; fi +if [[ -n "$PROMPT_GIT_PROGRESS_COLOR" ]]; then prompt_git_progress_color="$PROMPT_GIT_PROGRESS_COLOR"; fi +if [[ -n "$PROMPT_SYMBOL_COLOR" ]]; then prompt_symbol_color="$PROMPT_SYMBOL_COLOR"; fi + +function get_git_branch() { + # On branches, this will return the branch name + # On non-branches, (no branch) + ref="$(git symbolic-ref HEAD 2> /dev/null | sed -e 's/refs\/heads\///')" + if [[ "$ref" != "" ]]; then + echo "$ref" + else + echo "(no branch)" + fi +} + +function get_git_progress() { + # Detect in-progress actions (e.g. merge, rebase) + # https://github.com/git/git/blob/v1.9-rc2/wt-status.c#L1199-L1241 + git_dir="$(git rev-parse --git-dir)" + + # git merge + if [[ -f "$git_dir/MERGE_HEAD" ]]; then + echo " [merge]" + elif [[ -d "$git_dir/rebase-apply" ]]; then + # git am + if [[ -f "$git_dir/rebase-apply/applying" ]]; then + echo " [am]" + # git rebase + else + echo " [rebase]" + fi + elif [[ -d "$git_dir/rebase-merge" ]]; then + # git rebase --interactive/--merge + echo " [rebase]" + elif [[ -f "$git_dir/CHERRY_PICK_HEAD" ]]; then + # git cherry-pick + echo " [cherry-pick]" + fi + if [[ -f "$git_dir/BISECT_LOG" ]]; then + # git bisect + echo " [bisect]" + fi + if [[ -f "$git_dir/REVERT_HEAD" ]]; then + # git revert --no-commit + echo " [revert]" + fi +} + +is_branch1_behind_branch2 () { + # $ git log origin/master..master -1 + # commit 4a633f715caf26f6e9495198f89bba20f3402a32 + # Author: Todd Wolfson + # Date: Sun Jul 7 22:12:17 2013 -0700 + # + # Unsynced commit + + # Find the first log (if any) that is in branch1 but not branch2 + first_log="$(git log $1..$2 -1 2> /dev/null)" + + # Exit with 0 if there is a first log, 1 if there is not + [[ -n "$first_log" ]] +} + +branch_exists () { + # List remote branches | # Find our branch and exit with 0 or 1 if found/not found + git branch --remote 2> /dev/null | grep --quiet "$1" +} + +parse_git_ahead () { + # Grab the local and remote branch + branch="$(get_git_branch)" + remote_branch="origin/$branch" + + # $ git log origin/master..master + # commit 4a633f715caf26f6e9495198f89bba20f3402a32 + # Author: Todd Wolfson + # Date: Sun Jul 7 22:12:17 2013 -0700 + # + # Unsynced commit + + # If the remote branch is behind the local branch + # or it has not been merged into origin (remote branch doesn't exist) + if (is_branch1_behind_branch2 "$remote_branch" "$branch" || + ! branch_exists "$remote_branch"); then + # echo our character + echo 1 + fi +} + +parse_git_behind () { + # Grab the branch + branch="$(get_git_branch)" + remote_branch="origin/$branch" + + # $ git log master..origin/master + # commit 4a633f715caf26f6e9495198f89bba20f3402a32 + # Author: Todd Wolfson + # Date: Sun Jul 7 22:12:17 2013 -0700 + # + # Unsynced commit + + # If the local branch is behind the remote branch + if is_branch1_behind_branch2 "$branch" "$remote_branch"; then + # echo our character + echo 1 + fi +} + +function parse_git_dirty() { + # If the git status has *any* changes (e.g. dirty), echo our character + if [[ -n "$(git status --porcelain 2> /dev/null)" ]]; then + echo 1 + fi +} + +function is_on_git() { + git rev-parse 2> /dev/null +} + +function get_git_status() { + # Grab the git dirty and git behind + dirty_branch="$(parse_git_dirty)" + branch_ahead="$(parse_git_ahead)" + branch_behind="$(parse_git_behind)" + + # Iterate through all the cases and if it matches, then echo + if [[ "$dirty_branch" == 1 && "$branch_ahead" == 1 && "$branch_behind" == 1 ]]; then + echo "⬢" + elif [[ "$dirty_branch" == 1 && "$branch_ahead" == 1 ]]; then + echo "▲" + elif [[ "$dirty_branch" == 1 && "$branch_behind" == 1 ]]; then + echo "▼" + elif [[ "$branch_ahead" == 1 && "$branch_behind" == 1 ]]; then + echo "⬡" + elif [[ "$branch_ahead" == 1 ]]; then + echo "△" + elif [[ "$branch_behind" == 1 ]]; then + echo "▽" + elif [[ "$dirty_branch" == 1 ]]; then + echo "*" + fi +} + +get_git_info () { + # Grab the branch + branch="$(get_git_branch)" + + # If there are any branches + if [[ "$branch" != "" ]]; then + # Echo the branch + output="$branch" + + # Add on the git status + output="$output$(get_git_status)" + + # Echo our output + echo "$output" + fi +} + +# Symbol displayed at the line of every prompt +function get_prompt_symbol() { + # If we are root, display `#`. Otherwise, `$` + if [[ "$UID" == 0 ]]; then + echo "#" + else + echo "\$" + fi +} + +# Define the sexy-bash-prompt +PS1="\[$prompt_user_color\]\u\[$prompt_reset\] \ +\[$prompt_preposition_color\]at\[$prompt_reset\] \ +\[$prompt_device_color\]\h\[$prompt_reset\] \ +\[$prompt_preposition_color\]in\[$prompt_reset\] \ +\[$prompt_dir_color\]\w\[$prompt_reset\]\ +\$( is_on_git && \ + echo -n \" \[$prompt_preposition_color\]on\[$prompt_reset\] \" && \ + echo -n \"\[$prompt_git_status_color\]\$(get_git_info)\" && \ + echo -n \"\[$prompt_git_progress_color\]\$(get_git_progress)\" && \ + echo -n \"\[$prompt_preposition_color\]\")\n\[$prompt_reset\]\ +\[$prompt_symbol_color\]$(get_prompt_symbol) \[$prompt_reset\]" diff --git a/provision/provision.sh b/provision/provision.sh index 6797ef0..439b4e9 100755 --- a/provision/provision.sh +++ b/provision/provision.sh @@ -259,6 +259,7 @@ unlink /etc/php5/fpm/conf.d/xdebug.ini unlink /etc/php5/fpm/conf.d/apc.ini unlink /etc/memcached.conf unlink /home/vagrant/.bash_profile +unlink /home/vagrant/.bash_prompt unlink /home/vagrant/.bash_aliases unlink /home/vagrant/.vimrc @@ -307,6 +308,7 @@ echo " * /srv/config/memcached-config/memcached.conf -> /etc/memcached.conf" # Copy custom dotfiles and bin file for the vagrant user from local cp /srv/config/bash_profile /home/vagrant/.bash_profile cp /srv/config/bash_aliases /home/vagrant/.bash_aliases +cp /srv/config/bash_prompt /home/vagrant/.bash_prompt cp /srv/config/vimrc /home/vagrant/.vimrc if [[ ! -d /home/vagrant/.subversion ]]; then mkdir /home/vagrant/.subversion From 2e882b03503eb5f9887149dfd492413d57125e74 Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sun, 17 Aug 2014 15:32:09 +0900 Subject: [PATCH 14/30] Remove APC configs. --- config/php5-fpm-config/apc.ini | 9 --------- provision/provision.sh | 1 - 2 files changed, 10 deletions(-) delete mode 100644 config/php5-fpm-config/apc.ini diff --git a/config/php5-fpm-config/apc.ini b/config/php5-fpm-config/apc.ini deleted file mode 100644 index 7c71f91..0000000 --- a/config/php5-fpm-config/apc.ini +++ /dev/null @@ -1,9 +0,0 @@ -; apc.ini -; -; Allows us to control specific settings for APC when used with -; PHP FPM. See a full list of available settings and defaults -; here - http://www.php.net/manual/en/apc.configuration.php - -; Configure away... -[apc] -apc.shm_size = 128M \ No newline at end of file diff --git a/provision/provision.sh b/provision/provision.sh index 439b4e9..a3abf41 100755 --- a/provision/provision.sh +++ b/provision/provision.sh @@ -256,7 +256,6 @@ unlink /etc/apache2/conf.d/php5-fpm.conf unlink /etc/php5/fpm/pool.d/www.conf unlink /etc/php5/fpm/conf.d/php-custom.ini unlink /etc/php5/fpm/conf.d/xdebug.ini -unlink /etc/php5/fpm/conf.d/apc.ini unlink /etc/memcached.conf unlink /home/vagrant/.bash_profile unlink /home/vagrant/.bash_prompt From 166572c29b44142ab91e5dd48a094766fa8b0dbb Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sun, 17 Aug 2014 15:33:04 +0900 Subject: [PATCH 15/30] Update README.md --- README.md | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/README.md b/README.md index cd6e5d6..667f91d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,62 @@ +# vvv-apache-nfs-pagespeed + +I opened vvv-apache in one window and VVV in another and frankensteined together this version. I still barely know my ass from my elbow, but it all seems to work. + +### NFS configuration + +It's not too difficult to modify a vanilla VVV clone to configure mounting shares with NFS instead of the default. The performance improvement is amazing. + +#### provision.sh + +I'm not sure whether or not these packages are part of a default Ubuntu Trusty64 install, but I add them anyway. + + # NFS + nfs-common + portmap + +#### Vagrantfile + +This configuration sets the global default NFS folder UID and GID to the ID of the user on your host machine. I got it from [here](https://coderwall.com/p/3ha9dw). + + config.nfs.map_uid = Process.uid + config.nfs.map_gid = Process.gid + +I get the feeling there's more I need to do with ownership of the shares... + +I modified the share configs as follows. They work, but I had to remove `:mount_options => [ "dmode=777", "fmode=777" ]` and `:owner => "www-data"` settings from some of them because NFS doesn't support those settings. They're most likely necessary for something, but I haven't yet discovered what I broke. + + # /srv/database/ + config.vm.synced_folder "database/", "/srv/database", type: "nfs" + + if File.exists?(File.join(vagrant_dir,'database/data/mysql_upgrade_info')) then + if vagrant_version >= "1.3.0" + config.vm.synced_folder "database/data/", "/var/lib/mysql", type: "nfs" + else + config.vm.synced_folder "database/data/", "/var/lib/mysql", type: "nfs" + end + end +---- + # /srv/config/ + config.vm.synced_folder "config/", "/srv/config", type: "nfs" +---- + # /srv/log/ + config.vm.synced_folder "log/", "/srv/log", type: "nfs" +---- + # /srv/www/ + if vagrant_version >= "1.3.0" + config.vm.synced_folder "www/", "/srv/www/", type: "nfs" + else + config.vm.synced_folder "www/", "/srv/www/", type: "nfs" + end + +### PageSpeed + +I added Google's PPA to `apt-source-append.list` and `mod-pagespeed-stable` to `provision.sh`, but there are two problems: +* PageSpeed creates `/etc/apache2/conf.d` which is necessary for Apache 2.4 to install properly. So if PageSpeed isn't installed, Apache can't be installed and the rest of provisioning also goes to hell in a handbag. +* PageSpeed adds its PPA to apt-source, so after it's installed you have to comment out the one in `apt-source-append.list`. + +The rest below is from the original readme.me + # Varying Vagrant Vagrants - Apache Edition Varying Vagrant Vagrants is an evolving [Vagrant](http://vagrantup.com) configuration focused on [WordPress](http://wordpress.org) development. From 49a78d18588bfaf523e182e41c75c34f084b9cbf Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sun, 17 Aug 2014 16:13:29 +0900 Subject: [PATCH 16/30] Forgot to add these from Apache-VVV --- config/php5-fpm-config/opcache.ini | 95 ++++++++++++++++++++ config/php5-fpm-config/php5-fpm.conf | 129 +++++++++++++++++++++++++++ 2 files changed, 224 insertions(+) create mode 100644 config/php5-fpm-config/opcache.ini create mode 100644 config/php5-fpm-config/php5-fpm.conf diff --git a/config/php5-fpm-config/opcache.ini b/config/php5-fpm-config/opcache.ini new file mode 100644 index 0000000..1a674c7 --- /dev/null +++ b/config/php5-fpm-config/opcache.ini @@ -0,0 +1,95 @@ +[opcache] +; Determines if Zend OPCache is enabled +opcache.enable=1 + +; Determines if Zend OPCache is enabled for the CLI version of PHP +;opcache.enable_cli=0 + +; The OPcache shared memory storage size. +opcache.memory_consumption=128 + +; The amount of memory for interned strings in Mbytes. +;opcache.interned_strings_buffer=4 + +; The maximum number of keys (scripts) in the OPcache hash table. +; Only numbers between 200 and 100000 are allowed. +;opcache.max_accelerated_files=2000 + +; The maximum percentage of "wasted" memory until a restart is scheduled. +;opcache.max_wasted_percentage=5 + +; When this directive is enabled, the OPcache appends the current working +; directory to the script key, thus eliminating possible collisions between +; files with the same name (basename). Disabling the directive improves +; performance, but may break existing applications. +;opcache.use_cwd=1 + +; When disabled, you must reset the OPcache manually or restart the +; webserver for changes to the filesystem to take effect. +;opcache.validate_timestamps=1 + +; How often (in seconds) to check file timestamps for changes to the shared +; memory storage allocation. ("1" means validate once per second, but only +; once per request. "0" means always validate) +;opcache.revalidate_freq=2 + +; Enables or disables file search in include_path optimization +;opcache.revalidate_path=0 + +; If disabled, all PHPDoc comments are dropped from the code to reduce the +; size of the optimized code. +;opcache.save_comments=1 + +; If disabled, PHPDoc comments are not loaded from SHM, so "Doc Comments" +; may be always stored (save_comments=1), but not loaded by applications +; that don't need them anyway. +;opcache.load_comments=1 + +; If enabled, a fast shutdown sequence is used for the accelerated code +;opcache.fast_shutdown=0 + +; Allow file existence override (file_exists, etc.) performance feature. +;opcache.enable_file_override=0 + +; A bitmask, where each bit enables or disables the appropriate OPcache +; passes +;opcache.optimization_level=0xffffffff + +;opcache.inherited_hack=1 +;opcache.dups_fix=0 + +; The location of the OPcache blacklist file (wildcards allowed). +; Each OPcache blacklist file is a text file that holds the names of files +; that should not be accelerated. The file format is to add each filename +; to a new line. The filename may be a full path or just a file prefix +; (i.e., /var/www/x blacklists all the files and directories in /var/www +; that start with 'x'). Line starting with a ; are ignored (comments). +;opcache.blacklist_filename= + +; Allows exclusion of large files from being cached. By default all files +; are cached. +;opcache.max_file_size=0 + +; Check the cache checksum each N requests. +; The default value of "0" means that the checks are disabled. +;opcache.consistency_checks=0 + +; How long to wait (in seconds) for a scheduled restart to begin if the cache +; is not being accessed. +;opcache.force_restart_timeout=180 + +; OPcache error_log file name. Empty string assumes "stderr". +;opcache.error_log= + +; All OPcache errors go to the Web server log. +; By default, only fatal errors (level 0) or errors (level 1) are logged. +; You can also enable warnings (level 2), info messages (level 3) or +; debug messages (level 4). +;opcache.log_verbosity_level=1 + +; Preferred Shared Memory back-end. Leave empty and let the system decide. +;opcache.preferred_memory_model= + +; Protect the shared memory from unexpected writing during script execution. +; Useful for internal debugging only. +;opcache.protect_memory=0 diff --git a/config/php5-fpm-config/php5-fpm.conf b/config/php5-fpm-config/php5-fpm.conf new file mode 100644 index 0000000..b453130 --- /dev/null +++ b/config/php5-fpm-config/php5-fpm.conf @@ -0,0 +1,129 @@ +;;;;;;;;;;;;;;;;;;;;; +; FPM Configuration ; +;;;;;;;;;;;;;;;;;;;;; + +; All relative paths in this configuration file are relative to PHP's install +; prefix (/usr). This prefix can be dynamically changed by using the +; '-p' argument from the command line. + +; Include one or more files. If glob(3) exists, it is used to include a bunch of +; files from a glob(3) pattern. This directive can be used everywhere in the +; file. +; Relative path can also be used. They will be prefixed by: +; - the global prefix if it's been set (-p argument) +; - /usr otherwise +;include=/etc/php5/fpm/*.conf + +;;;;;;;;;;;;;;;;;; +; Global Options ; +;;;;;;;;;;;;;;;;;; + +[global] +; Pid file +; Note: the default prefix is /var +; Default Value: none +pid = /var/run/php5-fpm.pid + +; Error log file +; If it's set to "syslog", log is sent to syslogd instead of being written +; in a local file. +; Note: the default prefix is /var +; Default Value: log/php-fpm.log +error_log = /var/log/php5-fpm.log + +; syslog_facility is used to specify what type of program is logging the +; message. This lets syslogd specify that messages from different facilities +; will be handled differently. +; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON) +; Default Value: daemon +;syslog.facility = daemon + +; syslog_ident is prepended to every message. If you have multiple FPM +; instances running on the same server, you can change the default value +; which must suit common needs. +; Default Value: php-fpm +;syslog.ident = php-fpm + +; Log level +; Possible Values: alert, error, warning, notice, debug +; Default Value: notice +;log_level = notice + +; If this number of child processes exit with SIGSEGV or SIGBUS within the time +; interval set by emergency_restart_interval then FPM will restart. A value +; of '0' means 'Off'. +; Default Value: 0 +;emergency_restart_threshold = 0 + +; Interval of time used by emergency_restart_interval to determine when +; a graceful restart will be initiated. This can be useful to work around +; accidental corruptions in an accelerator's shared memory. +; Available Units: s(econds), m(inutes), h(ours), or d(ays) +; Default Unit: seconds +; Default Value: 0 +;emergency_restart_interval = 0 + +; Time limit for child processes to wait for a reaction on signals from master. +; Available units: s(econds), m(inutes), h(ours), or d(ays) +; Default Unit: seconds +; Default Value: 0 +;process_control_timeout = 0 + +; The maximum number of processes FPM will fork. This has been design to control +; the global number of processes when using dynamic PM within a lot of pools. +; Use it with caution. +; Note: A value of 0 indicates no limit +; Default Value: 0 +; process.max = 128 + +; Specify the nice(2) priority to apply to the master process (only if set) +; The value can vary from -19 (highest priority) to 20 (lower priority) +; Note: - It will only work if the FPM master process is launched as root +; - The pool process will inherit the master process priority +; unless it specified otherwise +; Default Value: no set +; process.priority = -19 + +; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging. +; Default Value: yes +;daemonize = yes + +; Set open file descriptor rlimit for the master process. +; Default Value: system defined value +;rlimit_files = 1024 + +; Set max core size rlimit for the master process. +; Possible Values: 'unlimited' or an integer greater or equal to 0 +; Default Value: system defined value +;rlimit_core = 0 + +; Specify the event mechanism FPM will use. The following is available: +; - select (any POSIX os) +; - poll (any POSIX os) +; - epoll (linux >= 2.5.44) +; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0) +; - /dev/poll (Solaris >= 7) +; - port (Solaris >= 10) +; Default Value: not set (auto detection) +;events.mechanism = epoll + +; When FPM is build with systemd integration, specify the interval, +; in second, between health report notification to systemd. +; Set to 0 to disable. +; Available Units: s(econds), m(inutes), h(ours) +; Default Unit: seconds +; Default value: 10 +;systemd_interval = 10 + +;;;;;;;;;;;;;;;;;;;; +; Pool Definitions ; +;;;;;;;;;;;;;;;;;;;; + +; Multiple pools of child processes may be started with different listening +; ports and different management options. The name of the pool will be +; used in logs and stats. There is no limitation on the number of pools which +; FPM can handle. Your system will tell you anyway :) + +; To configure the pools it is recommended to have one .conf file per +; pool in the following directory: +include=/etc/php5/fpm/pool.d/*.conf From eb8440fd190fe0f1a91aac4d2dd7e2c629a2188b Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sun, 17 Aug 2014 16:15:03 +0900 Subject: [PATCH 17/30] Minor change to comments. --- config/apache-config/sites/wordpress-default.conf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config/apache-config/sites/wordpress-default.conf b/config/apache-config/sites/wordpress-default.conf index 7f9dc59..23a6959 100644 --- a/config/apache-config/sites/wordpress-default.conf +++ b/config/apache-config/sites/wordpress-default.conf @@ -14,7 +14,8 @@ # - SVN repository of WordPress trunk # - Files available locally in this repository's www/wordpress-trunk # - Files available on guest (vagrant ssh) in /srv/www/wordpress-trunk -# +# http://src.wordpress-develop.dev +# http://build.wordpress-develop.dev ################################################################ # Default Apache catch-all server @@ -74,4 +75,4 @@ DocumentRoot /srv/www/wordpress-develop/build ServerName build.wordpress-develop.dev - \ No newline at end of file + From 5b2e21bcf08b1f71294f6b9d62e3b246cfbf9654 Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sat, 6 Sep 2014 17:19:47 +0900 Subject: [PATCH 18/30] Increase fcgi idle-timeout from default of 30 sec to 250 to stop frequent timeout errors --- config/apache-config/php5-fpm.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/apache-config/php5-fpm.conf b/config/apache-config/php5-fpm.conf index f03cfcf..6da2b28 100644 --- a/config/apache-config/php5-fpm.conf +++ b/config/apache-config/php5-fpm.conf @@ -2,5 +2,5 @@ AddHandler php5-fcgi .php Action php5-fcgi /php5-fcgi Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi - FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization - \ No newline at end of file + FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -idle-timeout 250 -socket /var/run/php5-fpm.sock -pass-header Authorization + From 0653c9392ee103f4ef4078876e68ff7864d8b80c Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sat, 6 Sep 2014 17:21:30 +0900 Subject: [PATCH 19/30] I have no idea why I made this change. --- config/apache-config/sites/wordpress-default.conf | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/config/apache-config/sites/wordpress-default.conf b/config/apache-config/sites/wordpress-default.conf index 23a6959..f52f480 100644 --- a/config/apache-config/sites/wordpress-default.conf +++ b/config/apache-config/sites/wordpress-default.conf @@ -17,6 +17,20 @@ # http://src.wordpress-develop.dev # http://build.wordpress-develop.dev +# Got the idea from here: http://gregrickaby.com/wordpress-with-apache-2-4-and-php-5-5/ + +Order allow,deny +Allow from all +Require all granted +AllowOverride All +Options All + + +# TODO: Which is better, Options ALL or Options +Indexes +# TODO: VirtualDocumentRoot /Users/daddy/Copy/WordpressDev/vhosts/%0 +# TODO: Each vhost has its own set of access & error logs +# TODO: Which is better, AllowOverride All or AllowOverride FileInfo All? + ################################################################ # Default Apache catch-all server # From 85f1c0b5b03ecaba9b506636362a1df764f23d09 Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sat, 6 Sep 2014 17:29:27 +0900 Subject: [PATCH 20/30] God-awful mess to configure fcgi. Miraculously, it seems to work. --- config/apt-source-append.list | 8 ------ config/php5-fpm-config/php5-fpm.conf | 39 ++++++++++++++++++++++++---- provision/provision.sh | 12 +++++---- 3 files changed, 41 insertions(+), 18 deletions(-) diff --git a/config/apt-source-append.list b/config/apt-source-append.list index efa414f..e6c36d5 100644 --- a/config/apt-source-append.list +++ b/config/apt-source-append.list @@ -7,11 +7,3 @@ # Provides Node.js deb http://ppa.launchpad.net/chris-lea/node.js/ubuntu trusty main deb-src http://ppa.launchpad.net/chris-lea/node.js/ubuntu trusty main - -# Multiverse -deb http://archive.ubuntu.com/ubuntu trusty multiverse -deb-src http://archive.ubuntu.com/ubuntu trusty multiverse -deb http://archive.ubuntu.com/ubuntu trusty-updates multiverse -deb-src http://archive.ubuntu.com/ubuntu trusty-updates multiverse -deb http://security.ubuntu.com/ubuntu trusty-security multiverse -deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse diff --git a/config/php5-fpm-config/php5-fpm.conf b/config/php5-fpm-config/php5-fpm.conf index b453130..ba74347 100644 --- a/config/php5-fpm-config/php5-fpm.conf +++ b/config/php5-fpm-config/php5-fpm.conf @@ -55,7 +55,7 @@ error_log = /var/log/php5-fpm.log ; Default Value: 0 ;emergency_restart_threshold = 0 -; Interval of time used by emergency_restart_interval to determine when +; Interval of time used by emergency_restart_interval to determine when ; a graceful restart will be initiated. This can be useful to work around ; accidental corruptions in an accelerator's shared memory. ; Available Units: s(econds), m(inutes), h(ours), or d(ays) @@ -87,11 +87,11 @@ error_log = /var/log/php5-fpm.log ; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging. ; Default Value: yes ;daemonize = yes - + ; Set open file descriptor rlimit for the master process. ; Default Value: system defined value ;rlimit_files = 1024 - + ; Set max core size rlimit for the master process. ; Possible Values: 'unlimited' or an integer greater or equal to 0 ; Default Value: system defined value @@ -116,7 +116,7 @@ error_log = /var/log/php5-fpm.log ;systemd_interval = 10 ;;;;;;;;;;;;;;;;;;;; -; Pool Definitions ; +; Pool Definitions ; ;;;;;;;;;;;;;;;;;;;; ; Multiple pools of child processes may be started with different listening @@ -126,4 +126,33 @@ error_log = /var/log/php5-fpm.log ; To configure the pools it is recommended to have one .conf file per ; pool in the following directory: -include=/etc/php5/fpm/pool.d/*.conf + +; TODO: I commented this out and maybe really messed things up trying to use mod_proxy_fcgi +; include=/etc/php5/fpm/pool.d/*.conf + +; FUCK IT, WE'LL DO IT LIVE! +; Riffing off of /etc/php5/conf.d/www.conf and http://www.binarytides.com/setup-apache-php-fpm-mod-proxy-fcgi-ubuntu/ + +[www] +user = www-data +group = www-data +listen = /var/run/php5-fpm.sock +; If that doesn't work: listen = 127.0.0.1:9000 + +listen.owner = www-data +listen.group = www-data +listen.mode = 0666 + +pm = dynamic +pm.max_children = 5 +pm.start_servers = 2 +pm.min_spare_servers = 1 +pm.max_spare_servers = 3 +pm.max_requests = 100 + +chdir = / +catch_workers_output = yes + +; I have no idea what I'm doing. +; http://www.geoffstratton.com/2014/05/ubuntu-14-apache-php/ +ProxyPassMatch ^/(.*\.php(/.*)?)$ unix:/run/php-fpm.sock|fcgi://localhost/srv/www diff --git a/provision/provision.sh b/provision/provision.sh index a3abf41..d607fc1 100755 --- a/provision/provision.sh +++ b/provision/provision.sh @@ -60,8 +60,8 @@ apt_package_check_list=( # Apache is installed as the default web server apache2-mpm-worker - libapache2-mod-fastcgi - apache2-dev + # libapache2-mod-fastcgi + # TODO: Is this necessary? apache2-dev # memcached is made available for object caching memcached @@ -255,7 +255,8 @@ unlink /etc/apache2/apache2.conf unlink /etc/apache2/conf.d/php5-fpm.conf unlink /etc/php5/fpm/pool.d/www.conf unlink /etc/php5/fpm/conf.d/php-custom.ini -unlink /etc/php5/fpm/conf.d/xdebug.ini +#unlink /etc/php5/fpm/conf.d/xdebug.ini +unlink /etc/php5/mods-available/xdebug.ini unlink /etc/memcached.conf unlink /home/vagrant/.bash_profile unlink /home/vagrant/.bash_prompt @@ -276,8 +277,9 @@ echo " * /srv/config/apache-config/apache2.conf -> /etc/apache2/apache2. echo " * /srv/config/apache-config/php-fpm.conf -> /etc/apache2/conf.d/php-fpm.conf" echo " * /srv/config/apache-config/sites/ -> /etc/apache2/custom-sites/" -# Configure Apache for PHP-FPM -a2enmod actions fastcgi alias +# Configure Apache for mod_proxy_fcgi +# http://www.geoffstratton.com/2014/05/ubuntu-14-apache-php/ +a2enmod proxy_fcgi # this also enables mod_proxy # Enable mod_rewrite a2enmod rewrite From 5118c668f4b722daa6b0bc69f906eee8efdb0612 Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sat, 6 Sep 2014 17:44:37 +0900 Subject: [PATCH 21/30] Disabled xdebug autostart because it was causing a problem. I should have noted what the problem was before I forgot. --- config/php5-fpm-config/xdebug.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/php5-fpm-config/xdebug.ini b/config/php5-fpm-config/xdebug.ini index 43864d6..9d13b37 100644 --- a/config/php5-fpm-config/xdebug.ini +++ b/config/php5-fpm-config/xdebug.ini @@ -163,7 +163,7 @@ xdebug.profiler_output_name = "cachegrind.out.%t-%s" ; Normally you need to use a specific HTTP GET/POST variable to start remote debugging (see Remote ; Debugging). When this setting is set to 'On' Xdebug will always attempt to start a remote debugging ; session and try to connect to a client, even if the GET/POST/COOKIE variable was not present. -xdebug.remote_autostart = 1 +; xdebug.remote_autostart = 1 ; xdebug.remote_enable ; Type: boolean, Default value: 0 From 0df9a58082aba33821bf327ed15bbd017656a217 Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sat, 6 Sep 2014 17:46:16 +0900 Subject: [PATCH 22/30] Using phpMyAdmin 4.2.7.1 --- provision/provision.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/provision/provision.sh b/provision/provision.sh index d607fc1..d087937 100755 --- a/provision/provision.sh +++ b/provision/provision.sh @@ -561,11 +561,11 @@ PHP # Download phpMyAdmin if [[ ! -d /srv/www/default/database-admin ]]; then - echo "Downloading phpMyAdmin 4.1.14..." + echo "Downloading phpMyAdmin 4.2.7.1..." cd /srv/www/default - wget -q -O phpmyadmin.tar.gz 'http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/4.1.14/phpMyAdmin-4.1.14-all-languages.tar.gz/download' + wget -q -O phpmyadmin.tar.gz 'http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/4.2.7.1/phpMyAdmin-4.2.7.1-all-languages.tar.gz/download' tar -xf phpmyadmin.tar.gz - mv phpMyAdmin-4.1.14-all-languages database-admin + mv phpMyAdmin-4.2.7.1-all-languages database-admin rm phpmyadmin.tar.gz else echo "PHPMyAdmin already installed." From af5559bf8fb2f8708237c7e5cea654b13aa650f1 Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sat, 6 Sep 2014 18:44:14 +0900 Subject: [PATCH 23/30] Cosmetic & spelling changes from VVV --- config/mysql-config/my.cnf | 4 +- config/php5-fpm-config/php-custom.ini | 96 ++++----------------------- 2 files changed, 16 insertions(+), 84 deletions(-) diff --git a/config/mysql-config/my.cnf b/config/mysql-config/my.cnf index 6023060..57f4dbf 100644 --- a/config/mysql-config/my.cnf +++ b/config/mysql-config/my.cnf @@ -14,7 +14,7 @@ # This will be passed to all mysql clients # It has been reported that passwords should be enclosed with ticks/quotes -# escpecially if they contain "#" chars... +# especially if they contain "#" chars... # Remember to edit /etc/mysql/debian.cnf when changing the socket location. [client] port = 3306 @@ -73,7 +73,7 @@ quote-names max_allowed_packet = 128M [mysql] -#no-auto-rehash # faster start of mysql but no tab completition +#no-auto-rehash # faster start of mysql but no tab completion [isamchk] diff --git a/config/php5-fpm-config/php-custom.ini b/config/php5-fpm-config/php-custom.ini index 8d69ebb..7e1551d 100644 --- a/config/php5-fpm-config/php-custom.ini +++ b/config/php5-fpm-config/php-custom.ini @@ -1,121 +1,53 @@ +; Much of the default text has been stripped from this config file in order to +; improve readability. If you'd like to explore various configurations of PHP +; by using this file, see http://www.php.net/manual/en/ini.core.php [PHP] ; Recommended that short tags - - are not used. -; Default Value: On -; Development Value: Off -; Production Value: Off -; http://php.net/short-open-tag short_open_tag = Off -; If you pass a value by reference at function call time... -; Default Value: On (Suppress warnings) -; Development Value: Off (Issue warnings) -; Production Value: Off (Issue warnings) -; http://php.net/allow-call-time-pass-reference +; Issue warning if you pass a value by reference at function call time. allow_call_time_pass_reference = Off -; Maximum execution time of each script, in seconds -; http://php.net/max-execution-time -; Note: This directive is hardcoded to 0 for the CLI SAPI +; Maximum execution time of each script, in seconds. (Hard coded at 0 for CLI) max_execution_time = 30 -; Maximum amount of memory a script may consume (128MB) -; http://php.net/memory-limit +; Maximum amount of memory a script may consume. memory_limit = 128M -; Common Values: -; E_ALL & ~E_NOTICE (Show all errors, except for notices and coding standards warnings.) -; E_ALL & ~E_NOTICE | E_STRICT (Show all errors, except for notices) -; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors) -; E_ALL | E_STRICT (Show all errors, warnings and notices including coding standards.) -; Default Value: E_ALL & ~E_NOTICE -; Development Value: E_ALL | E_STRICT -; Production Value: E_ALL & ~E_DEPRECATED -; http://php.net/error-reporting +; Show all errors except for notices. error_reporting = E_ALL | E_STRICT -; Should PHP output errors. If so, where? -; Possible Values: -; Off = Do not display any errors -; stderr = Display errors to STDERR (affects only CGI/CLI binaries!) -; On or stdout = Display errors to STDOUT -; Default Value: On -; Development Value: On -; Production Value: Off -; http://php.net/display-errors +; Display errors to STDOUT display_errors = On -; Besides displaying errors, PHP can also log errors to locations such as a -; server-specific log, STDERR, or a location specified by the error_log -; directive found below. While errors should not be displayed on productions -; servers they should still be monitored and logging is a great way to do that. -; Default Value: Off -; Development Value: On -; Production Value: On -; http://php.net/log-errors +; Log errors in addition to displaying them. log_errors = On -; Set maximum length of log_errors. In error_log information about the source is -; added. The default is 1024 and 0 allows to not apply any maximum length at all. -; http://php.net/log-errors-max-len +; Set maximum length of log_errors. log_errors_max_len = 1024 -; Do not log repeated messages. Repeated errors must occur in same file on same -; line unless ignore_repeated_source is set true. -; http://php.net/ignore-repeated-errors +; Log repeated messages. ignore_repeated_errors = Off - -; Ignore source of message when ignoring repeated messages. When this setting -; is On you will not log errors with repeated messages from different files or -; source lines. -; http://php.net/ignore-repeated-source ignore_repeated_source = Off -; Store the last error/warning message in $php_errormsg (boolean). Setting this value -; to On can assist in debugging and is appropriate for development servers. It should -; however be disabled on production servers. -; Default Value: Off -; Development Value: On -; Production Value: Off -; http://php.net/track-errors +; Store the last error/warning message in $php_errormsg (boolean). track_errors = Off ; Display HTML links to docs related to the error? -; Default Value: On -; Development Value: On -; Production value: Off -; http://php.net/html-errors html_errors = 1 -; String to output before an error message. PHP's default behavior is to leave -; this setting blank. -; http://php.net/error-prepend-string -; Example: -;error_prepend_string = "" - -; String to output after an error message. PHP's default behavior is to leave -; this setting blank. -; http://php.net/error-append-string -; Example: -;error_append_string = "" - -; Log errors to specified file. PHP's default behavior is to leave this value -; empty. -; http://php.net/error-log -; Example: -error_log = /tmp/php_errors.log +; Log errors to specified file. +error_log = /srv/log/php_errors.log ; Maximum size of POST data that PHP will accept. -; http://php.net/post-max-size post_max_size = 50M ; Maximum allowed size for uploaded files. -; http://php.net/upload-max-filesize upload_max_filesize = 50M ; Maximum number of files that can be uploaded via a single request max_file_uploads = 20 ; Default timeout for socket based streams (seconds) -; http://php.net/default-socket-timeout default_socket_timeout = 60 From 6876cd726fb8bf306f65a66d8d9673d455b1c037 Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sat, 6 Sep 2014 18:46:01 +0900 Subject: [PATCH 24/30] PHPCS related --- config/bash_profile | 6 ++++++ config/php5-fpm-config/www.conf | 2 +- provision/provision.sh | 5 ++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/config/bash_profile b/config/bash_profile index 7c4266c..cf96265 100644 --- a/config/bash_profile +++ b/config/bash_profile @@ -27,3 +27,9 @@ export WP_TESTS_DIR=/srv/www/wordpress-develop/tests/phpunit/ # add autocomplete for grunt eval "$(grunt --completion=bash)" + +# add autocomplete for wp-cli +. /srv/www/wp-cli/utils/wp-completion.bash + +# PHPCS path +export PATH="$PATH:/srv/www/phpcs/scripts/" \ No newline at end of file diff --git a/config/php5-fpm-config/www.conf b/config/php5-fpm-config/www.conf index ae81095..f09396e 100644 --- a/config/php5-fpm-config/www.conf +++ b/config/php5-fpm-config/www.conf @@ -353,7 +353,7 @@ catch_workers_output = yes ; the current environment. ; Default Value: clean env ;env[HOSTNAME] = $HOSTNAME -;env[PATH] = /usr/local/bin:/usr/bin:/bin +env[PATH] = /srv/www/phpcs/scripts/:/usr/local/bin:/usr/bin:/bin ;env[TMP] = /tmp ;env[TMPDIR] = /tmp ;env[TEMP] = /tmp diff --git a/provision/provision.sh b/provision/provision.sh index d087937..686b987 100755 --- a/provision/provision.sh +++ b/provision/provision.sh @@ -462,7 +462,7 @@ if [[ $ping_result == *bytes?from* ]]; then # Sniffs WordPress Coding Standards if [[ ! -d /srv/www/phpcs/CodeSniffer/Standards/WordPress ]]; then - echo -e "\nDownloading WordPress-Coding-Standards, snifs for PHP_CodeSniffer, see https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards" + echo -e "\nDownloading WordPress-Coding-Standards, sniffs for PHP_CodeSniffer, see https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards" git clone git://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git /srv/www/phpcs/CodeSniffer/Standards/WordPress else cd /srv/www/phpcs/CodeSniffer/Standards/WordPress @@ -473,6 +473,9 @@ if [[ $ping_result == *bytes?from* ]]; then echo -e "\nSkipped updating PHPCS WordPress Coding Standards since not on master branch" fi fi + # Install the standards in PHPCS + /srv/www/phpcs/scripts/phpcs --config-set installed_paths ./CodeSniffer/Standards/WordPress/ + /srv/www/phpcs/scripts/phpcs -i # Install and configure the latest stable version of WordPress if [[ ! -d /srv/www/wordpress-default ]]; then From 17003ea52d15125b846d5e36462ffa09df40c522 Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sat, 6 Sep 2014 18:46:40 +0900 Subject: [PATCH 25/30] Change from VVV --- config/bash_profile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/config/bash_profile b/config/bash_profile index cf96265..5847faa 100644 --- a/config/bash_profile +++ b/config/bash_profile @@ -13,8 +13,13 @@ if [ -n "$BASH_VERSION" ]; then fi fi -# Prompt -[[ -f "$HOME/.bash_prompt" ]] && source "$HOME/.bash_prompt" +# setup bash prompt +if [ -n "$BASH_VERSION" ]; then + # include .bash_prompt if it exists + if [ -f "$HOME/.bash_prompt" ]; then + . "$HOME/.bash_prompt" + fi +fi # set PATH so it includes user's private bin if it exists if [ -d "$HOME/bin" ] ; then From 7dda6a08a65886be96b7292c0d576c719a68e8e9 Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sat, 6 Sep 2014 18:47:13 +0900 Subject: [PATCH 26/30] Memory bumped up to 1 MB, from VVV --- Vagrantfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 4740769..036cc7f 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -12,7 +12,7 @@ Vagrant.configure("2") do |config| # Configurations from 1.0.x can be placed in Vagrant 1.1.x specs like the following. config.vm.provider :virtualbox do |v| - v.customize ["modifyvm", :id, "--memory", 512] + v.customize ["modifyvm", :id, "--memory", 1024] v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] v.customize ["modifyvm", :id, "--natdnsproxy1", "on"] end @@ -25,11 +25,10 @@ Vagrant.configure("2") do |config| # Default Ubuntu Box # - # This box is provided by Ubuntu vagrantcloud.com and is a nicely sized (376MB) + # This box is provided by Ubuntu vagrantcloud.com and is a nicely sized (332MB) # box containing the Ubuntu 14.04 Trusty 64 bit release. Once this box is downloaded # to your host computer, it is cached for future use under the specified box name. config.vm.box = "ubuntu/trusty64" - config.vm.box_url = "https://vagrantcloud.com/ubuntu/trusty64" config.vm.hostname = "vvv" From e80c75acb9c313dd615ae3c011271d51b4d42450 Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sat, 6 Sep 2014 18:48:20 +0900 Subject: [PATCH 27/30] Update change log --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b44e487..5198abd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ +### 1.0.1 +* Added Sexy bash prompt +* Removed APC configs. +* mod_proxy_fcgi replaces FastCGI +* Incorporated latest VVV updates + +# vvv-apache-nfs-pagespeed Changelog +### 1.0 +* Updated to Ubuntu 14.04.01 x64, ergo Apache 2.4 and no more APC. +* Added Google PageSpeed. +* Shares mounted with NFS +* Added some php5-fpm-config files from Apache-VVV that I overlooked. + # Varying Vagrant Vagrants Changelog ## 1.0.1 From fa1f00a4dba57bc53dac2c31e23a3d0cbc9c2dcc Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sun, 12 Oct 2014 20:16:22 +0900 Subject: [PATCH 28/30] VirtualHost configurations updated to use mod_proxy_fcgi --- config/apache-config/sites/wordpress-default.conf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/apache-config/sites/wordpress-default.conf b/config/apache-config/sites/wordpress-default.conf index f52f480..54225d9 100644 --- a/config/apache-config/sites/wordpress-default.conf +++ b/config/apache-config/sites/wordpress-default.conf @@ -41,6 +41,7 @@ Options All DocumentRoot /srv/www/default ServerName vvv.dev + ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/srv/www/default/$1 ################################################################ @@ -53,6 +54,7 @@ Options All DocumentRoot /srv/www/wordpress-default ServerName local.wordpress.dev + ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/srv/www/wordpress-default/$1 ################################################################ @@ -65,6 +67,7 @@ Options All DocumentRoot /srv/www/wordpress-trunk ServerName local.wordpress-trunk.dev + ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/srv/www/wordpress-trunk/$1 ################################################################ @@ -77,6 +80,7 @@ Options All DocumentRoot /srv/www/wordpress-develop/src ServerName src.wordpress-develop.dev + ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/srv/www/wordpress-develop/src/$1 ################################################################ @@ -89,4 +93,5 @@ Options All DocumentRoot /srv/www/wordpress-develop/build ServerName build.wordpress-develop.dev + ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/srv/www/wordpress-develop/build/$1 From 260b893d59cff8f89db4f91352ee7359e0cbe572 Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sun, 12 Oct 2014 20:42:14 +0900 Subject: [PATCH 29/30] Mostly stuff to get mod_proxy_fcgi and PHP-FPM working. --- CHANGELOG.md | 11 +- README.md | 146 ++++++++++-------- config/apache-config/apache2.conf | 3 - config/apache-config/php5-fpm.conf | 6 - .../{php5-fpm.conf => php-fpm.conf} | 40 +---- config/php5-fpm-config/www.conf | 2 +- provision/provision.sh | 7 +- 7 files changed, 103 insertions(+), 112 deletions(-) delete mode 100644 config/apache-config/php5-fpm.conf rename config/php5-fpm-config/{php5-fpm.conf => php-fpm.conf} (84%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5198abd..12a5a28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,17 @@ +# vvv-apache-nfs-pagespeed-mod_proxy_fcgi Changelog + +### 1.1.0 +* mod_proxy_fcgi is really working now. +* ack-2.14 +* phpMyAdmin-4.2.9 +* Latest updates from VVV + ### 1.0.1 * Added Sexy bash prompt * Removed APC configs. -* mod_proxy_fcgi replaces FastCGI +* mod_proxy_fcgi replaces FastCGI (mod_fastcgi.c) * Incorporated latest VVV updates -# vvv-apache-nfs-pagespeed Changelog ### 1.0 * Updated to Ubuntu 14.04.01 x64, ergo Apache 2.4 and no more APC. * Added Google PageSpeed. diff --git a/README.md b/README.md index 667f91d..bcb0a33 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# vvv-apache-nfs-pagespeed +## vvv-apache-nfs-pagespeed-mod_proxy_fcgi -I opened vvv-apache in one window and VVV in another and frankensteined together this version. I still barely know my ass from my elbow, but it all seems to work. +Things are messy in a few spots, but it all seems to be working. ### NFS configuration @@ -57,74 +57,73 @@ I added Google's PPA to `apt-source-append.list` and `mod-pagespeed-stable` to ` The rest below is from the original readme.me -# Varying Vagrant Vagrants - Apache Edition +# Varying Vagrant Vagrants -Varying Vagrant Vagrants is an evolving [Vagrant](http://vagrantup.com) configuration focused on [WordPress](http://wordpress.org) development. +Varying Vagrant Vagrants is an open source [Vagrant](http://vagrantup.com) configuration focused on [WordPress](http://wordpress.org) development. VVV is [MIT Licensed](https://github.com/varying-vagrant-vagrants/vvv/blob/master/LICENSE). -* **Version**: 1.0 -* **Contributors**: [@jeremyfelt](http://github.com/jeremyfelt), [@carldanley](http://github.com/carldanley), [@ericmann](http://github.com/ericmann), [@lkwdwrd](http://github.com/lkwdwrd), [@TheLastCicada](http://github.com/TheLastCicada), [@tddewey](http://github.com/tddewey), [@johnpbloch](http://github.com/johnpbloch), [@kadamwhite](http://github.com/kadamwhite), [@scribu](http://github.com/scribu), [@danielbachhuber](http://github.com/danielbachhuber), [@tollmanz](http://github.com/tollmanz), [@mbijon](http://github.com/mbijon), [@markjaquith](http://github.com/markjaquith), [@curtismchale](http://github.com/curtismchale), [@Mamaduka](http://github.com/mamaduka), [@lgedeon](http://github.com/lgedeon), [@pmgarman](http://github.com/pmgarman), [@westonruter](http://github.com/westonruter), [@petemall](http://github.com/petemall), [@cmmarslender](http://github.com/cmmarslender), [@mintindeed](http://github.com/mintindeed), [@mboynes](http://github.com/mboynes), [@aaronjorbin](http://github.com/aaronjorbin), [@tobiasbg](http://github.com/tobiasbg), [@simonwheatley](http://github.com/simonwheatley), [@ocean90](http://github.com/ocean90), [@lvnilesh](http://github.com/lvnilesh), [@alexw23](http://github.com/alexw23), [@zamoose](https://github.com/zamoose), [@leewillis77](https://github.com/leewillis77), [@imichaeli](https://github.com/imichaeli), [@andrezrv](https://github.com/andrezrv), [@cadwell](https://github.com/cadwell), [@cfoellmann](https://github.com/cfoellmann), [@westi](https://github.com/westi), [@ryanduff](https://github.com/ryanduff) -* **Contributing**: Contributions are more than welcome. Please submit pull requests against the [master branch](https://github.com/10up/varying-vagrant-vagrants). Thanks! +VVV is a [10up](http://10up.com) creation and [transitioned](http://10up.com/blog/varying-vagrant-vagrants-future/) to a community organization in 2014. + +* **Version**: 1.2-working +* **Latest Stable**: [v1.1](https://github.com/varying-vagrant-vagrants/vvv/tree/v1.1) +* **Contributors**: [@jeremyfelt](https://github.com/jeremyfelt), [@carldanley](https://github.com/carldanley), [@ericmann](https://github.com/ericmann), [@lkwdwrd](https://github.com/lkwdwrd), [@TheLastCicada](https://github.com/TheLastCicada), [@tddewey](https://github.com/tddewey), [@johnpbloch](https://github.com/johnpbloch), [@kadamwhite](https://github.com/kadamwhite), [@scribu](https://github.com/scribu), [@danielbachhuber](https://github.com/danielbachhuber), [@tollmanz](https://github.com/tollmanz), [@mbijon](https://github.com/mbijon), [@markjaquith](https://github.com/markjaquith), [@curtismchale](https://github.com/curtismchale), [@Mamaduka](https://github.com/mamaduka), [@lgedeon](https://github.com/lgedeon), [@pmgarman](https://github.com/pmgarman), [@westonruter](https://github.com/westonruter), [@petemall](https://github.com/petemall), [@cmmarslender](https://github.com/cmmarslender), [@mintindeed](https://github.com/mintindeed), [@mboynes](https://github.com/mboynes), [@aaronjorbin](https://github.com/aaronjorbin), [@tobiasbg](https://github.com/tobiasbg), [@simonwheatley](https://github.com/simonwheatley), [@ocean90](https://github.com/ocean90), [@lvnilesh](https://github.com/lvnilesh), [@alexw23](https://github.com/alexw23), [@zamoose](https://github.com/zamoose), [@leewillis77](https://github.com/leewillis77), [@imichaeli](https://github.com/imichaeli), [@andrezrv](https://github.com/andrezrv), [@cadwell](https://github.com/cadwell), [@cfoellmann](https://github.com/cfoellmann), [@westi](https://github.com/westi), [@ryanduff](https://github.com/ryanduff), [@selinerdominik](https://github.com/selinerdominik), [@ericandrewlewis](https://github.com/ericandrewlewis), [@vDevices](https://github.com/vDevices), [@sunnyratilal](https://github.com/sunnyratilal), [@enejb](https://github.com/enejb), [@salcode](https://github.com/salcode), [@mattbanks](https://github.com/mattbanks), [@aaroncampbell](https://github.com/aaroncampbell), [@tnorthcutt](https://github.com/tnorthcutt), [@neilpie](https://github.com/neilpie), [@francescolaffi](https://github.com/francescolaffi), [@itsananderson](https://github.com/itsananderson), [@foolswis](https://github.com/foolswis), [@lloydde](https://github.com/lloydde), [@jmbarlow](https://github.com/jmbarlow), [@nacin](https://github.com/nacin), [@thewebists](https://github.com/thewebists), [@iparr](https://github.com/iparr) + +* **Contributing**: Contributions are more than welcome. Please see our current [contributing guidelines](https://github.com/Varying-Vagrant-Vagrants/VVV/blob/master/CONTRIBUTING.md). Thanks! ## Overview ### The Purpose of Varying Vagrant Vagrants -The primary goal of Varying Vagrant Vagrants (VVV) is to provide an approachable way for developers to begin working in a development environment that matches a production environment as closely as possible. +The primary goal of Varying Vagrant Vagrants (VVV) is to provide an approachable development environment that matches a typical production environment. -The default server configuration provisioned by VVV is intended to match a common configuration for working with high traffic WordPress sites. +The default server configuration provisioned by VVV matches a common configuration for working with high traffic WordPress sites. -The default WordPress configurations provided by VVV are intended to create an environment ideal for developing themes and plugins as well as for contributing to WordPress core. +The default WordPress configurations provided by VVV create an environment ideal for developing themes and plugins as well as for [contributing to WordPress core](http://make.wordpress.org/core/). ### How to Use Varying Vagrant Vagrants -#### VVV as a MAMP/XAMPP Replacement +#### Software Requirements -VVV is ready to use as is. Download or clone VVV and then type `vagrant up` to automatically build a sandboxed Ubuntu server on your computer containing everything needed to contribute to WordPress core or develop a WordPress theme or plugin. +VVV requires recent versions of both Vagrant and VirtualBox to be installed. -Multiple projects can be developed at once in the same environment. - -* Use the `wordpress-develop` directory to participate in [WordPress core](http://core.trac.wordpress.org) development. -* Use `wp-content/themes` in either the `wordpress-default` or `wordpress-trunk` directories to develop multiple themes. -* Use `wp-content/plugins` in either the `wordpress-default` or `wordpress-trunk` directories to develop plugins. -* Take advantage of VVV's [auto site configuration](https://github.com/10up/varying-vagrant-vagrants/wiki/Auto-site-Setup) to provision additional instances of WordPress in `/srv/www/`. - -#### VVV as a Scaffold +[Vagrant](http://www.vagrantup.com) is a "tool for building and distributing development environments". It works with [virtualization](http://en.wikipedia.org/wiki/X86_virtualization) software such as [VirtualBox](https://www.virtualbox.org/) to provide a virtual machine sandboxed from your local environment. -Entirely different server configurations can be created by modifying the files included with VVV and through the use of additional [Auto Site Setup](https://github.com/10up/varying-vagrant-vagrants/wiki/Auto-site-Setup) provisioning scripts. +#### VVV as a MAMP/XAMPP Replacement -It is not necessary to track the changes made to the main repository. Feel free to check this project out and then change everything to make it your own. +Once Vagrant and VirtualBox are installed, download or clone VVV and type `vagrant up` to automatically build a virtualized Ubuntu server on your computer containing everything needed to develop a WordPress theme or plugin. See our section on [The First Vagrant Up](#the-first-vagrant-up) for detailed instructions. -### The Future of Varying Vagrant Vagrants +Multiple projects can be developed at once in the same environment. -Immediate goals for VVV include: +* Use `wp-content/themes` in either the `www/wordpress-default` or `www/wordpress-trunk` directories to develop themes. +* Use `wp-content/plugins` in either the `www/wordpress-default` or `www/wordpress-trunk` directories to develop plugins. +* Take advantage of VVV's [auto site configuration](https://github.com/varying-vagrant-vagrants/vvv/wiki/Auto-site-Setup) to provision additional instances of WordPress in `www/`. +* Use the `www/wordpress-develop` directory to participate in [WordPress core](http://core.trac.wordpress.org) development. -* Continue to work towards a stable state of software and configuration included in the default provisioning. -* Provide excellent and clear documentation throughout VVV to aid in both learning and scaffolding. +VVV's `config`, `database`, `log` and `www` directories are shared with the virtualized server. -## Getting Started +These shared directories allow you to work, for example, in `vagrant-local/www/wordpress-default` in your local file system and have those changes immediately reflected in the virtualized server's file system and http://local.wordpress.dev/. 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. -### What is Vagrant? +#### VVV as a Scaffold -[Vagrant](http://www.vagrantup.com) is a "tool for building and distributing development environments". It works with [virtualization](http://en.wikipedia.org/wiki/X86_virtualization) software such as [VirtualBox](https://www.virtualbox.org/) to provide a virtual machine that is sandboxed away from your local environment. +Entirely different server configurations can be created by modifying the files included with VVV and through the use of additional [Auto Site Setup](https://github.com/varying-vagrant-vagrants/vvv/wiki/Auto-site-Setup) provisioning scripts. Check this project out and use it as a base to learn about server provisioning or change everything to make it your own. ### The First Vagrant Up -1. Start with any operating system. -1. Install [VirtualBox 4.2.x](https://www.virtualbox.org/wiki/Download_Old_Builds_4_2) or [VirtualBox 4.3.4](https://www.virtualbox.org/wiki/Downloads) - * Major portions of VirtualBox were rewritten for 4.3, and it's possible that there are still bugs to be shaken out. VVV is completely compatible with earlier versions of VirtualBox, so 4.2.18 or earlier would be just fine. Do note that Vagrant had specific issues with 4.2.16. Going as far back as 4.2.10 will likely be of no issue. - * VVV itself leans in the 4.3.x direction in the master branch to stay ahead of the curve. -1. Install [Vagrant 1.4.0](http://www.vagrantup.com/downloads.html) +1. Start with any local operating system such as Mac OS X, Linux, or Windows. +1. Install [VirtualBox 4.3.x](https://www.virtualbox.org/wiki/Downloads) +1. Install [Vagrant 1.6.x](http://www.vagrantup.com/downloads.html) * `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 a much older version is in use. - * ***Note:*** If VirtualBox 4.3.x is installed, Vagrant 1.3.5 or later is required. 1. Install the [vagrant-hostsupdater](https://github.com/cogitatio/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 domains in your browser. * If you choose not to install this plugin, a manual entry should be added to your local `hosts` file that looks like this: `192.168.50.4 vvv.dev local.wordpress.dev local.wordpress-trunk.dev src.wordpress-develop.dev build.wordpress-develop.dev` +1. Install the [vagrant-triggers](https://github.com/emyl/vagrant-triggers) plugin with `vagrant plugin install vagrant-triggers` + * Note: This step is not a requirement. It does allow for various scripts to fire when issuing commands such as `vagrant halt` and `vagrant 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 a `dbname.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. 1. Clone or extract the Varying Vagrant Vagrants project into a local directory - * `git clone git://github.com/10up/varying-vagrant-vagrants.git vagrant-local` - * OR download and extract the repository master [zip file](https://github.com/10up/varying-vagrant-vagrants/archive/master.zip) - * OR grab a [stable release](https://github.com/10up/varying-vagrant-vagrants/releases) if you'd like some extra comfort. -1. Change into the new directory with `cd vagrant-local` + * `git clone git://github.com/Varying-Vagrant-Vagrants/VVV.git vagrant-local` + * OR download and extract the repository master [zip file](https://github.com/varying-vagrant-vagrants/vvv/archive/master.zip) to a `vagrant-local` directory on your computer. + * OR download and extract a [stable release](https://github.com/varying-vagrant-vagrants/vvv/releases) zip file if you'd like some extra comfort. +1. In a command prompt, change into the new directory with `cd vagrant-local` 1. Start the Vagrant environment with `vagrant up` * Be patient as the magic happens. This could take a while on the first run as your local machine downloads the required files. * Watch as the script ends, as an administrator or `su` ***password may be required*** to properly modify the hosts file on your local machine. @@ -139,7 +138,7 @@ Fancy, yeah? ### What Did That Do? -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 12.04 and is about 280MB. +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. @@ -156,16 +155,22 @@ On future runs of `vagrant up`, the packaged box will be cached on your local ma Now that you're up and running, start poking around and modifying things. 1. Access the server via the command line with `vagrant ssh` from your `vagrant-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](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) will provide access immediately. For detailed instructions on connecting with PuTTY, consult the [VVV Wiki](https://github.com/10up/varying-vagrant-vagrants/wiki/Connect-to-Your-Vagrant-Virtual-Machine-with-PuTTY). + * **MS Windows users:** An SSH client is generally not distributed with Windows PCs by default. However, a terminal emulator such as [PuTTY](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) will provide access immediately. For detailed instructions on connecting with PuTTY, consult the [VVV Wiki](https://github.com/Varying-Vagrant-Vagrants/VVV/wiki/Connect-to-Your-Vagrant-Virtual-Machine-with-PuTTY). 1. Power off the box with `vagrant halt` and turn it back on with `vagrant up`. 1. Suspend the box's state in memory with `vagrant suspend` and bring it right back with `vagrant resume`. 1. Reapply provisioning to a running box with `vagrant provision`. 1. Destroy the box with `vagrant destroy`. Files added in the `www` directory will persist on the next `vagrant up`. -1. Start modifying and adding local files to fit your needs. Take a look at [Auto Site Setup](https://github.com/10up/varying-vagrant-vagrants/wiki/Auto-site-Setup) for tips on adding new projects. +1. Start modifying and adding local files to fit your needs. Take a look at [Auto Site Setup](https://github.com/varying-vagrant-vagrants/vvv/wiki/Auto-site-Setup) for tips on adding new projects. #### Caveats -The network configuration picks an IP of 192.168.50.4. This works if you are *not* on the 192.168.50.x sub domain, it could cause conflicts on your existing network if you *are* on a 192.168.50.x sub domain already. You can configure any IP address in the `Vagrantfile` and it will be used on the next `vagrant up` +The network configuration picks an IP of 192.168.50.4. It could cause conflicts on your existing network if you *are* on a 192.168.50.x subnet already. You can configure any IP address in the `Vagrantfile` and it will be used on the next `vagrant up` + +VVV relies on the stability of both Vagrant and Virtualbox. These caveats are common to Vagrant environments and are worth noting: +* If the directory VVV is inside of is moved once provisioned (`vagrant-local`), it may break. + * If `vagrant destroy` is used before moving, this should be fine. +* If Virtualbox is uninstalled, VVV will break. +* If Vagrant is uninstalled, VVV will break. ### Credentials and Such @@ -174,14 +179,20 @@ All database usernames and passwords for WordPress installations included by def All WordPress admin usernames and passwords for WordPress installations included by default are `admin` and `password`. #### WordPress Stable +* LOCAL PATH: vagrant-local/www/wordpress-default +* VM PATH: /srv/www/wordpress-default * URL: `http://local.wordpress.dev` * DB Name: `wordpress_default` #### WordPress Trunk +* LOCAL PATH: vagrant-local/www/wordpress-trunk +* VM PATH: /srv/www/wordpress-trunk * URL: `http://local.wordpress-trunk.dev` * DB Name: `wordpress_trunk` #### WordPress Develop +* LOCAL PATH: vagrant-local/www/wordpress-develop +* VM PATH: /srv/www/wordpress-develop * /src URL: `http://src.wordpress-develop.dev` * /build URL: `http://build.wordpress-develop.dev` * DB Name: `wordpress_develop` @@ -190,34 +201,34 @@ All WordPress admin usernames and passwords for WordPress installations included #### MySQL Root * User: `root` * Pass: `root` -* See: [Connecting to MySQL](https://github.com/10up/varying-vagrant-vagrants/wiki/Connecting-to-MySQL) from your local machine +* See: [Connecting to MySQL](https://github.com/varying-vagrant-vagrants/vvv/wiki/Connecting-to-MySQL) from your local machine ### What do you get? A bunch of stuff! -1. [Ubuntu](http://www.ubuntu.com/) 12.04 LTS (Precise Pangolin) +1. [Ubuntu](http://www.ubuntu.com/) 14.04 LTS (Trusty Tahr) 1. [WordPress Develop](http://develop.svn.wordpress.org/trunk/) 1. [WordPress Stable](http://wordpress.org/) 1. [WordPress Trunk](http://core.svn.wordpress.org/trunk/) 1. [WP-CLI](http://wp-cli.org/) 1. [Apache](http://httpd.apache.org/) 2.4.x 1. [mysql](http://www.mysql.com/) 5.5.x -1. [php-fpm](http://php-fpm.org/) 5.4.x +1. [php-fpm](http://php-fpm.org/) 5.5.x 1. [memcached](http://memcached.org/) 1.4.13 1. PHP [memcache extension](http://pecl.php.net/package/memcache/3.0.8/) 3.0.8 -1. PHP [xdebug extension](http://pecl.php.net/package/xdebug/2.2.3/) 2.2.3 -1. PHP [imagick extension](http://pecl.php.net/package/imagick/3.1.0RC2/) 3.1.0RC2 -1. [xdebug](http://xdebug.org/) 2.2.3 -1. [PHPUnit](http://pear.phpunit.de/) 3.7.24 -1. [ack-grep](http://beyondgrep.com/) 2.04 -1. [git](http://git-scm.com/) 1.8.5 -1. [subversion](http://subversion.apache.org/) 1.7.9 +1. PHP [xdebug extension](http://pecl.php.net/package/xdebug/2.2.5/) 2.2.5 +1. PHP [imagick extension](http://pecl.php.net/package/imagick/3.1.2/) 3.1.2 +1. [PHPUnit](http://pear.phpunit.de/) 4.0.x +1. [ack-grep](http://beyondgrep.com/) 2.14 +1. [git](http://git-scm.com/) 1.9.x +1. [subversion](http://subversion.apache.org/) 1.8.x 1. [ngrep](http://ngrep.sourceforge.net/usage.html) 1. [dos2unix](http://dos2unix.sourceforge.net/) 1. [Composer](https://github.com/composer/composer) -1. [phpMemcachedAdmin](https://code.google.com/p/phpmemcacheadmin/) 1.2.2 BETA -1. [phpMyAdmin](http://www.phpmyadmin.net/) 4.0.10 (multi-language) +1. [phpMemcachedAdmin](https://code.google.com/p/phpmemcacheadmin/) +1. [phpMyAdmin](http://www.phpmyadmin.net/) 4.2.9 (multi-language) +1. [Opcache Status](https://github.com/rlerdorf/opcache-status) 1. [Webgrind](https://github.com/jokkedk/webgrind) 1. [NodeJs](http://nodejs.org/) Current Stable Version 1. [grunt-cli](https://github.com/gruntjs/grunt-cli) Current Stable Version @@ -225,11 +236,24 @@ A bunch of stuff! ### Need Help? * 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. -* There is a [Mailing list](https://groups.google.com/forum/#!forum/wordpress-and-vagrant) for any topic related to WordPress and Vagrant that is a great place to get started. -* The [VVV Wiki](https://github.com/10up/varying-vagrant-vagrants/wiki) also contains documentation that may help. +* The [WordPress and Vagrant Mailing list](https://groups.google.com/forum/#!forum/wordpress-and-vagrant) is a great place to get started for any related topics. +* The [VVV Wiki](https://github.com/varying-vagrant-vagrants/vvv/wiki) also contains documentation that may help. + +### The Future of Varying Vagrant Vagrants + +Immediate goals for VVV include: + +* Continue to work towards a stable state of software and configuration included in the default provisioning. +* Provide excellent and clear documentation throughout VVV to aid in both learning and scaffolding. + +## Copyright / License + +VVV is copyright (c) 2014, the contributors of the VVV project under the [MIT License](https://github.com/varying-vagrant-vagrants/vvv/blog/master/LICENSE]. + +## History + +VVV has come a long way since it was first [launched as Varying Vagrant Vagrants](http://jeremyfelt.com/code/2012/12/11/varying-vagrant-vagrants/) in December of 2012. Initially introduced as an exploration of workflow for immediate project needs at [10up](http://10up.com), VVV caught speed quickly as more and more of the team was introduced. During an internal [10up developer summit](http://10up.com/blog/10up-2013-developer-summit/) in March of 2013, Vagrant as a tool was a highlight and more developers made the conversion. -### More Context +In April of 2013, we made a [call to the WordPress community](http://jeremyfelt.com/code/2013/04/08/hi-wordpress-meet-vagrant/) to try to encourage the addition of Vagrant to everyday life. These efforts continued with talks at [WordCamp Chicago](http://wordpress.tv/2013/12/31/jeremy-felt-hi-wordpress-meet-vagrant-2/), [WordCamp Vancouver](http://wordpress.tv/2013/10/19/jeremy-felt-hi-wordpress-meet-vagrant/), and WordCamp Denver. -* [Varying Vagrant Vagrants](http://jeremyfelt.com/code/2012/12/11/varying-vagrant-vagrants/), where it all started. -* [Hi WordPress, Meet Vagrant](http://jeremyfelt.com/code/2013/04/08/hi-wordpress-meet-vagrant/), the blog post. -* [Hi WordPress, Meet Vagrant](http://wordpress.tv/2013/10/19/jeremy-felt-hi-wordpress-meet-vagrant/), the talk at WordCamp Vancouver. +In January of 2014, [10up](http://10up.com) made the decision to [spin VVV off](http://10up.com/blog/varying-vagrant-vagrants-future/) into its own organization to better align with the community that has grown around the project over time. This transition opens doors for what [Varying Vagrant Vagrants, the organization](http://jeremyfelt.com/code/2014/01/27/varying-vagrant-vagrants-organization/) can accomplish as an ongoing project. diff --git a/config/apache-config/apache2.conf b/config/apache-config/apache2.conf index 30c4875..ca3d496 100755 --- a/config/apache-config/apache2.conf +++ b/config/apache-config/apache2.conf @@ -211,9 +211,6 @@ LogLevel warn Include mods-enabled/*.load Include mods-enabled/*.conf -# Include all the user configurations: -#Include httpd.conf - # Include ports listing Include ports.conf diff --git a/config/apache-config/php5-fpm.conf b/config/apache-config/php5-fpm.conf deleted file mode 100644 index 6da2b28..0000000 --- a/config/apache-config/php5-fpm.conf +++ /dev/null @@ -1,6 +0,0 @@ - - AddHandler php5-fcgi .php - Action php5-fcgi /php5-fcgi - Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi - FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -idle-timeout 250 -socket /var/run/php5-fpm.sock -pass-header Authorization - diff --git a/config/php5-fpm-config/php5-fpm.conf b/config/php5-fpm-config/php-fpm.conf similarity index 84% rename from config/php5-fpm-config/php5-fpm.conf rename to config/php5-fpm-config/php-fpm.conf index ba74347..8534cd1 100644 --- a/config/php5-fpm-config/php5-fpm.conf +++ b/config/php5-fpm-config/php-fpm.conf @@ -48,6 +48,7 @@ error_log = /var/log/php5-fpm.log ; Possible Values: alert, error, warning, notice, debug ; Default Value: notice ;log_level = notice +log_level = debug ; If this number of child processes exit with SIGSEGV or SIGBUS within the time ; interval set by emergency_restart_interval then FPM will restart. A value @@ -55,7 +56,7 @@ error_log = /var/log/php5-fpm.log ; Default Value: 0 ;emergency_restart_threshold = 0 -; Interval of time used by emergency_restart_interval to determine when +; Interval of time used by emergency_restart_interval to determine when ; a graceful restart will be initiated. This can be useful to work around ; accidental corruptions in an accelerator's shared memory. ; Available Units: s(econds), m(inutes), h(ours), or d(ays) @@ -87,11 +88,11 @@ error_log = /var/log/php5-fpm.log ; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging. ; Default Value: yes ;daemonize = yes - + ; Set open file descriptor rlimit for the master process. ; Default Value: system defined value ;rlimit_files = 1024 - + ; Set max core size rlimit for the master process. ; Possible Values: 'unlimited' or an integer greater or equal to 0 ; Default Value: system defined value @@ -116,7 +117,7 @@ error_log = /var/log/php5-fpm.log ;systemd_interval = 10 ;;;;;;;;;;;;;;;;;;;; -; Pool Definitions ; +; Pool Definitions ; ;;;;;;;;;;;;;;;;;;;; ; Multiple pools of child processes may be started with different listening @@ -126,33 +127,4 @@ error_log = /var/log/php5-fpm.log ; To configure the pools it is recommended to have one .conf file per ; pool in the following directory: - -; TODO: I commented this out and maybe really messed things up trying to use mod_proxy_fcgi -; include=/etc/php5/fpm/pool.d/*.conf - -; FUCK IT, WE'LL DO IT LIVE! -; Riffing off of /etc/php5/conf.d/www.conf and http://www.binarytides.com/setup-apache-php-fpm-mod-proxy-fcgi-ubuntu/ - -[www] -user = www-data -group = www-data -listen = /var/run/php5-fpm.sock -; If that doesn't work: listen = 127.0.0.1:9000 - -listen.owner = www-data -listen.group = www-data -listen.mode = 0666 - -pm = dynamic -pm.max_children = 5 -pm.start_servers = 2 -pm.min_spare_servers = 1 -pm.max_spare_servers = 3 -pm.max_requests = 100 - -chdir = / -catch_workers_output = yes - -; I have no idea what I'm doing. -; http://www.geoffstratton.com/2014/05/ubuntu-14-apache-php/ -ProxyPassMatch ^/(.*\.php(/.*)?)$ unix:/run/php-fpm.sock|fcgi://localhost/srv/www +include=/etc/php5/fpm/pool.d/*.conf diff --git a/config/php5-fpm-config/www.conf b/config/php5-fpm-config/www.conf index f09396e..39a74e2 100644 --- a/config/php5-fpm-config/www.conf +++ b/config/php5-fpm-config/www.conf @@ -30,7 +30,7 @@ group = www-data ; specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php5-fpm.sock +listen = 127.0.0.1:9000 ; Set listen(2) backlog. A value of '-1' means unlimited. ; Default Value: 128 (-1 on FreeBSD and OpenBSD) diff --git a/provision/provision.sh b/provision/provision.sh index 686b987..e24fc94 100755 --- a/provision/provision.sh +++ b/provision/provision.sh @@ -252,7 +252,6 @@ fi # that this section will be removed after everyone has had a fair chance. With # a `vagrant destroy`, none of this is necessary. unlink /etc/apache2/apache2.conf -unlink /etc/apache2/conf.d/php5-fpm.conf unlink /etc/php5/fpm/pool.d/www.conf unlink /etc/php5/fpm/conf.d/php-custom.ini #unlink /etc/php5/fpm/conf.d/xdebug.ini @@ -270,11 +269,9 @@ echo " * /srv/config/init/vvv-start.conf -> /etc/init/vvv-start.co # Copy Apache configuration from local cp /srv/config/apache-config/apache2.conf /etc/apache2/apache2.conf -cp /srv/config/apache-config/php5-fpm.conf /etc/apache2/conf.d/php5-fpm.conf rsync -rvzh --delete /srv/config/apache-config/sites/ /etc/apache2/custom-sites/ echo " * /srv/config/apache-config/apache2.conf -> /etc/apache2/apache2.conf" -echo " * /srv/config/apache-config/php-fpm.conf -> /etc/apache2/conf.d/php-fpm.conf" echo " * /srv/config/apache-config/sites/ -> /etc/apache2/custom-sites/" # Configure Apache for mod_proxy_fcgi @@ -285,7 +282,7 @@ a2enmod proxy_fcgi # this also enables mod_proxy a2enmod rewrite # Copy php-fpm configuration from local -cp /srv/config/php5-fpm-config/php5-fpm.conf /etc/php5/fpm/php5-fpm.conf +cp /srv/config/php5-fpm-config/php-fpm.conf /etc/php5/fpm/php-fpm.conf cp /srv/config/php5-fpm-config/www.conf /etc/php5/fpm/pool.d/www.conf cp /srv/config/php5-fpm-config/php-custom.ini /etc/php5/fpm/conf.d/php-custom.ini cp /srv/config/php5-fpm-config/opcache.ini /etc/php5/fpm/conf.d/opcache.ini @@ -295,7 +292,7 @@ cp /srv/config/php5-fpm-config/xdebug.ini /etc/php5/mods-available/xdebug.ini XDEBUG_PATH=$( find /usr -name 'xdebug.so' | head -1 ) sed -i "1izend_extension=\"$XDEBUG_PATH\"" /etc/php5/mods-available/xdebug.ini -echo " * /srv/config/php5-fpm-config/php5-fpm.conf -> /etc/php5/fpm/php5-fpm.conf" +echo " * /srv/config/php5-fpm-config/php-fpm.conf -> /etc/php5/fpm/php-fpm.conf" echo " * /srv/config/php5-fpm-config/www.conf -> /etc/php5/fpm/pool.d/www.conf" echo " * /srv/config/php5-fpm-config/php-custom.ini -> /etc/php5/fpm/conf.d/php-custom.ini" echo " * /srv/config/php5-fpm-config/opcache.ini -> /etc/php5/fpm/conf.d/opcache.ini" From f27b338c5f16e3d4dc30baf2d7039fe70a8f807d Mon Sep 17 00:00:00 2001 From: Rich Pav Date: Sun, 12 Oct 2014 20:43:21 +0900 Subject: [PATCH 30/30] Touch-ups to upgrade versions & add latest updates from VVV. --- CONTRIBUTING.md | 37 +++++++++++++++++++++++++++++++++++++ LICENSE | 21 +++++++++++++++++++++ provision/provision.sh | 34 +++++++++++++++++----------------- www/default/index.php | 4 ++-- 4 files changed, 77 insertions(+), 19 deletions(-) create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..002bade --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,37 @@ +# Contributing to VVV + +Contributions to the VVV project are more than welcome. + +## License + +By contributing code to the [VVV project](https://github.com/varying-vagrant-vagrants/vvv/), you agree to license your contribution under the [MIT License](https://github.com/varying-vagrant-vagrants/vvv/blog/master/LICENSE). + +## Issues + +Open a GitHub issue for anything. We've covered quite a bit of ground through the first year, so it would be helfpul to search for related topics first. That said, don't worry if you find yourself opening something that sounds like it could be obvious. There is no such thing. + +## Comments + +Comment on any GitHub issue, open or closed. The only guidelines here are to be friendly and welcoming. If you see that a question has been asked and you think you know the answer, don't wait! + +## Pull Requests + +Submit a pull request at any time, whether an issue has been created or not. It may be helpful to discuss your goals in an issue first, though many things can best be shown with code. + +We do ask that the pull request be submitted against the current **master** branch. Every effort is made to make the pull request as stable as possible before merging it in, so we aren't too worried. A list of stable releases is maintained as we go and can be used by anyone concerned by ongoing development. + +It may make sense that a feature branch is created so that several contributors can work together. In this case, it is possible that write access to the VVV repository will be given liberally. You may be asked to submit your pull request against a feature branch so that it can be merged and worked on with others before going in to master. + +## Milestones and Labels + +Some loose organization has grown around milestones and labels. We'll often have the next two versions listed for selection as a milestone. Things like bugs, enhancements, docs, etc... are listed as labels. + +## Code Style + +### Bash Scripting + +For any shell scripting that we do in Bash — see `provision.sh` — we try to follow the style provided in Google's [Shell Style Guide](http://google-styleguide.googlecode.com/svn/trunk/shell.xml). + +### PHP + +For any PHP, we try to follow the WordPress core [code standards](http://make.wordpress.org/core/handbook/coding-standards/). \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..eec6da3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 the contributors of the VVV project + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/provision/provision.sh b/provision/provision.sh index e24fc94..485c6ee 100755 --- a/provision/provision.sh +++ b/provision/provision.sh @@ -151,17 +151,17 @@ if [[ $ping_result == *bytes?from* ]]; then # the packages that we are installing from non standard sources via # our appended apt source.list - # Launchpad Subversion key EAA903E3A2F4C039 - gpg -q --keyserver keyserver.ubuntu.com --recv-key EAA903E3A2F4C039 - gpg -q -a --export EAA903E3A2F4C039 | apt-key add - + # Launchpad Subversion key EAA903E3A2F4C039 + gpg -q --keyserver keyserver.ubuntu.com --recv-key EAA903E3A2F4C039 + gpg -q -a --export EAA903E3A2F4C039 | apt-key add - - # Launchpad PHP key 4F4EA0AAE5267A6C - gpg -q --keyserver keyserver.ubuntu.com --recv-key 4F4EA0AAE5267A6C - gpg -q -a --export 4F4EA0AAE5267A6C | apt-key add - + # Launchpad PHP key 4F4EA0AAE5267A6C + gpg -q --keyserver keyserver.ubuntu.com --recv-key 4F4EA0AAE5267A6C + gpg -q -a --export 4F4EA0AAE5267A6C | apt-key add - - # Launchpad git key A1715D88E1DF1F24 - gpg -q --keyserver keyserver.ubuntu.com --recv-key A1715D88E1DF1F24 - gpg -q -a --export A1715D88E1DF1F24 | apt-key add - + # Launchpad git key A1715D88E1DF1F24 + gpg -q --keyserver keyserver.ubuntu.com --recv-key A1715D88E1DF1F24 + gpg -q -a --export A1715D88E1DF1F24 | apt-key add - # Launchpad nodejs key C7917B12 gpg -q --keyserver keyserver.ubuntu.com --recv-key C7917B12 @@ -201,14 +201,14 @@ if [[ $ping_result == *bytes?from* ]]; then echo "ack-grep already installed" else echo "Installing ack-grep as ack" - curl -s http://beyondgrep.com/ack-2.04-single-file > /usr/bin/ack && chmod +x /usr/bin/ack + curl -s http://beyondgrep.com/ack-2.14-single-file > /usr/bin/ack && chmod +x /usr/bin/ack fi # COMPOSER # # Install or Update Composer based on current state. Updates are direct from # master branch on GitHub repository. - if [[ -n "$(composer --version | grep -q 'Composer version')" ]]; then + if [[ -n "$(composer --version --no-ansi | grep 'Composer version')" ]]; then echo "Updating Composer..." COMPOSER_HOME=/usr/local/src/composer composer self-update COMPOSER_HOME=/usr/local/src/composer composer global update @@ -218,10 +218,10 @@ if [[ $ping_result == *bytes?from* ]]; then chmod +x composer.phar mv composer.phar /usr/local/bin/composer - COMPOSER_HOME=/usr/local/src/composer composer -q global require --no-update phpunit/phpunit:4.0.* + COMPOSER_HOME=/usr/local/src/composer composer -q global require --no-update phpunit/phpunit:4.2.* COMPOSER_HOME=/usr/local/src/composer composer -q global require --no-update phpunit/php-invoker:1.1.* - COMPOSER_HOME=/usr/local/src/composer composer -q global require --no-update mockery/mockery:0.8.* - COMPOSER_HOME=/usr/local/src/composer composer -q global require --no-update d11wtq/boris:v1.0.2 + COMPOSER_HOME=/usr/local/src/composer composer -q global require --no-update mockery/mockery:0.9.* + COMPOSER_HOME=/usr/local/src/composer composer -q global require --no-update d11wtq/boris:v1.0.8 COMPOSER_HOME=/usr/local/src/composer composer -q global config bin-dir /usr/local/bin COMPOSER_HOME=/usr/local/src/composer composer global update fi @@ -478,7 +478,7 @@ if [[ $ping_result == *bytes?from* ]]; then if [[ ! -d /srv/www/wordpress-default ]]; then echo "Downloading WordPress Stable, see http://wordpress.org/" cd /srv/www/ - curl -O http://wordpress.org/latest.tar.gz + curl -L -O https://wordpress.org/latest.tar.gz tar -xvf latest.tar.gz mv wordpress wordpress-default rm latest.tar.gz @@ -563,9 +563,9 @@ PHP if [[ ! -d /srv/www/default/database-admin ]]; then echo "Downloading phpMyAdmin 4.2.7.1..." cd /srv/www/default - wget -q -O phpmyadmin.tar.gz 'http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/4.2.7.1/phpMyAdmin-4.2.7.1-all-languages.tar.gz/download' + wget -q -O phpmyadmin.tar.gz 'http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/4.2.9/phpMyAdmin-4.2.9-all-languages.tar.gz/download' tar -xf phpmyadmin.tar.gz - mv phpMyAdmin-4.2.7.1-all-languages database-admin + mv phpMyAdmin-4.2.9-all-languages database-admin rm phpmyadmin.tar.gz else echo "PHPMyAdmin already installed." diff --git a/www/default/index.php b/www/default/index.php index 579554b..b9fbb85 100644 --- a/www/default/index.php +++ b/www/default/index.php @@ -31,8 +31,8 @@