diff --git a/.gitattributes b/.gitattributes
index a88c4fac5..c7066a515 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -6,3 +6,4 @@
*.gif binary
*.jpg binary
*.jpeg binary
+*.gpg binary
diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml
index 28faf9a10..aff022239 100644
--- a/.github/ISSUE_TEMPLATE/bug-report.yml
+++ b/.github/ISSUE_TEMPLATE/bug-report.yml
@@ -94,6 +94,7 @@ body:
- 'VirtualBox 5'
- 'Parallels (Intel)'
- 'Parallels (Apple Silicon/Arm)'
+ - 'Docker'
- 'Hyper-V'
- 'VMWare'
- 'Other'
diff --git a/.github/ISSUE_TEMPLATE/monteray-virtualbox-timeouts.yml b/.github/ISSUE_TEMPLATE/monteray-virtualbox-timeouts.yml
deleted file mode 100644
index cd9c429cd..000000000
--- a/.github/ISSUE_TEMPLATE/monteray-virtualbox-timeouts.yml
+++ /dev/null
@@ -1,35 +0,0 @@
-name: I'm using VirtualBox 6.1.26/6.1.28 OR I upgraded to MacOS 12/Monterey
-description: Using VirtualBox and getting site timeouts? hostonly network adapter errors? Recently upgraded to MacOS 12?
-labels: [ 'type:support' ]
-body:
- - type: markdown
- attributes:
- value: |
- "
- ## MacOS 12 Monterey
-
- ***Do not upgrade to Monterey.***
-
- There are no known working versions of VirtualBox for MacOS 12, do not upgrade. ***VirtualBox intend to fix this in v6.1.29***.
-
- Until VirtualBox 6.1.29 is officially released, do not upgrade past MacOS 11 Big Sur. Test release builds are not guaranteed to work.
-
- The fastest way to restore VirtualBox is to downgrade back to MacOS 11 Big Sur, and use v6.1.24.
-
- ### But My New M1 Mac Only Support MacOS 12!
- Use Parallels, new Macs don't support VirtualBox.
-
- ## Timeouts and VirtualBox 6.1.26 and 6.1.28
- These versions of VirtualBox are known to have networking problems on Linux/Windows/MacOS, not everybody encounters these problems though.
- VirtualBox v6.1.24 works though, stick to v6.1.24 until we can confirm if 6.1.29 fixes the problems.
-
- ---
- "
- - type: textarea
- id: what-happened
- attributes:
- label: I have news related to this!
- description: Did they relelase 6.1.29? Is there a change to the vagrant file that can be made?
- placeholder: Tell us what you know!
- validations:
- required: true
diff --git a/.github/workflows/vvv-provisioning.yml b/.github/workflows/vvv-provisioning.yml
index 530bddd71..0ea2a8782 100644
--- a/.github/workflows/vvv-provisioning.yml
+++ b/.github/workflows/vvv-provisioning.yml
@@ -21,7 +21,7 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v4
# Make Symlinks
- name: Create Vagrant Like Environment
@@ -104,127 +104,8 @@ jobs:
MYGID=$(id -g -n)
sudo chown -R $MYUID:$MYGID "$GITHUB_WORKSPACE/log"
- - uses: actions/upload-artifact@v2
+ - uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: logs-on-docker
path: "${{ github.workspace }}/log"
-
- # This workflow contains a single job called "build"
- on-stable:
- name: MacOS 10.15 Stable Reprovision
- # The type of runner that the job will run on
- runs-on: macos-10.15
-
- # Steps represent a sequence of tasks that will be executed as part of the job
- steps:
- # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- - uses: actions/checkout@v2
- with:
- ref: stable
-
- - name: Cache Vagrant boxes
- uses: actions/cache@v2
- with:
- path: ~/.vagrant.d/boxes
- key: ${{ runner.os }}-vagrant-${{ hashFiles('Vagrantfile') }}
- restore-keys: |
- ${{ runner.os }}-vagrant-
-
- - name: install goodhosts
- run: vagrant plugin install --local
-
- - name: vagrant up (stable)
- run: vagrant up
-
- - uses: actions/checkout@v2
- with:
- clean: false
-
- - name: vagrant up (current branch)
- run: vagrant up --provision
-
- - name: tests
- run: provision/tests/macos-tests.sh
-
- - uses: actions/upload-artifact@v2
- if: ${{ always() }}
- with:
- name: logs-on-stable
- path: "${{ github.workspace }}/log"
-
- on-develop:
- name: MacOS 10.15 Develop Reprovision
- # The type of runner that the job will run on
- runs-on: macos-10.15
-
- # Steps represent a sequence of tasks that will be executed as part of the job
- steps:
- # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- - uses: actions/checkout@v2
- with:
- ref: develop
-
- - name: Cache Vagrant boxes
- uses: actions/cache@v2
- with:
- path: ~/.vagrant.d/boxes
- key: ${{ runner.os }}-vagrant-${{ hashFiles('Vagrantfile') }}
- restore-keys: |
- ${{ runner.os }}-vagrant-
-
-
- - name: install goodhosts
- run: vagrant plugin install --local
-
- - name: vagrant up (develop)
- run: vagrant up
-
- - uses: actions/checkout@v2
- with:
- clean: false
-
- - name: vagrant up (current branch)
- run: vagrant up --provision
-
- - name: tests
- run: provision/tests/macos-tests.sh
-
- - uses: actions/upload-artifact@v2
- if: ${{ always() }}
- with:
- name: logs-on-develop
- path: "${{ github.workspace }}/log"
-
- on-clean:
- name: MacOS 10.15 Clean Provision
- # The type of runner that the job will run on
- runs-on: macos-10.15
-
- # Steps represent a sequence of tasks that will be executed as part of the job
- steps:
- # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- - uses: actions/checkout@v2
-
- - name: Cache Vagrant boxes
- uses: actions/cache@v2
- with:
- path: ~/.vagrant.d/boxes
- key: ${{ runner.os }}-vagrant-${{ hashFiles('Vagrantfile') }}
- restore-keys: |
- ${{ runner.os }}-vagrant-
-
- - name: install goodhosts
- run: vagrant plugin install --local
-
- - name: vagrant up (current branch)
- run: vagrant up
-
- - name: tests
- run: provision/tests/macos-tests.sh
-
- - uses: actions/upload-artifact@v2
- if: ${{ always() }}
- with:
- name: logs-on-clean
- path: "${{ github.workspace }}/log"
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0b681f67e..67a0d319d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,10 +6,37 @@ permalink: /docs/en-US/changelog/
# Changelog
-## 3.12 ( 2023 August 3rd )
+## 3.13.1 ( 2024 June 16th )
### Enhancements
+* Switched the default PHP from v7.4 to v8.2 and ~default Node from v14 to v16~ ( #2690 )
+* Use Node 20 as the default version to match WP and Gutenberg ( #2696 )
+* WP Coding standards v3 ( #2688 )
+* VIP Coding standards v3 ( #2688 )
+* Better error messages with links to docs when trying to use a PHP version that isn't installed ( #2689 )
+* Opted out of Dotnet package telemetry ( #2689 )
+* Replace references to the Squizlab PHPCS with that from the PHPCS Standards org ( #2692 )
+* Better PHP Debug mod switching outputs and checks ( #2702 )
+* PHP Info and Xdebug info pages now state their versions ( #2702 )
+
+### Maintenance
+
+* Switch the Parallels Arm64 box from `mpasternak/focal64-arm` to `bento/ubuntu-20.04-arm64` to match x86 boxes ( #2695 )
+
+### Bug Fixes
+
+* The host file inside the VM was only adding sites with `127.0.0.1` addresses, now it adds the IPVv6 `::1` too ( #2689 )
+* Fixes for hosts file cleanup ( #2708 )
+* Removed old MacOS PR workflows, no runners available ( #2698 )
+* Replace an outdated Nginx signing key ( #2710 )
+* Don't sync clocks when using the docker provider ( #2711 )
+
+## 3.12.1 ( 2023 August 3rd )
+
+### Enhancements
+
+* Monolithic docker beta support ( #2632 )
* Added the GMP PHP extension to the default PHP installation ( #2676 )
### Maintenance
diff --git a/README.md b/README.md
index 3a9ed604e..130938dc9 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ _VVV stands for Varying Vagrant Vagrants._
## How To Use
-To use it, download and install [Vagrant](https://www.vagrantup.com) and [VirtualBox](https://www.virtualbox.org/). Then, clone this repository and run:
+To use it, download and install [Vagrant](https://www.vagrantup.com) and a provider such as [VirtualBox](https://www.virtualbox.org/), Docker, or Parallels Pro. Then, clone this repository and run:
```shell
vagrant plugin install --local
diff --git a/Vagrantfile b/Vagrantfile
index 819a39dcc..ea506a906 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -9,6 +9,7 @@ Vagrant.require_version '>= 2.2.4'
require 'yaml'
require 'fileutils'
require 'pathname'
+require 'socket'
def sudo_warnings
red = "\033[38;5;9m" # 124m"
@@ -216,9 +217,9 @@ defaults['memory'] = 2048
defaults['cores'] = 1
defaults['provider'] = 'virtualbox'
-# if Arm default to parallels
+# if Arm default to docker
if Etc.uname[:version].include? 'ARM64'
- defaults['provider'] = 'parallels'
+ defaults['provider'] = 'docker'
end
# This should rarely be overridden, so it's not included in the config/default-config.yml file.
@@ -446,7 +447,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# this seems to be the most reliable way to detect whether or not we're
# running under ARM64.
if Etc.uname[:version].include? 'ARM64'
- override.vm.box = 'mpasternak/focal64-arm'
+ override.vm.box = 'bento/ubuntu-20.04-arm64'
end
end
@@ -461,6 +462,19 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
override.vm.box = 'bento/ubuntu-20.04'
end
+ # Docker use image.
+ config.vm.provider :docker do |d, override|
+ d.image = 'pentatonicfunk/vagrant-ubuntu-base-images:20.04'
+ d.has_ssh = true
+ d.ports = [ "80:80" ] # HTTP
+ d.ports += [ "443:443" ] # HTTPS
+ d.ports += [ "3306:3306" ] # MySQL
+ d.ports += [ "8025:8025" ] # Mailhog
+
+ ## Fix goodhosts aliases format for docker
+ override.goodhosts.aliases = { '127.0.0.1' => vvv_config['hosts'], '::1' => vvv_config['hosts'] }
+ end
+
# Virtualbox.
config.vm.provider :virtualbox do |_v, override|
# Default Ubuntu Box
@@ -514,7 +528,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Access to the guest machine is only available to your local host. To provide access to
# other devices, a public network should be configured or port forwarding enabled.
#
- # Note: If your existing network is using the 192.168.50.x subnet, this default IP address
+ # Note: If your existing network is using the 192.168.56.x subnet, this default IP address
# should be changed. If more than one VM is running through VirtualBox, including other
# Vagrant machines, different subnets should be used for each.
#
@@ -884,7 +898,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if config.vagrant.plugins.include? 'vagrant-goodhosts'
config.goodhosts.aliases = vvv_config['hosts']
config.goodhosts.remove_on_suspend = true
-
+
# 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'
diff --git a/config/default-config.yml b/config/default-config.yml
index f8f0f3505..8eb09085c 100644
--- a/config/default-config.yml
+++ b/config/default-config.yml
@@ -36,7 +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
+ #php: 8.0 # change the PHP version to use for the provision and nginx
custom:
# locale: it_IT
delete_default_plugins: true
@@ -87,13 +87,10 @@ extensions:
#- mongodb # needed for Tideways/XHGui
#- tideways # PHP profiling tool, also installs xhgui check https://varyingvagrantvagrants.org/docs/en-US/references/tideways-xhgui/
#- nvm # Node Version Manager
- #- php56
- #- php70
- #- php71
- #- php72
- #- php73
#- php74
#- php80
+ #- php81
+ #- php83
# vm_config controls how Vagrant provisions the virtual machine, and can be used to
# increase the memory given to VVV and the number of CPU cores.
@@ -125,6 +122,7 @@ vm_config:
# provider: hyperv
# provider: parallels
# provider: vmware_desktop
+ # provider: docker
# General VVV options
general:
diff --git a/config/homebin/switch_php_debugmod b/config/homebin/switch_php_debugmod
index 0999a4844..4e4477762 100755
--- a/config/homebin/switch_php_debugmod
+++ b/config/homebin/switch_php_debugmod
@@ -28,9 +28,21 @@ disable_phpmods() {
for phpv in $(phpquery -V)
do
if is_module_enabled_fpm "${phpv}" "${i}"; then
- vvv_info " ✘ Disabling active PHP v${phpv} debug mod: '${i}'"
- sudo phpdismod -q -s fpm -v "${phpv}" "${i}"
- sudo phpdismod -q -s cli -v "${phpv}" "${i}"
+ #vvv_info " ✘ Disabling active PHP v${phpv} debug mod: '${i}'"
+ #sudo phpdismod -q -s fpm -v "${phpv}" "${i}"
+ #sudo phpdismod -q -s cli -v "${phpv}" "${i}"
+
+ if sudo phpdismod -q -v "${phpv}" -s fpm "${i}"; then
+ vvv_success " - ✔ Disabled ${i} for PHP v${phpv} FPM"
+ else
+ vvv_error " - x Could not disable ${i} for PHP v${phpv} FPM"
+ fi
+
+ if sudo phpdismod -q -v "${phpv}" -s cli "${i}"; then
+ vvv_success " - ✔ Disabled ${i} for PHP v${phpv} CLI"
+ else
+ vvv_error " - x Could not disable ${i} for PHP v${phpv} CLI"
+ fi
fi
done
done
@@ -40,11 +52,19 @@ enable_phpmod() {
for phpv in $(phpquery -V)
do
if is_module_installed_fpm "${phpv}" "${1}"; then
- vvv_info " * Enabling '${1}' for PHP v${phpv}"
- sudo phpenmod -q -v "${phpv}" -s fpm "${1}"
- sudo phpenmod -q -v "${phpv}" -s cli "${1}"
+ if sudo phpenmod -q -v "${phpv}" -s fpm "${1}"; then
+ vvv_success " - ✔ Enabled ${1} for PHP v${phpv} FPM"
+ else
+ vvv_error " - x Could not enable ${1} for PHP v${phpv} FPM"
+ fi
+
+ if sudo phpenmod -q -v "${phpv}" -s cli "${1}"; then
+ vvv_success " - ✔ Enabled ${1} for PHP v${phpv} CLI"
+ else
+ vvv_error " - x Could not enable ${1} for PHP v${phpv} CLI"
+ fi
else
- vvv_info " * Skipped enabling ${1} in PHP v${phpv}, module isn't installed for this version"
+ vvv_info " - ? Skipped enabling ${1} in PHP v${phpv}, module isn't installed for this version"
fi
done
}
@@ -65,9 +85,19 @@ is_module_installed_fpm() {
restart_phpfpm() {
vvv_info " * Restarting PHP FPM services so that the change takes effect"
- find /etc/init.d/ -name "php*-fpm" -exec bash -c 'sudo service "$(basename "$0")" restart' {} \;
+ if find /etc/init.d/ -name "php*-fpm" -exec bash -c 'sudo service "$(basename "$0")" restart' {} \;; then
+ vvv_success " ✔ Completed restart sequence"
+ else
+ vvv_error " x One of the PHP services failed to restart, changes may not take effect."
+ fi
}
+
+vvv_info "Attempting to disable PHP debug mods and switch to ${mod}:"
+if [[ "${mod}" == "pcov" ]]; then
+ vvv_info " * pcov supports PHP 7.1 and above, it is not available for 5.6 and 7.0"
+fi
+
disable_phpmods phpmods[@]
if [[ "${mod}" == "none" ]]; then
@@ -76,10 +106,6 @@ if [[ "${mod}" == "none" ]]; then
exit 0
fi
-if [[ "${mod}" == "pcov" ]]; then
- vvv_info " * pcov supports PHP 7.1 and above, it is not available for 5.6 and 7.0"
-fi
-
# Tideways needs 2 mods enabling
if [[ "${mod}" == "tideways" ]]; then
enable_phpmod "xhgui"
@@ -91,11 +117,11 @@ fi
if [[ "${mod}" == "xdebug" ]]; then
# Ensure the log file for xdebug is group writeable.
- vvv_info " * Making sure log/php/xdebug-remote.log is readable and present"
+ vvv_info " * Making sure log/php/xdebug-remote.log is readable and present"
sudo touch /var/log/php/xdebug-remote.log
sudo chmod 664 /var/log/php/xdebug-remote.log
fi
enable_phpmod "${mod}"
restart_phpfpm
-vvv_success " ✔ PHP Debug mod switch to ${mod} on all available PHP versions complete."
+vvv_info " ✔ PHP Debug mod switch to ${mod} on all available PHP versions complete."
diff --git a/config/homebin/vagrant_provision b/config/homebin/vagrant_provision
index f7987dfcd..84903f1c0 100755
--- a/config/homebin/vagrant_provision
+++ b/config/homebin/vagrant_provision
@@ -27,15 +27,17 @@ sudo service nginx restart
vvv_info " * Restarting MariaDB service"
sudo service mariadb restart
-if [ -x "$(command -v ntpdate)" ]; then
- vvv_info " * Syncing clocks"
- if sudo ntpdate -u ntp.ubuntu.com; then
- vvv_info " * clocks synced"
- else
- vvv_warn " - clock synchronisation failed"
- fi
-else
- vvv_info " - skipping ntpdate clock sync, not installed yet"
+if [ ! -f /.dockerenv ]; then
+ if [ -x "$(command -v ntpdate)" ]; then
+ vvv_info " * Syncing clocks"
+ if sudo ntpdate -u ntp.ubuntu.com; then
+ vvv_info " * clocks synced"
+ else
+ vvv_warn " - clock synchronisation failed"
+ fi
+ else
+ vvv_info " - skipping ntpdate clock sync, not installed yet"
+ fi
fi
RED="\033[38;5;9m"
diff --git a/config/homebin/vagrant_up b/config/homebin/vagrant_up
index a1a3dfa85..4ec3e6b6b 100755
--- a/config/homebin/vagrant_up
+++ b/config/homebin/vagrant_up
@@ -27,21 +27,36 @@ if [[ -f /srv/config/homebin/vagrant_up_custom ]]; then
/srv/config/homebin/vagrant_up_custom
fi
+# /etc/host doesn't survive restart on docker
+vvv_info " * Reinit /etc/hosts"
+vvv_update_guest_hosts
+
vvv_info " * Restarting Nginx"
sudo service nginx restart
vvv_info " * Restarting MariaDB"
sudo service mariadb restart
-if [ -x "$(command -v ntpdate)" ]; then
- vvv_info " * Syncing clocks"
- if sudo ntpdate -u ntp.ubuntu.com; then
- vvv_info " * clocks synced"
- else
- vvv_warn " - clock synchronisation failed"
- fi
-else
- vvv_info " - skipping ntpdate clock sync, not installed yet"
+vvv_info " * Restarting PHP-FPM"
+find /etc/init.d/ -name "php*-fpm" -exec bash -c 'sudo service "$(basename "$0")" restart' {} \;
+
+vvv_info " * Restarting Memcache"
+sudo service memcached restart
+
+vvv_info " * Restarting Mailhog"
+/usr/bin/env /usr/local/bin/mailhog > /dev/null 2>&1 &
+
+if [ ! -f /.dockerenv ]; then
+ if [ -x "$(command -v ntpdate)" ]; then
+ vvv_info " * Syncing clocks"
+ if sudo ntpdate -u ntp.ubuntu.com; then
+ vvv_info " * clocks synced"
+ else
+ vvv_warn " - clock synchronisation failed"
+ fi
+ else
+ vvv_info " - skipping ntpdate clock sync, not installed yet"
+ fi
fi
mkdir -p /vagrant/failed_provisioners
diff --git a/config/homebin/vvv_restore_php_default b/config/homebin/vvv_restore_php_default
index ae88fc1e0..15aca92bd 100755
--- a/config/homebin/vvv_restore_php_default
+++ b/config/homebin/vvv_restore_php_default
@@ -1,6 +1,6 @@
-#!/bin/bash
+#!/usr/bin/env bash
-DEFAULTPHP="7.4"
+DEFAULTPHP="8.2"
php_version=$(readlink -f /usr/bin/php)
if [[ $php_version != *"${DEFAULTPHP}"* ]]; then
echo " * Restoring the default PHP CLI version ( ${DEFAULTPHP} )"
diff --git a/config/init/vvv-start.conf b/config/init/vvv-start.conf
index 3a2f5c1bd..fed18dbe1 100644
--- a/config/init/vvv-start.conf
+++ b/config/init/vvv-start.conf
@@ -1,12 +1,12 @@
# vvv - necessary services at start
-description "necessary services for VVV"
+description "Necessary services for VVV"
start on runlevel [2345]
script
service nginx start
-service php7.4-fpm start
+service php8.2-fpm start
service memcached start
service mariadb start
service mailhog start
diff --git a/config/php-config/php-fpm.conf b/config/php-config/php-fpm.conf
index 1d3c5bfcc..9730f6f04 100644
--- a/config/php-config/php-fpm.conf
+++ b/config/php-config/php-fpm.conf
@@ -12,7 +12,7 @@
; 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/php/7.4/fpm/*.conf
+;include=/etc/php/8.2/fpm/*.conf
;;;;;;;;;;;;;;;;;;
; Global Options ;
@@ -22,14 +22,14 @@
; Pid file
; Note: the default prefix is /var
; Default Value: none
-pid = /run/php/php7.4-fpm.pid
+pid = /run/php/php8.2-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/php/php7.4-fpm.log
+error_log = /var/log/php/php8.2-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
@@ -126,4 +126,4 @@ error_log = /var/log/php/php7.4-fpm.log
; To configure the pools it is recommended to have one .conf file per
; pool in the following directory:
-include=/etc/php/7.4/fpm/pool.d/*.conf
+include=/etc/php/8.2/fpm/pool.d/*.conf
diff --git a/config/php-config/php-www.conf b/config/php-config/php-www.conf
index bbf3005e5..b129af05b 100644
--- a/config/php-config/php-www.conf
+++ b/config/php-config/php-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/php7.4-fpm.sock
+listen = /var/run/php8.2-fpm.sock
; Set listen(2) backlog. A value of '-1' means unlimited.
; Default Value: 128 (-1 on FreeBSD and OpenBSD)
diff --git a/config/php-config/upstream.conf b/config/php-config/upstream.conf
index e37744da1..9adefe64c 100644
--- a/config/php-config/upstream.conf
+++ b/config/php-config/upstream.conf
@@ -1,4 +1,4 @@
# Upstream to abstract backend connection(s) for PHP.
-upstream php74 {
- server unix:/var/run/php7.4-fpm.sock;
+upstream php82 {
+ server unix:/var/run/php8.2-fpm.sock;
}
diff --git a/provision/core/env/homedir/.bash_profile b/provision/core/env/homedir/.bash_profile
index 49c6fc610..1fca90f6a 100644
--- a/provision/core/env/homedir/.bash_profile
+++ b/provision/core/env/homedir/.bash_profile
@@ -14,6 +14,9 @@ if [ -n "$BASH_VERSION" ]; then
fi
fi
+# Telemetry opt outs
+export DOTNET_CLI_TELEMETRY_OPTOUT=1
+
export PATH="$PATH:/srv/www/phpcs/bin"
# set variable identifying the chroot you work in (used in the prompt below)
diff --git a/provision/core/git/provision.sh b/provision/core/git/provision.sh
index 6fef4bc30..8bf7f08f4 100644
--- a/provision/core/git/provision.sh
+++ b/provision/core/git/provision.sh
@@ -58,7 +58,8 @@ function git_after_packages() {
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
- git config --global --add safe.directory '*' # Allow git to work well under docker provider
- noroot git config --global --add safe.directory '*' # Allow git to work well under docker provider
+
+ git config --global --add safe.directory '*'
+ noroot git config --global --add safe.directory '*'
}
vvv_add_hook after_packages git_after_packages
diff --git a/provision/core/mailhog/provision.sh b/provision/core/mailhog/provision.sh
index 75b13430a..99154f63a 100644
--- a/provision/core/mailhog/provision.sh
+++ b/provision/core/mailhog/provision.sh
@@ -45,11 +45,14 @@ function mailhog_setup() {
# Start on reboot
if [ "${VVV_DOCKER}" != 1 ]; then
+ # no systemd
vvv_info " * Enabling MailHog Service"
- systemctl enable mailhog
+ # systemctl enable mailhog
vvv_info " * Starting MailHog Service"
- systemctl start mailhog
+ # systemctl start mailhog
+ /usr/bin/env /usr/local/bin/mailhog > /dev/null 2>&1 &
+ vvv_info " * Started MailHog Service"
fi
}
export -f mailhog_setup
@@ -57,9 +60,7 @@ export -f mailhog_setup
vvv_add_hook after_packages mailhog_setup
function mailhog_restart() {
- if [ "${VVV_DOCKER}" != 1 ]; then
- service mailhog restart
- fi
+ killall mailhog; /usr/bin/env /usr/local/bin/mailhog > /dev/null 2>&1 &
}
export -f mailhog_restart
diff --git a/provision/core/mariadb/config/debian.cnf b/provision/core/mariadb/config/debian.cnf
new file mode 100644
index 000000000..c8e226190
--- /dev/null
+++ b/provision/core/mariadb/config/debian.cnf
@@ -0,0 +1,15 @@
+# THIS FILE IS OBSOLETE. STOP USING IT IF POSSIBLE.
+# This file exists only for backwards compatibility for
+# tools that run '--defaults-file=/etc/mysql/debian.cnf'
+# and have root level access to the local filesystem.
+# With those permissions one can run 'mariadb' directly
+# anyway thanks to unix socket authentication and hence
+# this file is useless. See package README for more info.
+[client]
+user = root
+password = root
+
+[mysqladmin]
+user = root
+password = root
+# THIS FILE WILL BE REMOVED IN A FUTURE DEBIAN RELEASE.
diff --git a/provision/core/mariadb/provision.sh b/provision/core/mariadb/provision.sh
index 9bcf3a5e4..702203645 100644
--- a/provision/core/mariadb/provision.sh
+++ b/provision/core/mariadb/provision.sh
@@ -114,6 +114,10 @@ function mysql_setup() {
chmod 0644 "/home/vagrant/.my.cnf"
vvv_info " * Copied /srv/provision/core/mariadb/config/root-my.cnf to /home/vagrant/.my.cnf"
+ # this file should been obsolete, but somehow mariadb init.d script use it
+ cp -f "/srv/provision/core/mariadb/config/debian.cnf" "/etc/mysql/debian.cnf"
+ vvv_info " * Copied /srv/provision/core/mariadb/config/debian.cnf to /etc/mysql/debian.cnf"
+
# Due to systemd dependencies, in docker, mysql service is not auto started
vvv_info " * Ensuring MariaDB service is started"
service mariadb restart
@@ -125,7 +129,7 @@ function mysql_setup() {
# 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 [ $(service mariadb status|grep 'mysql start/running' | wc -l) -ne 1 ]; then
+ if [ $(service mariadb status|grep 'Uptime' | wc -l) -ne 1 ]; then
vvv_info " * Starting the mariadb service"
service mariadb start
else
diff --git a/provision/core/nginx/apt-keys/nginx-archive-keyring.gpg b/provision/core/nginx/apt-keys/nginx-archive-keyring.gpg
new file mode 100644
index 000000000..632dba3ab
Binary files /dev/null and b/provision/core/nginx/apt-keys/nginx-archive-keyring.gpg differ
diff --git a/provision/core/nginx/apt-keys/nginx_signing.key b/provision/core/nginx/apt-keys/nginx_signing.key
deleted file mode 100644
index d2258b8fb..000000000
--- a/provision/core/nginx/apt-keys/nginx_signing.key
+++ /dev/null
@@ -1,28 +0,0 @@
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: GnuPG v2.0.22 (GNU/Linux)
-
-mQENBE5OMmIBCAD+FPYKGriGGf7NqwKfWC83cBV01gabgVWQmZbMcFzeW+hMsgxH
-W6iimD0RsfZ9oEbfJCPG0CRSZ7ppq5pKamYs2+EJ8Q2ysOFHHwpGrA2C8zyNAs4I
-QxnZZIbETgcSwFtDun0XiqPwPZgyuXVm9PAbLZRbfBzm8wR/3SWygqZBBLdQk5TE
-fDR+Eny/M1RVR4xClECONF9UBB2ejFdI1LD45APbP2hsN/piFByU1t7yK2gpFyRt
-97WzGHn9MV5/TL7AmRPM4pcr3JacmtCnxXeCZ8nLqedoSuHFuhwyDnlAbu8I16O5
-XRrfzhrHRJFM1JnIiGmzZi6zBvH0ItfyX6ttABEBAAG0KW5naW54IHNpZ25pbmcg
-a2V5IDxzaWduaW5nLWtleUBuZ2lueC5jb20+iQE+BBMBAgAoAhsDBgsJCAcDAgYV
-CAIJCgsEFgIDAQIeAQIXgAUCV2K1+AUJGB4fQQAKCRCr9b2Ce9m/YloaB/9XGrol
-kocm7l/tsVjaBQCteXKuwsm4XhCuAQ6YAwA1L1UheGOG/aa2xJvrXE8X32tgcTjr
-KoYoXWcdxaFjlXGTt6jV85qRguUzvMOxxSEM2Dn115etN9piPl0Zz+4rkx8+2vJG
-F+eMlruPXg/zd88NvyLq5gGHEsFRBMVufYmHtNfcp4okC1klWiRIRSdp4QY1wdrN
-1O+/oCTl8Bzy6hcHjLIq3aoumcLxMjtBoclc/5OTioLDwSDfVx7rWyfRhcBzVbwD
-oe/PD08AoAA6fxXvWjSxy+dGhEaXoTHjkCbz/l6NxrK3JFyauDgU4K4MytsZ1HDi
-MgMW8hZXxszoICTTiQEcBBABAgAGBQJOTkelAAoJEKZP1bF62zmo79oH/1XDb29S
-YtWp+MTJTPFEwlWRiyRuDXy3wBd/BpwBRIWfWzMs1gnCjNjk0EVBVGa2grvy9Jtx
-JKMd6l/PWXVucSt+U/+GO8rBkw14SdhqxaS2l14v6gyMeUrSbY3XfToGfwHC4sa/
-Thn8X4jFaQ2XN5dAIzJGU1s5JA0tjEzUwCnmrKmyMlXZaoQVrmORGjCuH0I0aAFk
-RS0UtnB9HPpxhGVbs24xXZQnZDNbUQeulFxS4uP3OLDBAeCHl+v4t/uotIad8v6J
-SO93vc1evIje6lguE81HHmJn9noxPItvOvSMb2yPsE8mH4cJHRTFNSEhPW6ghmlf
-Wa9ZwiVX5igxcvaIRgQQEQIABgUCTk5b0gAKCRDs8OkLLBcgg1G+AKCnacLb/+W6
-cflirUIExgZdUJqoogCeNPVwXiHEIVqithAM1pdY/gcaQZmIRgQQEQIABgUCTk5f
-YQAKCRCpN2E5pSTFPnNWAJ9gUozyiS+9jf2rJvqmJSeWuCgVRwCcCUFhXRCpQO2Y
-Va3l3WuB+rgKjsQ=
-=EWWI
------END PGP PUBLIC KEY BLOCK-----
diff --git a/provision/core/nginx/config/nginx.conf b/provision/core/nginx/config/nginx.conf
index 5fdb01353..0ad1c5507 100644
--- a/provision/core/nginx/config/nginx.conf
+++ b/provision/core/nginx/config/nginx.conf
@@ -133,7 +133,7 @@ http {
# Upstream to abstract backend connection(s) for PHP.
upstream php {
- server unix:/var/run/php7.4-fpm.sock;
+ server unix:/var/run/php8.2-fpm.sock;
}
include /etc/nginx/upstreams/*.conf;
diff --git a/provision/core/nginx/config/site-fallback.conf b/provision/core/nginx/config/site-fallback.conf
index bd7e79621..8aabe0d4b 100644
--- a/provision/core/nginx/config/site-fallback.conf
+++ b/provision/core/nginx/config/site-fallback.conf
@@ -1,6 +1,6 @@
server {
listen 80;
- listen 443 ssl http2;
+ listen 443 ssl;
server_name {vvv_hosts};
root "{vvv_path_to_site}/public_html";
@@ -8,9 +8,6 @@ server {
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}
diff --git a/provision/core/nginx/provision.sh b/provision/core/nginx/provision.sh
index ee162bf55..7d0f74a8b 100644
--- a/provision/core/nginx/provision.sh
+++ b/provision/core/nginx/provision.sh
@@ -13,15 +13,20 @@ function nginx_register_apt_sources() {
fi
}
vvv_add_hook register_apt_sources nginx_register_apt_sources
-
function nginx_register_apt_keys() {
# 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 vvv_apt_keys_has '573B FD6B 3D8F BC64 1079 A6AB ABF5 BD82 7BD9 BF62'; then
+ # Retrieve the Nginx signing key from nginx.org
+ vvv_info " * Replacing expired Nginx signing key..."
+ apt-key add /srv/provision/core/nginx/apt-keys/nginx-archive-keyring.gpg
+ fi
+
if ! vvv_apt_keys_has 'nginx'; then
# Retrieve the Nginx signing key from nginx.org
- vvv_info " * Applying Nginx signing key..."
- apt-key add /srv/provision/core/nginx/apt-keys/nginx_signing.key
+ vvv_info " * Adding Nginx signing key..."
+ apt-key add /srv/provision/core/nginx/apt-keys/nginx-archive-keyring.gpg
fi
}
vvv_add_hook register_apt_keys nginx_register_apt_keys
diff --git a/provision/core/node-nvm/provision.sh b/provision/core/node-nvm/provision.sh
index 715192d4e..0b6c361e8 100644
--- a/provision/core/node-nvm/provision.sh
+++ b/provision/core/node-nvm/provision.sh
@@ -53,9 +53,9 @@ function vvv_nvm_setup() {
fi
- vvv_info " - Installing Node 14 via nvm"
- nvm install 14
- nvm use 14
+ vvv_info " - Installing Node 20 via nvm"
+ nvm install 20
+ nvm use 20
vvv_info " - Ensuring vagrant user owns its own nvm folder"
chown -R vagrant:vagrant /home/vagrant/.nvm/
diff --git a/provision/core/php/provision.sh b/provision/core/php/provision.sh
index b418d4673..009193f12 100644
--- a/provision/core/php/provision.sh
+++ b/provision/core/php/provision.sh
@@ -2,7 +2,7 @@
# @description Installs the default version of PHP
set -eo pipefail
-VVV_BASE_PHPVERSION=${VVV_BASE_PHPVERSION:-"7.4"}
+VVV_BASE_PHPVERSION=${VVV_BASE_PHPVERSION:-"8.2"}
function php_before_packages() {
cp -f "/srv/provision/core/php/ondrej-ppa-pin" "/etc/apt/preferences.d/ondrej-ppa-pin"
@@ -47,7 +47,6 @@ function php_register_apt_packages() {
"php${VVV_BASE_PHPVERSION}-mbstring"
"php${VVV_BASE_PHPVERSION}-mysql"
"php${VVV_BASE_PHPVERSION}-imap"
- "php${VVV_BASE_PHPVERSION}-json"
"php${VVV_BASE_PHPVERSION}-soap"
"php${VVV_BASE_PHPVERSION}-xml"
"php${VVV_BASE_PHPVERSION}-zip"
@@ -109,6 +108,11 @@ function phpfpm_setup() {
fi
fi
done
+
+ if [[ ! -d "/run/php" ]]; then
+ mkdir -p "/run/php"
+ chown -R www-data:www-data "/run/php"
+ fi
}
export -f phpfpm_setup
diff --git a/provision/core/phpcs/.gitignore b/provision/core/phpcs/.gitignore
new file mode 100644
index 000000000..546ef8ae5
--- /dev/null
+++ b/provision/core/phpcs/.gitignore
@@ -0,0 +1,3 @@
+vendor/
+bin/
+composer.lock
diff --git a/provision/core/phpcs/composer.json b/provision/core/phpcs/composer.json
index b5a018169..b98d5bff9 100644
--- a/provision/core/phpcs/composer.json
+++ b/provision/core/phpcs/composer.json
@@ -12,10 +12,11 @@
"issues": "https://github.com/Varying-Vagrant-Vagrants/VVV/issues/"
},
"require": {
- "dealerdirect/phpcodesniffer-composer-installer": "^0.7.2",
- "automattic/vipwpcs": "^2.3.3",
+ "dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
+ "automattic/vipwpcs": "^3",
"phpcompatibility/php-compatibility": "^9.3.5",
- "phpcompatibility/phpcompatibility-wp": "^2.1.4"
+ "phpcompatibility/phpcompatibility-wp": "^2.1.4",
+ "wp-coding-standards/wpcs": "^3.0.1"
},
"config": {
"allow-plugins": {
diff --git a/provision/core/phpcs/provision.sh b/provision/core/phpcs/provision.sh
index f4bc8dcd5..f772bc30c 100644
--- a/provision/core/phpcs/provision.sh
+++ b/provision/core/phpcs/provision.sh
@@ -15,7 +15,7 @@ function php_codesniff_setup() {
# PHP_CodeSniffer (for running WordPress-Coding-Standards)
# Sniffs WordPress Coding Standards
- vvv_info " * [PHPCS]: Provisioning PHP_CodeSniffer (phpcs), see https://github.com/squizlabs/PHP_CodeSniffer"
+ vvv_info " * [PHPCS]: Provisioning PHP_CodeSniffer (phpcs), see https://github.com/PHPCSStandards/PHP_CodeSniffer"
noroot mkdir -p /srv/www/phpcs
noroot cp -f "/srv/provision/core/phpcs/composer.json" "/srv/www/phpcs/composer.json"
@@ -28,6 +28,7 @@ function php_codesniff_setup() {
noroot /srv/www/phpcs/bin/phpcs --config-set default_standard WordPress-Core
local standards=$(noroot /srv/www/phpcs/bin/phpcs -i)
vvv_success " * [PHPCS]: Completed with the following PHPCS standards set up: ${standards}"
+ vvv_info " * [PHPCS]: Help maintain PHPCS by sponsoring via Github Sponsors at https://github.com/sponsors/phpcsstandards or OpenCollective at https://opencollective.com/php_codesniffer"
}
export -f php_codesniff_setup
diff --git a/provision/core/phpcs/readme.md b/provision/core/phpcs/readme.md
new file mode 100644
index 000000000..ba0d13ab5
--- /dev/null
+++ b/provision/core/phpcs/readme.md
@@ -0,0 +1,8 @@
+## VVV PHPCS setup
+
+This folder houses a composer file that installs PHPCS. If PHPCS fails, you can destroy/nuke the vendor and bin folders, as well as the lock file, and re-provision, or even run composer yourself on the host.
+
+The goal for us in terms of packages is to enable both WordPress and VIP coding standards, with PHP compat thrown in for good measure.
+
+Additionally, this is in a shared folder so that you can use the same PHPCS install in your VVV VM as well as your IDE/editor.
+
diff --git a/provision/core/vvv/provision.sh b/provision/core/vvv/provision.sh
index 1b6582d62..5c1a00048 100644
--- a/provision/core/vvv/provision.sh
+++ b/provision/core/vvv/provision.sh
@@ -112,6 +112,10 @@ function vvv_ntp_restart() {
vvv_add_hook services_restart vvv_ntp_restart
function cleanup_vvv(){
+ if test -f "/tmp/hosts"; then
+ sudo rm /tmp/hosts
+ fi
+
# Cleanup the hosts file
vvv_info " * Cleaning the virtual machine's /etc/hosts file..."
sed -n '/# vvv-auto$/!p' /etc/hosts > /tmp/hosts
@@ -121,13 +125,16 @@ function cleanup_vvv(){
echo "127.0.0.1 tideways.vvv.test # vvv-auto" >> "/etc/hosts"
echo "127.0.0.1 xhgui.vvv.test # vvv-auto" >> "/etc/hosts"
fi
- mv /tmp/hosts /etc/hosts
+ sudo cp -rf /tmp/hosts /etc/hosts
+
+ # cleanup
+ if test -f "/tmp/hosts"; then
+ sudo rm /tmp/hosts
+ fi
}
export -f cleanup_vvv
-if [ "${VVV_DOCKER}" != 1 ]; then
- vvv_add_hook finalize cleanup_vvv 15
-fi
+vvv_add_hook finalize cleanup_vvv 15
function apt_hash_missmatch_fix() {
if [ ! -f "/etc/apt/apt.conf.d/99hashmismatch" ]; then
diff --git a/provision/provision-helpers.sh b/provision/provision-helpers.sh
index 3e5fad11b..7bf1458a9 100755
--- a/provision/provision-helpers.sh
+++ b/provision/provision-helpers.sh
@@ -164,7 +164,8 @@ export -f network_check
#
# @arg $1 string name of the provisioner
function log_to_file() {
- local date_time=$(cat /vagrant/provisioned_at)
+ local date_time
+ date_time=$(cat /vagrant/provisioned_at)
local logfolder="/var/log/provisioners/${date_time}"
local logfile="${logfolder}/${1}.log"
mkdir -p "${logfolder}"
@@ -237,10 +238,12 @@ function vvv_format_output() {
['>']="${CRESET}"
)
- local MSG="${1}>"
+ local MSG
+ MSG="${1}>"
for TAG in "${!TAGS[@]}"; do
- local VAL="${TAGS[$TAG]}"
- MSG=$(echo "${MSG//"${TAG}"/"${VAL}"}" )
+ local VAL
+ VAL="${TAGS[$TAG]}"
+ MSG="${MSG//"${TAG}"/"${VAL}"}"
done
echo -e "${MSG}"
}
@@ -250,7 +253,8 @@ export -f vvv_format_output
#
# @arg $1 string The message to print
function vvv_output() {
- local MSG=$(vvv_format_output "${1}")
+ local MSG
+ MSG=$(vvv_format_output "${1}")
echo -e "${MSG}"
if [[ ! -z "${VVV_LOG}" ]]; then
if [ "${VVV_LOG}" != "main" ]; then
@@ -272,7 +276,8 @@ export -f vvv_info
#
# @arg $1 string The message to print
function vvv_error() {
- local MSG=$(vvv_format_output )
+ local MSG
+ MSG=$(vvv_format_output )
vvv_output "${1}"
}
export -f vvv_error
@@ -299,7 +304,8 @@ export -f vvv_success
# @arg $1 string the path/key to read from, e.g. sites.wordpress-one.repo
# @arg $2 string a default value to fall back upon
function get_config_value() {
- local value=$(shyaml get-value "${1}" 2> /dev/null < "${VVV_CONFIG}")
+ local value
+ value=$(shyaml get-value "${1}" 2> /dev/null < "${VVV_CONFIG}")
echo "${value:-${2:-}}"
}
export -f get_config_value
@@ -310,7 +316,8 @@ export -f get_config_value
# @arg $1 string the path/key to read from, e.g. sites.wordpress-one.hosts
# @arg $2 string a default value to fall back upon
function get_config_values() {
- local value=$(shyaml get-values "${1}" 2> /dev/null < "${VVV_CONFIG}")
+ local value
+ value=$(shyaml get-values "${1}" 2> /dev/null < "${VVV_CONFIG}")
echo "${value:-${2:-}}"
}
export -f get_config_values
@@ -320,7 +327,8 @@ export -f get_config_values
#
# @arg $1 string the path/key to read from, e.g. sites.wordpress-one.repo
function get_config_type() {
- local value=$(shyaml get-type "${1}" 2> /dev/null < "${VVV_CONFIG}")
+ local value
+ value=$(shyaml get-type "${1}" 2> /dev/null < "${VVV_CONFIG}")
echo "${value}"
}
export -f get_config_type
@@ -331,7 +339,8 @@ export -f get_config_type
# @arg $1 string the path/key to read from, e.g. sites.wordpress-one.repo
# @arg $2 string a default value to fall back upon
function get_config_keys() {
- local value=$(shyaml keys "${1}" 2> /dev/null < "${VVV_CONFIG}")
+ local value
+ value=$(shyaml keys "${1}" 2> /dev/null < "${VVV_CONFIG}")
echo "${value:-${2:-}}"
}
export -f get_config_keys
@@ -385,28 +394,30 @@ vvv_hook() {
fi
local hook_var_prios="VVV_HOOKS_${1}"
- local start=`date +%s`
+ local start
+ start=$(date +%s)
vvv_info " ▷ Running ${1} hook"
eval "if [ -z \"\${${hook_var_prios}}\" ]; then return 0; fi"
local sorted
eval "if [ ! -z \"\${${hook_var_prios}}\" ]; then IFS=$'\n' sorted=(\$(sort -n <<<\"\${${hook_var_prios}[*]}\")); unset IFS; fi"
- for i in ${!sorted[@]}; do
+ for i in "${!sorted[@]}"; do
local prio="${sorted[$i]}"
hooks_on_prio="${hook_var_prios}_${prio}[@]"
for f in ${!hooks_on_prio}; do
$f
done
done
- local end=`date +%s`
- vvv_success " ✔ Finished ${1} hook in `expr $end - $start`s"
+ local end
+ end=$(date +%s)
+ vvv_success " ✔ Finished ${1} hook in $((end - start))s"
}
export -f vvv_hook
# @description Necessary for vvv_parallel_hook, do not use.
# @internal
function vvv_run_parallel_hook_function() {
- eval $1
+ eval "${1}"
# kill all sub-processes
pkill -P $$
@@ -427,13 +438,14 @@ function vvv_parallel_hook() {
fi
local hook_var_prios="VVV_HOOKS_${1}"
- local start=`date +%s`
+ local start
+ start=$(date +%s)
eval "if [ -z \"\${${hook_var_prios}}\" ]; then return 0; fi"
vvv_info " ▷ Running ${1} hook"
local sorted
eval "if [ ! -z \"\${${hook_var_prios}}\" ]; then IFS=$'\n' sorted=(\$(sort -n <<<\"\${${hook_var_prios}[*]}\")); unset IFS; fi"
- for i in ${!sorted[@]}; do
+ for i in "${!sorted[@]}"; do
local prio="${sorted[$i]}"
hooks_on_prio="${hook_var_prios}_${prio}[@]"
for f in ${!hooks_on_prio}; do
@@ -444,8 +456,9 @@ function vvv_parallel_hook() {
vvv_info " - Subhooks completed for ${1} with priority ${prio}"
done
- local end=`date +%s`
- vvv_success " ✔ Finished ${1} hook in `expr $end - $start`s"
+ local end
+ end=$(date +%s)
+ vvv_success " ✔ Finished ${1} hook in $((end - start))s"
}
export -f vvv_parallel_hook
@@ -529,7 +542,7 @@ export -f vvv_package_install;
# @arg $1 string the package to check for
vvv_is_apt_pkg_installed() {
# Get the number of packages installed that match $1
- num=$(dpkg --dry-run -l "${1}" 2>/dev/null | egrep '^ii' | wc -l)
+ num=$(dpkg --dry-run -l "${1}" 2>/dev/null | grep -E '^ii' | wc -l)
if [[ $num -eq 1 ]]; then
# it is installed
@@ -572,7 +585,7 @@ vvv_apt_package_remove() {
return 0
fi
- vvv_info " * Removing ${#packages[@]} apt packages: '${packages[@]}'."
+ vvv_info " * Removing ${#packages[@]} apt packages: '${packages[*]}'."
vvv_cleanup_dpkg_locks
@@ -614,7 +627,6 @@ function vvv_maybe_install_nginx_config() {
fi
sudo mkdir -p "${TARGET_DIR}"
-
sudo cp -f "${SOURCE_FILE}" "${TARGET_FILE}"
if ! sudo nginx -t; then
@@ -628,38 +640,83 @@ function vvv_maybe_install_nginx_config() {
return 0
}
-
export -f vvv_maybe_install_nginx_config;
# @description Retrieves a list of sites.
# @noargs
function vvv_get_sites() {
- local sites=$(shyaml -q keys "sites" <${VVV_CONFIG})
+ local sites
+ sites=$(shyaml -q keys "sites" <${VVV_CONFIG})
echo "${sites}"
}
+export -f vvv_get_sites
# @description Updates the guest environments hosts file.
# @noargs
function vvv_update_guest_hosts() {
- if test -f "/tmp/site-hosts"; then
- sudo rm /tmp/site-hosts
- fi
- local SITES=$(vvv_get_sites)
+ local SITES
+ SITES=$(vvv_get_sites)
+ cp -f /etc/hosts /tmp/hosts
+
+ # Add each site.
for SITE in $SITES; do
SITE_ESCAPED="${SITE//./\\.}"
VVV_SITE_NAME=${SITE}
- local value=$(shyaml -q get-values "sites.${SITE_ESCAPED}.hosts" <${VVV_CONFIG})
+ local value
+ value=$(shyaml -q get-values "sites.${SITE_ESCAPED}.hosts" <${VVV_CONFIG})
for v in $value; do
- echo "127.0.0.1 ${v:-"${VVV_SITE_NAME}.test"}" >> /tmp/site-hosts
+ sed -i "/127.0.0.1 ${v:-"${VVV_SITE_NAME}.test"}/d" /tmp/hosts
+ if [[ -z "$(grep -q "^127.0.0.1 ${v:-"${VVV_SITE_NAME}.test"}$" /tmp/hosts)" ]]; then
+ echo "127.0.0.1 ${v:-"${VVV_SITE_NAME}.test"} # vvv-auto" >> "/tmp/hosts"
+ echo "::1 ${v:-"${VVV_SITE_NAME}.test"} # vvv-auto" >> "/tmp/hosts"
+ fi
done
done
- echo "$( /dev/null
+ # Remove duplicate lines then replace hosts file.
+ awk -i inplace '!seen[$0]++' /tmp/hosts
- # cleanup
- if test -f "/tmp/site-hosts"; then
- sudo rm /tmp/site-hosts
- fi
+ cp -f /tmp/hosts /etc/hosts
+ rm /tmp/hosts
}
-
export -f vvv_update_guest_hosts
+
+# @description Performs an in place sed command via a temporary
+# file to avoid permission issues
+function vvv_safe_sed() {
+ local expression="${1}"
+ local file="${2}"
+ local tempfile
+ tempfile=$(mktemp /tmp/safe-sed.XXXXXX)
+ /usr/bin/sed "${expression}" "${file}" > "${tempfile}"
+ cat "${tempfile}" > "${file}"
+ rm "${tempfile}"
+}
+export -f vvv_safe_sed
+
+# @description Takes a string and replaces all instances of a token with a value
+function vvv_search_replace() {
+ local content="$1"
+ local token="$2"
+ local value="$3"
+
+ # Read the file contents and replace the token with the value
+ content=${content//$token/$value}
+ echo "${content}"
+}
+export -f vvv_search_replace
+
+# @description Takes a file, and replaces all instances of a token with a value
+function vvv_search_replace_in_file() {
+ local file="$1"
+
+ # Read the file contents and replace the token with the value
+ local content
+ if [[ -f "${file}" ]]; then
+ content=$(<"${file}")
+ vvv_search_replace "${content}" "${2}" "${3}"
+ else
+ return 1
+ fi
+}
+export -f vvv_search_replace_in_file
diff --git a/provision/provision-site.sh b/provision/provision-site.sh
index 59e1c294c..0c8b897c7 100644
--- a/provision/provision-site.sh
+++ b/provision/provision-site.sh
@@ -25,7 +25,7 @@ VVV_SITE_NAME=${SITE}
VVV_HOSTS=""
SUCCESS=0
-DEFAULTPHP="7.4"
+DEFAULTPHP="8.2"
VVV_CONFIG=/vagrant/config.yml
@@ -62,10 +62,14 @@ vvv_validate_site_php_version() {
vvv_warn " ! Warning: PHP version defined is using a wrong format: '${SITE_PHP}' with length '${#SITE_PHP}'"
vvv_warn " If you are trying to use a more specific version of PHP such as 7.4.1 or 7.4.0 you"
vvv_warn " need to be less specific and use 7.4"
+ vvv_warn " ! https://varyingvagrantvagrants.org/docs/en-US/adding-a-new-site/changing-php-version/"
fi
if [[ ! -e "/usr/bin/php${SITE_PHP}" ]]; then
- vvv_warn " ! Warning: Chosen PHP version doesn't exist in this environment: '${SITE_PHP}' looking for '/usr/bin/php${SITE_PHP}'"
+ vvv_warn " ! Warning: The chosen PHP version doesn't exist in this environment: '${SITE_PHP}' looking for '/usr/bin/php${SITE_PHP}'"
+ vvv_warn " ! Did you forget to install it via config/config.yml? Add it to the extensions section as documented in the"
+ vvv_warn " ! changing PHP versions age on the VVV site, and re-provision:"
+ vvv_warn " ! https://varyingvagrantvagrants.org/docs/en-US/adding-a-new-site/changing-php-version/"
fi
}
@@ -158,11 +162,14 @@ function vvv_provision_site_nginx_config() {
# We allow the replacement of the {vvv_path_to_folder} token with
# whatever you want, allowing flexible placement of the site folder
# while still having an Nginx config which works.
- local DIR="$(dirname "${SITE_NGINX_FILE}")"
- sed "s#{vvv_path_to_folder}#${DIR}#" "${SITE_NGINX_FILE}" > "${TMPFILE}"
- sed -i "s#{vvv_path_to_site}#${VM_DIR}#" "${TMPFILE}"
- sed -i "s#{vvv_site_name}#${SITE_NAME}#" "${TMPFILE}"
- sed -i "s#{vvv_hosts}#${VVV_HOSTS}#" "${TMPFILE}"
+ local DIR
+ DIR="$(dirname "${SITE_NGINX_FILE}")"
+
+ local NCONFIG
+ NCONFIG=$(vvv_search_replace_in_file "${SITE_NGINX_FILE}" "{vvv_path_to_folder}" "${DIR}")
+ NCONFIG=$(vvv_search_replace "${NCONFIG}" "{vvv_path_to_site}" "${VM_DIR}/")
+ NCONFIG=$(vvv_search_replace "${NCONFIG}" "{vvv_site_name}" "${SITE_NAME}")
+ NCONFIG=$(vvv_search_replace "${NCONFIG}" "{vvv_hosts}" "${VVV_HOSTS}")
# if php: is configured, set the upstream to match
SITE_PHP=$(vvv_get_site_php_version)
@@ -177,30 +184,35 @@ function vvv_provision_site_nginx_config() {
NGINX_UPSTREAM='php'
fi
- sed -i "s#{upstream}#${NGINX_UPSTREAM}#" "${TMPFILE}"
+ NCONFIG=$(vvv_search_replace "${NCONFIG}" "{upstream}" "${NGINX_UPSTREAM}")
if [ -f "/srv/certificates/${SITE_NAME}/dev.crt" ]; then
- sed -i "s#{vvv_tls_cert}#ssl_certificate \"/srv/certificates/${SITE_NAME}/dev.crt\";#" "${TMPFILE}"
- sed -i "s#{vvv_tls_key}#ssl_certificate_key \"/srv/certificates/${SITE_NAME}/dev.key\";#" "${TMPFILE}"
+ NCONFIG=$(vvv_search_replace "${NCONFIG}" "{vvv_tls_cert}" "ssl_certificate \"/srv/certificates/${SITE_NAME}/dev.crt\";")
+ NCONFIG=$(vvv_search_replace "${NCONFIG}" "{vvv_tls_key}" "ssl_certificate_key \"/srv/certificates/${SITE_NAME}/dev.key\";")
+
else
- sed -i "s#{vvv_tls_cert}#\# TLS cert not included as the certificate file is not present#" "${TMPFILE}"
- sed -i "s#{vvv_tls_key}#\# TLS key not included as the certificate file is not present#" "${TMPFILE}"
+ NCONFIG=$(vvv_search_replace "${NCONFIG}" "{vvv_tls_cert}" "# TLS cert not included as the certificate file is not present")
+ NCONFIG=$(vvv_search_replace "${NCONFIG}" "{vvv_tls_key}" "# TLS key not included as the certificate file is not present")
+
fi
# Resolve relative paths since not supported in Nginx root.
- while grep -sqE '/[^/][^/]*/\.\.' "${TMPFILE}"; do
- sed -i 's#/[^/][^/]*/\.\.##g' "${TMPFILE}"
+ while [[ $NCONFIG =~ /[^/][^/]*/\.\. ]]; do
+ NCONFIG=${NCONFIG//\/[^\/][^\/]*\/\.\./}
done
# "/etc/nginx/custom-sites/${DEST_NGINX_FILE}"
- local DEST_NGINX_FILE=${SITE_NGINX_FILE//\/srv\/www\//}
- local DEST_NGINX_FILE=${DEST_NGINX_FILE//\//\-}
- local DEST_NGINX_FILE=${DEST_NGINX_FILE//-srv-provision-core-nginx-config-/\-}
- local DEST_NGINX_FILE=${DEST_NGINX_FILE//-provision/} # remove the provision folder name
- local DEST_NGINX_FILE=${DEST_NGINX_FILE//-.vvv/} # remove the .vvv folder name
+ local DEST_NGINX_FILE
+ DEST_NGINX_FILE=${SITE_NGINX_FILE//\/srv\/www\//}
+ DEST_NGINX_FILE=${DEST_NGINX_FILE//\//\-}
+ DEST_NGINX_FILE=${DEST_NGINX_FILE//-srv-provision-core-nginx-config-/\-}
+ DEST_NGINX_FILE=${DEST_NGINX_FILE//-provision/} # remove the provision folder name
+ DEST_NGINX_FILE=${DEST_NGINX_FILE//-.vvv/} # remove the .vvv folder name
#local DEST_NGINX_FILE=${DEST_NGINX_FILE//\-\-/\-}
- local DEST_NGINX_FILE=${DEST_NGINX_FILE/%-vvv-nginx.conf/}
- local DEST_NGINX_FILE="vvv-${DEST_NGINX_FILE}-$(md5sum <<< "${SITE_NGINX_FILE}" | cut -c1-8).conf"
+ DEST_NGINX_FILE=${DEST_NGINX_FILE/%-vvv-nginx.conf/}
+ DEST_NGINX_FILE="vvv-${DEST_NGINX_FILE}-$(md5sum <<< "${SITE_NGINX_FILE}" | cut -c1-8).conf"
+
+ echo "${NCONFIG}" > "${TMPFILE}"
if ! vvv_maybe_install_nginx_config "${TMPFILE}" "${DEST_NGINX_FILE}" "sites"; then
vvv_warn " ! This sites nginx config had problems, it may not load. Look at the above errors to diagnose the problem"
@@ -216,11 +228,12 @@ function vvv_provision_site_nginx_config() {
# @internal
function vvv_provision_hosts_file() {
local HOSTFILE=$1
- while read HOSTFILE; do
- while IFS='' read -r line || [ -n "$line" ]; do
- if [[ "#" != ${line:0:1} ]]; then
+ while read -r 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 "127.0.0.1 ${line} # vvv-auto" >> "/etc/hosts"
+ echo "::1 ${line} # vvv-auto" >> "/etc/hosts"
echo " - Added ${line} from ${HOSTFILE}"
fi
fi
@@ -265,6 +278,7 @@ function vvv_process_site_hosts() {
for line in $hosts; do
if [[ -z "$(grep -q "^127.0.0.1 ${line}$" /etc/hosts)" ]]; then
echo "127.0.0.1 ${line} # vvv-auto" >> "/etc/hosts"
+ echo "::1 ${line} # vvv-auto" >> "/etc/hosts"
echo " - Added ${line} from ${VVV_CONFIG}"
fi
done
diff --git a/provision/provision.sh b/provision/provision.sh
index 693428f22..fdbe4baf3 100755
--- a/provision/provision.sh
+++ b/provision/provision.sh
@@ -18,19 +18,21 @@ rm -f /vagrant/version
rm -f /vagrant/vvv-custom.yml
rm -f /vagrant/config.yml
-if [ -x "$(command -v ntpdate)" ]; then
- echo " * Syncing clocks"
- if sudo ntpdate -u ntp.ubuntu.com; then
- echo " * clocks synced"
- else
- vvv_warn " - clock synchronisation failed"
- fi
-else
- echo " - skipping ntpdate clock sync, not installed yet"
+if [ ! -f /.dockerenv ]; then
+ if [ -x "$(command -v ntpdate)" ]; then
+ echo " * Syncing clocks"
+ if sudo ntpdate -u ntp.ubuntu.com; then
+ echo " * clocks synced"
+ else
+ echo " - clock synchronisation failed"
+ fi
+ else
+ echo " - skipping ntpdate clock sync, not installed yet"
+ fi
fi
touch /vagrant/provisioned_at
-echo $(date "+%Y.%m.%d_%H-%M-%S") > /vagrant/provisioned_at
+date "+%Y.%m.%d_%H-%M-%S" > /vagrant/provisioned_at
# copy over version and config files
cp -f /home/vagrant/version /vagrant
diff --git a/version b/version
index e4fba2183..c10780c62 100644
--- a/version
+++ b/version
@@ -1 +1 @@
-3.12
+3.13.1
diff --git a/www/default/phpinfo/index.php b/www/default/phpinfo/index.php
index 26ea69dc9..3db25af90 100644
--- a/www/default/phpinfo/index.php
+++ b/www/default/phpinfo/index.php
@@ -4,10 +4,10 @@
*/
?>
diff --git a/www/default/xdebuginfo/index.php b/www/default/xdebuginfo/index.php
index 2a400b0ef..c8451be39 100644
--- a/www/default/xdebuginfo/index.php
+++ b/www/default/xdebuginfo/index.php
@@ -5,7 +5,6 @@
?>