Skip to content

Commit

Permalink
Merge pull request #2652 from Varying-Vagrant-Vagrants/develop
Browse files Browse the repository at this point in the history
v3.11 PR
  • Loading branch information
tomjn authored Mar 14, 2023
2 parents 5b3aa20 + 80d4555 commit d28080c
Show file tree
Hide file tree
Showing 17 changed files with 211 additions and 63 deletions.
31 changes: 23 additions & 8 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,45 @@ body:
- type: dropdown
id: version
attributes:
label: Are you using the latest stable or develop branch version of VVV?
description: Newer versions of VVV may have fixed your problem already.
label: "Are you using the latest stable or develop branch version of VVV?"
description: "Newer versions of VVV may have fixed your problem already. The `master` branch is unsupported."
multiple: false
options:
- 'Yes (develop)'
- 'Yes (stable)'
- 'No'
- 'No (unsupported master branch)'
- "Don't know"
validations:
required: true
- type: dropdown
id: new_or_existng
attributes:
label: Is it a new VVV or an existing VVV that used to work?
label: Is it a new VVV, or an existing VVV that used to work?
multiple: false
options:
- 'Existing, worked but now broken'
- 'New fresh install'
- "Don't know"
validations:
required: true
- type: dropdown
id: customfiles
attributes:
label: "Did you use a CustomFile?"
description: "Some people add a `CustomFile` to make unsupported vagrant modifications. If you did this you must share what you changed in the issue."
multiple: false
options:
- 'No (default)'
- 'Yes'
- "Don't know"
validations:
required: true
- type: textarea
attributes:
label: Whats the problem?
description: |
Be as descriptive as possible!!!
Be as descriptive as possible!!! Include the output log, including lines above and below it. Most of the waiting time is us waiting for issue reporters to share the full log.
validations:
required: true
- type: textarea
Expand All @@ -43,10 +56,10 @@ body:
required: false
- type: textarea
attributes:
label: VVV Status screen
label: "What is the output of `vagrant status`"
render: shell
description: |
Run `vagrant status` and copy paste the result here
Run `vagrant status` and copy paste the result here, this has a lot of important debug data, if you do not include it we will still ask for it regardless.
placeholder: |
__ __ __ __
\ V\ V\ V / v1.2.3 Path:"/Users/janedoe/vvv-local"
Expand All @@ -64,7 +77,7 @@ body:
multiple: false
options:
- 'Apple MacOS (Intel)'
- 'Apple MacOS (Arm/Apple Silicon)'
- 'Apple MacOS (Arm64/Apple Silicon)'
- 'Microsoft Windows'
- 'Linux'
- 'Other'
Expand All @@ -76,7 +89,9 @@ body:
label: Which provider are you using?
multiple: false
options:
- 'VirtualBox'
- 'VirtualBox 7'
- 'VirtualBox 6'
- 'VirtualBox 5'
- 'Parallels (Intel)'
- 'Parallels (Apple Silicon/Arm)'
- 'Hyper-V'
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@ permalink: /docs/en-US/changelog/

# Changelog

## 3.11.0 ( 2023 March 14th )

### Enhancements

