Skip to content

Commit

Permalink
chore: fix instruction + add troubleshooting note (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
laras126 authored Jan 4, 2022
1 parent d32e434 commit 5cc798e
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ This repo holds both a complete `config.yml` for VVV as well as the tools to upd

## Prerequisites

1. Install [VirtualBox](https://www.virtualbox.org/)
1. **Note for macOS 10.14 and above:** Due to updated security controls in macOS, VirtualBox will not install correctly unless you add Oracle's Developer ID to `spctl`.
1. Install [VirtualBox](https://www.virtualbox.org/)
1. **Note for macOS 10.14 and above:** Due to updated security controls in macOS, VirtualBox will not install correctly unless you add Oracle's Developer ID to `spctl`.
1. `spctl` is a command-line interface to the same security assessment policy subsystem that Gatekeeper uses. Like Gatekeeper, `spctl` will only accept Developer ID-signed apps and apps downloaded from the Mac App Store by default. It will reject apps signed with Mac App Store development or distribution certificates.
1. The next step involved rebooting your computer and typing commands in the terminal when you can't access the internet or filesystem. Print or write down the following instructions.
1. Reboot into recovery mode (reboot and hold `Command` and `R` when the Apple logo appears, then release). Then open the Terminal (Utilities menu > Terminal) and type:
1. The next step involved rebooting your computer and typing commands in the terminal when you can't access the internet or filesystem. Print or write down the following instructions.
1. Reboot into recovery mode (reboot and hold `Command` and `R` until the Apple logo appears, then release). Then open the Terminal (Utilities menu > Terminal) and type:
```bash
$ spctl kext-consent add VB5E2TV963
$ reboot
```
1. After reboot, install VirtualBox as normal and follow the instructions for enabling it via the Security & Privacy settings tab.
1. After reboot, install VirtualBox as normal and follow the instructions for enabling it via the Security & Privacy settings tab.
1. Install [Vagrant](https://www.vagrantup.com/)
1. Install VVV (Follow the "Installing VVV" steps here: https://varyingvagrantvagrants.org/docs/en-US/installation/#installing-vvv)

Expand All @@ -38,8 +38,8 @@ This repo holds both a complete `config.yml` for VVV as well as the tools to upd
approximately 3.5 minutes to provision.
1. If desired, add optional PMC utilities to the `utilities.pmc` array towards
the end of the copied `config.yml`.
1. Towards the bottom of the copied `config.yml`,
you may adjust the `vm_config` and `disksize` values if needed,
1. Towards the bottom of the copied `config.yml`,
you may adjust the `vm_config` and `disksize` values if needed,
such as when working with databases from some of our larger sites.
1. Provision Vagrant (i.e. install dependencies for the first time) as usual:
```bash
Expand Down Expand Up @@ -69,7 +69,7 @@ Password: `pmcdev`
For each site you provision, e.g. Sportico, you may run the theme and pmc-plugins unit tests by following the steps below. Do steps 1-3 once, and steps 4+ for each provisioned site, e.g. Sportico, WWD, etc.. The basic concept here is that we copy the testing tools from wordpress-develop into each provisioned site.
NOTE, Ideally, we could provision wordpress-trunk into VVV via https://github.com/Varying-Vagrant-Vagrants/custom-site-template-develop (by setting skip_provisioning: false in config.yml) as it provides phpunit, test database, and the wp test suite. However, it forces you to use the latest (unreleased) version. Using its master branch can/has lead to issues when running tests with our pmc-unit-test bootstrap.php. Due to this, we setup the test environment manually (steps 1-3 below).
NOTE, Ideally, we could provision wordpress-trunk into VVV via https://github.com/Varying-Vagrant-Vagrants/custom-site-template-develop (by setting skip_provisioning: false in config.yml) as it provides phpunit, test database, and the wp test suite. However, it forces you to use the latest (unreleased) version. Using its master branch can/has lead to issues when running tests with our pmc-unit-test bootstrap.php. Due to this, we setup the test environment manually (steps 1-3 below).
1. Install phpunit
```bash
Expand All @@ -81,7 +81,7 @@ NOTE, Ideally, we could provision wordpress-trunk into VVV via https://github.co
$ sudo mkdir -p /usr/share/php/phpunit
$ cd /usr/share/php/phpunit
$ sudo composer require --dev phpunit/phpunit ^7 --update-with-all-dependencies
$ sudo ln -sf /usr/share/php/phpunit/vendor/bin/phpunit /usr/bin/phpunit
$ sudo ln -sf /usr/share/php/phpunit/vendor/bin/phpunit /usr/bin/phpunit
```
1. Get the WP Test Suite
```bash
Expand Down Expand Up @@ -127,7 +127,7 @@ NOTE, Ideally, we could provision wordpress-trunk into VVV via https://github.co
define( 'PMC_IS_VIP_GO_SITE', true );
define( 'VIP_GO_APP_ENVIRONMENT', 'development' );
```
1. Run tests
1. Run tests
1. Note, we must tell PHPUnit where our test bootstraps are located. Note, this must be done each time you SSH into vagrant (See below PHPStorm docs to automate this). Note, change `sportico-com` to the site you're testing within.
2. Note, if xdebug is enabled your tests will run VERY slowly. See https://varyingvagrantvagrants.org/docs/en-US/references/xdebug/ Only enable xdebug while testing if you wish to step-through debug your tests or generate a code coverage report.
```bash
Expand All @@ -139,13 +139,13 @@ NOTE, Ideally, we could provision wordpress-trunk into VVV via https://github.co
You can add these variables to your bash, but make sure they are at the bottom of ~/.bash_profile as not to conflict with vvv's settings.
$ export PMC_PHPUNIT_BOOTSTRAP=/srv/www/sportico-com/public_html/wp-content/plugins/pmc-plugins/pmc-unit-test/bootstrap.php
$ export WP_TESTS_DIR=/srv/www/sportico-com/public_html/tests/phpunit
# If you edited ~/.bash_profile reload it.
$ source ~/.bash_profile
# Navigate to a pmc-plugin or a theme where `phpunit.xml` exists. E.g.
$ cd /srv/www/sportico-com/public_html/wp-content/plugins/pmc-plugins/pmc-piano/
# Run tests
$ phpunit
```
Expand Down Expand Up @@ -203,7 +203,7 @@ There are several options for adopting the latest VVV configuration.
## Miscellaneous Issues
### 03/11/2021
Error: During `vagrant up --provision` encountered `default: sudo: unable to execute /usr/local/bin/wp: Permission denied`. Upon SSHing into Vagrant (`vagrant ssh`) noted with `ls -al /usr/local/bin/wp` that this wp-cli script was owned by `root` and within the group `root`.
Error: During `vagrant up --provision` encountered `default: sudo: unable to execute /usr/local/bin/wp: Permission denied`. Upon SSHing into Vagrant (`vagrant ssh`) noted with `ls -al /usr/local/bin/wp` that this wp-cli script was owned by `root` and within the group `root`.
Fix: While SSH'd into Vagrant, delete wp-cli with `rm /usr/local/bin/wp` then provision again. Afterwards, wp-cli was properly owned by `vagrant` user and within the `www-data` group.
Expand Down Expand Up @@ -238,6 +238,12 @@ Updating the vagrant-goodhosts plugin to 1.0.18 causes the error `check_hostname
Goodhosts has acknowledged the error in this [this Github issue](https://github.com/goodhosts/vagrant/issues/40#issuecomment-940871327).
Rolling back to 1.0.17 or a later version with the fix should fix the issue.
### 12/30/2021
When provisioning, getting an SSH error:
```
The SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed.
```
This could be from a reboot on Mac OS which clears existing SSH keys. In that case, re-add the key with `ssh-add -K /path/to/private/key`
## Related repos:
Expand Down

0 comments on commit 5cc798e

Please sign in to comment.