From 47c5537d34155e1330b4f49a79302054147d37db Mon Sep 17 00:00:00 2001 From: TobiasBg Date: Mon, 20 Oct 2014 22:41:12 +0200 Subject: [PATCH 1/3] Extend the Vagrantfile to also run with the Parallels Desktop Provider plugin for Vagrant. See https://github.com/Varying-Vagrant-Vagrants/VVV/issues/479. --- Vagrantfile | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Vagrantfile b/Vagrantfile index 0e756d7c1..8d9d47caa 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -17,6 +17,13 @@ Vagrant.configure("2") do |config| v.customize ["modifyvm", :id, "--natdnsproxy1", "on"] end + # Configuration options for the Parallels Provider + config.vm.provider :parallels do |v| + v.update_guest_tools = true + v.optimize_power_consumption = false + v.memory = 1024 + end + # Forward Agent # # Enable agent forwarding on vagrant ssh commands. This allows you to use identities @@ -30,6 +37,11 @@ Vagrant.configure("2") do |config| # to your host computer, it is cached for future use under the specified box name. config.vm.box = "ubuntu/trusty64" + # The Parallels Provider uses a different naming scheme. + config.vm.provider :parallels do |v, override| + override.vm.box = "parallels/ubuntu-14.04" + end + config.vm.hostname = "vvv" # Local Machine Hosts @@ -111,6 +123,13 @@ Vagrant.configure("2") do |config| else config.vm.synced_folder "database/data/", "/var/lib/mysql", :extra => 'dmode=777,fmode=777' end + + # The Parallels Provider does not understand "dmode"/"fmode" in the "mount_options" as + # those are specific to Virtualbox. The folder is therefore overridden with one that + # uses corresponding Parallels mount options. + config.vm.provider :parallels do |v, override| + override.vm.synced_folder "database/data/", "/var/lib/mysql", :mount_options => [ "share" ] + end end # /srv/config/ @@ -138,6 +157,13 @@ Vagrant.configure("2") do |config| config.vm.synced_folder "www/", "/srv/www/", :owner => "www-data", :extra => 'dmode=775,fmode=774' end + # The Parallels Provider does not understand "dmode"/"fmode" in the "mount_options" as + # those are specific to Virtualbox. The folder is therefore overridden with one that + # uses corresponding Parallels mount options. + config.vm.provider :parallels do |v, override| + override.vm.synced_folder "www/", "/srv/www/", :owner => "www-data", :mount_options => [ "share" ] + end + # Customfile - POSSIBLY UNSTABLE # # Use this to insert your own (and possibly rewrite) Vagrant config lines. Helpful From 394f0075d8c8267ef935068c8e618c01a72c949f Mon Sep 17 00:00:00 2001 From: TobiasBg Date: Sun, 26 Oct 2014 13:58:05 +0100 Subject: [PATCH 2/3] Remove the `"share"` mount option in the synced folder config for the Parallels Provider. With that, the file owner is not set to `www-data`, but to `vagrant`. --- Vagrantfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 8d9d47caa..48e145336 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -128,7 +128,7 @@ Vagrant.configure("2") do |config| # those are specific to Virtualbox. The folder is therefore overridden with one that # uses corresponding Parallels mount options. config.vm.provider :parallels do |v, override| - override.vm.synced_folder "database/data/", "/var/lib/mysql", :mount_options => [ "share" ] + override.vm.synced_folder "database/data/", "/var/lib/mysql", :mount_options => [] end end @@ -161,7 +161,7 @@ Vagrant.configure("2") do |config| # those are specific to Virtualbox. The folder is therefore overridden with one that # uses corresponding Parallels mount options. config.vm.provider :parallels do |v, override| - override.vm.synced_folder "www/", "/srv/www/", :owner => "www-data", :mount_options => [ "share" ] + override.vm.synced_folder "www/", "/srv/www/", :owner => "www-data", :mount_options => [] end # Customfile - POSSIBLY UNSTABLE From 2334e2a0685d78818a595d1f03b0788e06983a8c Mon Sep 17 00:00:00 2001 From: TobiasBg Date: Sun, 26 Oct 2014 14:10:08 +0100 Subject: [PATCH 3/3] Run `tar` and `npm` as the `vagrant` user instead of `root`. The Parallels Provider does not support `chown` (see https://github.com/Parallels/vagrant-parallels/issues/103#issuecomment-51479461), which `tar -x` (see https://github.com/fgrehm/vagrant-cachier/issues/53#issuecomment-27364917) and `npm install` need/run at one point or the other, if they are invoked as `root`. Following the approach from https://github.com/Varying-Vagrant-Vagrants/VVV/pull/370#issuecomment-44260526, `tar` and `npm` can be run as the `vagrant` user, as untaring and npm are done in the user directory and don't require root permissions. --- provision/provision.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/provision/provision.sh b/provision/provision.sh index 75a23335a..b387c9087 100755 --- a/provision/provision.sh +++ b/provision/provision.sh @@ -364,9 +364,11 @@ else echo -e "\nMySQL is not installed. No databases imported." fi -# Run wp-cli as vagrant user +# Run wp-cli, tar, and npm as `vagrant` user instead of `root` if (( $EUID == 0 )); then wp() { sudo -EH -u vagrant -- wp "$@"; } + tar() { sudo -EH -u vagrant -- tar "$@"; } + npm() { sudo -EH -u vagrant -- npm "$@"; } fi if [[ $ping_result == *bytes?from* ]]; then