* Added a fallback Nginx config for sites that don't specify a site provisioner ( #2279 )
* Sites that do not have a provisioner set will have a logs folder created for Nginx logs,and a public_html folder with Nginx rules for WordPress or other PHP applications. The user is responsible for creating a database and installing/placing a site.
* Simplified PHPCS installation bin dir setting ( #2648 )
* Virtualbox users running `sudo vagrant` commands now get a warning
* Fixed setting of git rebase config for the vagrant nonroot user ( #2658 )
* Added composer bin directory to path ( #2588 )

### Bug Fixes

* Fixed faulty Vagrant plugin check.
* A fix for setting the PHP version parameter ( #2644 )

## 3.10.1 ( 2022 September 10th )

### Enhancements
Expand All @@ -14,6 +30,7 @@ permalink: /docs/en-US/changelog/
* VVV will now attempt to test Nginx configs on installation and recover ( #2604 )
* Switched to new launchpad PPA domains with HTTPS ( #2586 )
* Improved the verboseness of the DB import scripts ( #2621 )
* PHP version parameter for provisioner and Nginx ( #2583 )

### Bug Fixes

Expand Down
49 changes: 30 additions & 19 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version '>= 2.2.4'
require 'yaml'
require 'fileutils'
require 'pathname'

def sudo_warnings
red = "\033[38;5;9m" # 124m"
Expand Down Expand Up @@ -329,6 +330,18 @@ ENV['LC_ALL'] = 'en_US.UTF-8'
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# VirtualBox
config.vm.provider :virtualbox do |v|
unless Vagrant::Util::Platform.windows?
if Process.uid == 0
machine_id_file=Pathname.new(".vagrant/machines/default/virtualbox/id")
unless machine_id_file.exist?()
puts "#{red} ⚠ DANGER VAGRANT IS RUNNING AS ROOT/SUDO, DO NOT USE SUDO ⚠#{creset}"
puts " ! VVV has detected that the VM has not been created yet, and is running as root/sudo."
puts " ! Do not use sudo with VVV, do not run VVV as a root user. Aborting."
abort( "Aborting Vagrant command to prevent a critical mistake, do not use sudo/root with VVV." )
end
end
end

v.customize ['modifyvm', :id, '--uartmode1', 'file', File.join(vagrant_dir, 'log/ubuntu-cloudimg-console.log')]
v.customize ['modifyvm', :id, '--memory', vvv_config['vm_config']['memory']]
v.customize ['modifyvm', :id, '--cpus', vvv_config['vm_config']['cores']]
Expand Down Expand Up @@ -398,13 +411,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# This is disabled, we had several contributors who ran into issues.
# See: https://github.com/Varying-Vagrant-Vagrants/VVV/issues/1551
config.ssh.insert_key = false

# Default Ubuntu Box
#
# This box is provided by Bento boxes via vagrantcloud.com and is a nicely sized
# box containing the Ubuntu 20.04 Focal 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 = 'bento/ubuntu-20.04'
config.vm.box_check_update = false

# The Parallels Provider uses a different naming scheme.
Expand Down Expand Up @@ -432,6 +438,11 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

# Virtualbox.
config.vm.provider :virtualbox do |_v, override|
# Default Ubuntu Box
#
# This box is provided by Bento boxes via vagrantcloud.com and is a nicely sized
# box containing the Ubuntu 20.04 Focal 64 bit release. Once this box is downloaded
# to your host computer, it is cached for future use under the specified box name.
override.vm.box = 'bento/ubuntu-20.04'

# If we're at a contributor day, switch the base box to the prebuilt one
Expand Down Expand Up @@ -853,29 +864,29 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# located in the www/ directory and in config/config.yml.
#

if Vagrant.has_plugin?('vagrant-goodhosts')
if config.vagrant.plugins.include? 'vagrant-goodhosts'
config.goodhosts.aliases = vvv_config['hosts']
config.goodhosts.remove_on_suspend = true
elsif Vagrant.has_plugin?('vagrant-hostsmanager')

# goodhosts already disables clean by default, but lets enforce this at both ends
config.goodhosts.disable_clean = true
elsif config.vagrant.plugins.include? 'vagrant-hostsmanager'
config.hostmanager.aliases = vvv_config['hosts']
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.manage_guest = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
elsif Vagrant.has_plugin?('vagrant-hostsupdater')
elsif config.vagrant.plugins.include? 'vagrant-hostsupdater'
# Pass the found host names to the hostsupdater plugin so it can perform magic.
config.hostsupdater.aliases = vvv_config['hosts']
config.hostsupdater.remove_on_suspend = true
else
show_check = true if %w[up halt resume suspend status provision reload].include? ARGV[0]
if show_check
puts ""
puts " X ! There is no hosts file vagrant plugin installed!"
puts " X You need the vagrant-goodhosts plugin (or HostManager/ HostsUpdater ) for domains to work in the browser"
puts " X Run 'vagrant plugin install --local' to fix this."
puts ""
end
elsif %w[up halt resume suspend status provision reload].include? ARGV[0]
puts ""
puts " X ! There is no hosts file vagrant plugin installed!"
puts " X You need the vagrant-goodhosts plugin (or HostManager/ HostsUpdater ) for domains to work in the browser"
puts " X Run 'vagrant plugin install --local' to fix this."
puts ""
end

# Vagrant Triggers
Expand Down
1 change: 1 addition & 0 deletions config/default-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ sites:
skip_provisioning: false
description: "A standard WP install, useful for building plugins, testing things, etc"
repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template.git
php: 7.4 # change the PHP version to use for the provision and nginx
custom:
# locale: it_IT
delete_default_plugins: true
Expand Down
2 changes: 1 addition & 1 deletion config/homebin/switch_php_debugmod
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ enable_phpmod() {
}

is_module_enabled_fpm() {
if [ -f "/var/lib/php/modules/${1}/fpm/enabled_by_admin/${2}" ]; then
if [ -f "/var/lib/php/modules/${1}/fpm/enabled_by_admin/${2}" ] || [ -f "/var/lib/php/modules/${1}/fpm/enabled_by_maint/${2}" ]; then
return 0
fi
return 1
Expand Down
17 changes: 10 additions & 7 deletions config/homebin/vvv_restore_php_default
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#!/bin/bash

DEFAULTPHP="7.4"
echo " * Restoring the default PHP CLI version ( ${DEFAULTPHP} )"
update-alternatives --set php "/usr/bin/php${DEFAULTPHP}"
update-alternatives --set phar "/usr/bin/phar${DEFAULTPHP}"
update-alternatives --set phar.phar "/usr/bin/phar.phar${DEFAULTPHP}"
update-alternatives --set phpize "/usr/bin/phpize${DEFAULTPHP}"
update-alternatives --set php-config "/usr/bin/php-config${DEFAULTPHP}"
echo " * Restoration complete"
php_version=$(readlink -f /usr/bin/php)
if [[ $php_version != *"${DEFAULTPHP}"* ]]; then
echo " * Restoring the default PHP CLI version ( ${DEFAULTPHP} )"
update-alternatives --set php "/usr/bin/php${DEFAULTPHP}"
update-alternatives --set phar "/usr/bin/phar${DEFAULTPHP}"
update-alternatives --set phar.phar "/usr/bin/phar.phar${DEFAULTPHP}"
update-alternatives --set phpize "/usr/bin/phpize${DEFAULTPHP}"
update-alternatives --set php-config "/usr/bin/php-config${DEFAULTPHP}"
echo " * Restoration complete"
fi
1 change: 0 additions & 1 deletion provision/core/deprecated.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# @description Check if we're on Ubuntu 14 and abort provisioning
# @noargs
function deprecated_distro() {
local command_exist
if ! command -v lsb_release &> /dev/null; then
return 0
fi
Expand Down
6 changes: 6 additions & 0 deletions provision/core/env/homedir/.bash_aliases
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ if [ -d "$HOME/.gem/bin" ] ; then
fi
fi

if [ -d "$HOME/.config/composer/vendor/bin" ] ; then
if [[ $PATH != *"${HOME}/.config/composer/vendor/bin"* ]]; then
export PATH="$PATH:${HOME}/.config/composer/vendor/bin"
fi
fi

# Vagrant scripts
if [[ $PATH != *"/srv/config/homebin"* ]]; then
export PATH="$PATH:/srv/config/homebin"
Expand Down
5 changes: 3 additions & 2 deletions provision/core/env/homedir/.bash_profile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
# bash_profile
#
# Symlinked to the vagrant user's home directory. This loads
Expand Down Expand Up @@ -29,8 +30,8 @@ PS1="${debian_chroot:+($debian_chroot)}${red}\u${green}@${blue}\h${white}:${yell
# setup bash prompt
if [ -n "$BASH_VERSION" ]; then
# include .bash_prompt if it exists
if [ -f "$HOME/.bash_prompt" ]; then
. "$HOME/.bash_prompt"
if [ -f "${HOME}/.bash_prompt" ]; then
. "${HOME}/.bash_prompt"
fi
fi

Expand Down
4 changes: 4 additions & 0 deletions provision/core/git/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,9 @@ function git_after_packages() {
vvv_info " * Git hasn't been told how to merge branches, setting pull.rebase false for the merge strategy"
git config --global pull.rebase false
fi
if ! noroot git config --global pull.rebase; then
vvv_info " * Git hasn't been told how to merge branches, setting pull.rebase false for the merge strategy"
noroot git config --global pull.rebase false
fi
}
vvv_add_hook after_packages git_after_packages
23 changes: 23 additions & 0 deletions provision/core/nginx/config/site-fallback.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
server {
listen 80;
listen 443 ssl http2;
server_name {vvv_hosts};
root "{vvv_path_to_site}/public_html";

# Nginx logs
error_log "{vvv_path_to_site}/log/nginx-error.log";
access_log "{vvv_path_to_site}/log/nginx-access.log";

# Enable server push if SSL/HTTP2 is being used for link preload headers
http2_push_preload on;

{vvv_tls_cert}
{vvv_tls_key}

# Nginx rules for WordPress, rewrite rules, permalinks, etc
include /etc/nginx/nginx-wp-common.conf;

location ~* \.(css|eot|gif|ico|jpeg|jpg|js|png|svg|tiff|tiff|ttf|webp|woff|woff2)$ {
expires 100d;
}
}
5 changes: 3 additions & 2 deletions provision/core/phpcs/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.2",
"automattic/vipwpcs": "^2.3.3",
"phpcompatibility/php-compatibility": "^9.3.5",
"phpcompatibility/phpcompatibility-wp": "^2.1.3"
"phpcompatibility/phpcompatibility-wp": "^2.1.4"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"bin-dir": "bin/"
}
}
2 changes: 1 addition & 1 deletion provision/core/phpcs/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function php_codesniff_setup() {
noroot mkdir -p /srv/www/phpcs
noroot cp -f "/srv/provision/core/phpcs/composer.json" "/srv/www/phpcs/composer.json"
cd /srv/www/phpcs
COMPOSER_BIN_DIR="bin" noroot composer update --no-ansi --no-progress
noroot composer update --no-ansi --no-progress --no-dev

vvv_info " * [PHPCS]: Setting WordPress-Core as the default PHPCodesniffer standard"

Expand Down
14 changes: 7 additions & 7 deletions provision/provision-helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,16 @@ function network_check() {
if (( ${#failed_hosts[@]} )); then
vvv_error "#################################################################"
vvv_error " "
vvv_error "! Network Problem:"
vvv_error "! Warning! Network Problems:"
vvv_error " "
vvv_error "VVV tried to check several domains it needs to provision but ${#failed_hosts[@]} of ${#hosts_to_test[@]} failed:"
vvv_error "VVV tried to check several domains it needs for provisioning but ${#failed_hosts[@]} of ${#hosts_to_test[@]} failed:"
vvv_error " "
for url in "${hosts_to_test[@]}"; do
echo -e "${CRESET} [${RED}x${CRESET}] ${url}${RED}|"
done
vvv_error " "
vvv_error "Make sure you have a working internet connection, that you "
vvv_error "restarted after installing VirtualBox and Vagrant, and that "
vvv_error "restarted after installing VirtualBox/Parallels/Vagrant, and that "
vvv_error "they aren't blocked by a firewall or security software."
vvv_error "If you can load the address in your browser, then VVV should"
vvv_error "be able to connect."
Expand All @@ -136,19 +136,19 @@ function network_check() {
vvv_error "provisioning involves downloading things, a full provision may "
vvv_error "ruin the wifi for everybody else :("
vvv_error " "
if ! command -v ifconfig &> /dev/null; then
if command -v ifconfig &> /dev/null; then
vvv_error "Network ifconfig output:"
vvv_error " "
ifconfig
vvv_error " "
fi
vvv_error "Aborting provision. "
vvv_error "Try provisioning again once network connectivity is restored."
vvv_error "If that doesn't work, and you're sure you have a strong "
vvv_error "If that doesn't work, and you're sure you have no VPNs and a strong "
vvv_error "internet connection, open an issue on GitHub, and include the "
vvv_error "output above so that the problem can be debugged"
vvv_error " "
vvv_error "vagrant reload --provision"
vvv_error "vagrant halt"
vvv_error "vagrant up --provision"
vvv_error " "
vvv_error "<url>https://github.com/Varying-Vagrant-Vagrants/VVV/issues</url>"
vvv_error " "
Expand Down
Loading

0 comments on commit d28080c

Please sign in to comment.