From 0b6b2ac3aa070876bb0600c538f428f6f45ff524 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sat, 25 Sep 2021 20:44:39 +0700 Subject: [PATCH 001/112] Init README --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f55aa3846..3f2ec08ef 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,15 @@ # VVV ( Varying Vagrant Vagrants ) +## with Docker as default provider -[![Codacy Badge](https://api.codacy.com/project/badge/Grade/206b06167aaf48aab24422cd417e8afa)](https://www.codacy.com/gh/Varying-Vagrant-Vagrants/VVV?utm_source=github.com&utm_medium=referral&utm_content=Varying-Vagrant-Vagrants/VVV&utm_campaign=Badge_Grade) [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/varying-vagrant-vagrants/vvv.svg)](http://isitmaintained.com/project/varying-vagrant-vagrants/vvv "Average time to resolve an issue") [![Percentage of issues still open](http://isitmaintained.com/badge/open/varying-vagrant-vagrants/vvv.svg)](http://isitmaintained.com/project/varying-vagrant-vagrants/vvv "Percentage of issues still open") - -VVV is a local developer environment, mainly aimed at [WordPress](https://wordpress.org) developers. It uses [Vagrant](https://www.vagrantup.com) and VirtualBox, and can be used to build sites, and contribute to WordPress. +VVV is a local developer environment, mainly aimed at [WordPress](https://wordpress.org) developers. It uses [Vagrant](https://www.vagrantup.com) and Docker, and can be used to build sites, and contribute to WordPress. ## 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 [Docker](https://docs.docker.com/engine/install/). Then, clone this repository and run: ```shell +git clone -b docker-provider https://github.com/pentatonicfunk/VVV-Docker.git ~/vvv-local +cd ~/vvv-local vagrant plugin install --local vagrant up --provision ``` From 188bcafcd21eda3ef1e1bd212b27f14607b6bda2 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sat, 25 Sep 2021 20:57:44 +0700 Subject: [PATCH 002/112] Init provision --- Vagrantfile | 13 ++++++++++-- config/default-config.yml | 31 ++++++++--------------------- provision/core/env/provision.sh | 4 +++- provision/core/mailhog/provision.sh | 6 ++++-- provision/core/vvv/provision.sh | 3 +++ 5 files changed, 29 insertions(+), 28 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 822494cc6..134c43572 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -378,6 +378,9 @@ Vagrant.configure('2') do |config| end end + # require disksize + (config.vagrant.plugins ||= []) << 'vagrant-disksize' + # The vbguest plugin has issues for some users, so we're going to disable it for now config.vbguest.auto_update = false if Vagrant.has_plugin?('vagrant-vbguest') @@ -398,7 +401,7 @@ Vagrant.configure('2') do |config| # 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 = 'bento/ubuntu-20.04' config.vm.box_check_update = false # If we're at a contributor day, switch the base box to the prebuilt one @@ -432,6 +435,12 @@ Vagrant.configure('2') do |config| override.vm.box = 'bento/ubuntu-20.04' end + # Docker use image. + config.vm.provider :docker do |d| + d.image = 'pentatonicfunk/vagrant-ubuntu-base-images:20.04' + d.has_ssh = true + end + if defined? vvv_config['vm_config']['box'] unless vvv_config['vm_config']['box'].nil? config.vm.box = vvv_config['vm_config']['box'] @@ -693,7 +702,7 @@ Vagrant.configure('2') do |config| config.vm.provision "flag-root-vagrant-command", type: 'shell', keep_color: true, inline: "mkdir -p /vagrant && touch /vagrant/provisioned_as_root" end end - + long_provision_bear = <<~HTML #{blue}#{creset} #{blue} ▄▀▀▀▄▄▄▄▄▄▄▀▀▀▄ ▄ ▄ #{green}A full provision will take a bit.#{creset} diff --git a/config/default-config.yml b/config/default-config.yml index 15294d2e5..0e25166d7 100644 --- a/config/default-config.yml +++ b/config/default-config.yml @@ -62,22 +62,6 @@ sites: hosts: - trunk.wordpress.test - # The following commented out site configuration will create a environment useful - # for contributions to the WordPress meta team, .e.g WordCamps, .org, etc: - wordpress-meta-environment: - skip_provisioning: true # disabled by default, this takes a long time to provision - description: "An environment useful for contributions to the WordPress meta team." - repo: https://github.com/WordPress/meta-environment.git - hosts: - - wp-meta.test - custom: - provision_site: - "buddypressorg.test": true - "jobs.wordpressnet.test": true - "wordcamp.test": true - "wordpressorg.test": true - "wordpresstv.test": true - # The following commented out site configuration will create a standard WordPress # site in www/example-site/ available at http://my-example-site.test. # Remember, whitespace is significant! Tabs and spaces mean different things @@ -93,8 +77,8 @@ utilities: core: # The core VVV utility - tls-ca # HTTPS SSL/TLS certificates - phpmyadmin # Web based database client - #- memcached-admin # Object cache management - #- opcache-status # opcache management + - memcached-admin # Object cache management + - opcache-status # opcache management #- webgrind # PHP Debugging #- mongodb # needed for Tideways/XHGui #- tideways # PHP profiling tool, also installs xhgui check https://varyingvagrantvagrants.org/docs/en-US/references/tideways-xhgui/ @@ -102,9 +86,9 @@ utilities: #- php56 #- php70 #- php71 - #- php72 - #- php73 - #- php74 + - php72 + - php73 + - php74 # 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. @@ -113,9 +97,9 @@ utilities: vm_config: # For WP core development we recommend at least 2GB ( 2048 ), # If you have 4GB of RAM, lower this to 768MB or you may encounter issues - memory: 2048 + # memory: 2048 # CPU cores: - cores: 2 + # cores: 2 # this tells VVV to use the prebuilt box copied from the USB drive at contributor days # once set to false, do not change back to true, and reprovision @@ -128,6 +112,7 @@ vm_config: # provider: hyperv # provider: parallels # provider: vmware_desktop + provider: docker # General VVV options general: diff --git a/provision/core/env/provision.sh b/provision/core/env/provision.sh index aa1075a5f..5e59fe789 100644 --- a/provision/core/env/provision.sh +++ b/provision/core/env/provision.sh @@ -113,7 +113,9 @@ function profile_setup() { cp -f /srv/provision/core/env/ssh/sshd_config /etc/ssh/sshd_config if [ "${VVV_DOCKER}" != 1 ]; then vvv_info " * Reloading SSH Daemon" - systemctl reload ssh + ## no systemctl + # systemctl reload ssh + service ssh reload fi fi } diff --git a/provision/core/mailhog/provision.sh b/provision/core/mailhog/provision.sh index af26671de..426616ef8 100644 --- a/provision/core/mailhog/provision.sh +++ b/provision/core/mailhog/provision.sh @@ -45,11 +45,13 @@ 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 + exec su - vagrant -c "/usr/bin/env /usr/local/bin/mailhog > /dev/null 2>&1 &" fi } export -f mailhog_setup diff --git a/provision/core/vvv/provision.sh b/provision/core/vvv/provision.sh index ff6fe6cca..f6deb5236 100644 --- a/provision/core/vvv/provision.sh +++ b/provision/core/vvv/provision.sh @@ -12,6 +12,9 @@ function vvv_register_packages() { vvv_error " ! VVV could not copy an Apt source file ( ${APTSOURCE} ), the current OS/Version (${OSID,,}-${OSCODENAME,,}) combination is unavailable" fi + #gnupg2 not installed; TODO: maybe add it to image + apt install gnupg2 software-properties-common -y + if ! vvv_apt_keys_has 'Varying Vagrant Vagrants'; then # Apply the VVV signing key vvv_info " * Applying the Varying Vagrant Vagrants mirror signing key..." From a646c93f70e8ab30b3c16a78cdf8f4f5aa372725 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sat, 25 Sep 2021 21:11:13 +0700 Subject: [PATCH 003/112] Removing disksize reference --- Vagrantfile | 3 --- config/default-config.yml | 5 +++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 134c43572..73e42bf72 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -378,9 +378,6 @@ Vagrant.configure('2') do |config| end end - # require disksize - (config.vagrant.plugins ||= []) << 'vagrant-disksize' - # The vbguest plugin has issues for some users, so we're going to disable it for now config.vbguest.auto_update = false if Vagrant.has_plugin?('vagrant-vbguest') diff --git a/config/default-config.yml b/config/default-config.yml index 0e25166d7..96cf37143 100644 --- a/config/default-config.yml +++ b/config/default-config.yml @@ -137,5 +137,6 @@ general: #github_token: xxxxxx # Settings for the vagrant plugins supported by VVV -vagrant-plugins: - disksize: 10GB # requires the disk size vagrant plugin +# Docker doesn't need this +#vagrant-plugins: +# disksize: 10GB # requires the disk size vagrant plugin From ce156b6da22a6ad64af0e2a1553f5f15aa9aaec8 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 26 Sep 2021 20:32:03 +0700 Subject: [PATCH 004/112] Explicit noninteractive DEBIAN_FRONTEND --- provision/provision-helpers.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/provision/provision-helpers.sh b/provision/provision-helpers.sh index 57f6449ad..217242f10 100755 --- a/provision/provision-helpers.sh +++ b/provision/provision-helpers.sh @@ -2,6 +2,9 @@ # @description This file is for common helper functions that # get called in other provisioners +# need explicit in the provision session +export DEBIAN_FRONTEND=noninteractive + export DEFAULT_TEXT="\033[39m" export BOLD="\033[1m" export UNBOLD="\033[21m" From a40ab54316f1083335f2ed603c9605145d7d0249 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 26 Sep 2021 20:32:55 +0700 Subject: [PATCH 005/112] Attempt to fix mailhog start and restart - use direct binary call --- provision/core/mailhog/provision.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/provision/core/mailhog/provision.sh b/provision/core/mailhog/provision.sh index 426616ef8..fb911ab3f 100644 --- a/provision/core/mailhog/provision.sh +++ b/provision/core/mailhog/provision.sh @@ -51,7 +51,8 @@ function mailhog_setup() { vvv_info " * Starting MailHog Service" # systemctl start mailhog - exec su - vagrant -c "/usr/bin/env /usr/local/bin/mailhog > /dev/null 2>&1 &" + /usr/bin/env /usr/local/bin/mailhog > /dev/null 2>&1 & + vvv_info " * Started MailHog Service" fi } export -f mailhog_setup @@ -59,7 +60,7 @@ export -f mailhog_setup vvv_add_hook after_packages mailhog_setup if [ "${VVV_DOCKER}" != 1 ]; then - vvv_add_hook services_restart "service mailhog restart" + vvv_add_hook services_restart "kilall mailhog; /usr/bin/env /usr/local/bin/mailhog > /dev/null 2>&1 &" fi function mailhog_php_finalize() { From e78b6f9b41b943ae1ac6d4770ce4eaa213695087 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 26 Sep 2021 20:33:29 +0700 Subject: [PATCH 006/112] Downgrade mariadb to 10.3 --- provision/core/mariadb/provision.sh | 30 +++++++++++---- .../core/mariadb/sources-ubuntu-bionic.list | 37 ++++++++++--------- .../core/mariadb/sources-ubuntu-focal.list | 37 ++++++++++--------- 3 files changed, 60 insertions(+), 44 deletions(-) diff --git a/provision/core/mariadb/provision.sh b/provision/core/mariadb/provision.sh index b3b528240..5ab6941b1 100644 --- a/provision/core/mariadb/provision.sh +++ b/provision/core/mariadb/provision.sh @@ -8,8 +8,8 @@ function mariadb_register_packages() { # Use debconf-set-selections to specify the default password for the root MariaDB # account. This runs on every provision, even if MariaDB has been installed. If # MariaDB is already installed, it will not affect anything. - echo mariadb-server-10.5 mysql-server/root_password password "root" | debconf-set-selections - echo mariadb-server-10.5 mysql-server/root_password_again password "root" | debconf-set-selections + echo mariadb-server-10.3 mysql-server/root_password password "root" | debconf-set-selections + echo mariadb-server-10.3 mysql-server/root_password_again password "root" | debconf-set-selections vvv_info " * Setting up MySQL configuration file links..." @@ -57,13 +57,20 @@ function check_mysql_root_password() { vvv_info " * Checking the root user password is root" # Get if root has correct password and mysql_native_password as plugin sql=$( cat <<-SQL - SELECT count(*) from mysql.user WHERE - User='root' AND - authentication_string=PASSWORD('root') AND - plugin='mysql_native_password'; + -- 10.5 SELECT count(*) from mysql.user WHERE + -- User='root' AND + -- authentication_string=PASSWORD('root') AND + -- plugin='mysql_native_password'; + -- 10.3 + SELECT count(*) from mysql.user where User='root' AND Password=PASSWORD('root'); SQL ) + vvv_info "${sql}" + root_matches=$(mysql -u root --password=root -s -N -e "${sql}") + + vvv_info "${root_matches}" + if [[ $? -eq 0 && $root_matches == "1" ]]; then # mysql connected and the SQL above matched vvv_success " * The database root password is the expected value" @@ -72,7 +79,9 @@ SQL # Do reset password in safemode vvv_warn " * The root password is not root, fixing" sql=$( cat <<-SQL - ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password USING PASSWORD('root'); + -- 10.5 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password USING PASSWORD('root'); + -- 10.3 + ALTER USER 'root'@'localhost' IDENTIFIED BY 'root'; FLUSH PRIVILEGES; SQL ) @@ -100,6 +109,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" + # Due to systemd dependencies, in docker, mysql service is not auto started + vvv_info " * Force Restarting mysql service" + service mysql restart + if [ "${VVV_DOCKER}" != 1 ]; then check_mysql_root_password fi @@ -107,7 +120,8 @@ 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 mysql status|grep 'mysql start/running' | wc -l) -ne 1 ]; then + # output bit different on docker container, cause no systemd + if [ $(service mysql status|grep 'Uptime' | wc -l) -ne 1 ]; then vvv_info " * Starting the mysql service" service mysql start else diff --git a/provision/core/mariadb/sources-ubuntu-bionic.list b/provision/core/mariadb/sources-ubuntu-bionic.list index 85ac48fb2..b08586315 100644 --- a/provision/core/mariadb/sources-ubuntu-bionic.list +++ b/provision/core/mariadb/sources-ubuntu-bionic.list @@ -1,23 +1,24 @@ -# MariaDB 10.5 Amsterdam -deb [arch=amd64,arm64,ppc64el] http://ams2.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu bionic main -deb-src http://ams2.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu bionic main +## sorry, had to be 10.3 due to systemd and rc-d dependencies on 10.4 and 10.5 +# MariaDB 10.3 Amsterdam +deb [arch=amd64,arm64,ppc64el] http://ams2.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main +deb-src http://ams2.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main -# MariaDB 10.5 Digital Ocean Singapore -deb [arch=amd64,arm64,ppc64el] http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu bionic main -deb-src http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu bionic main +# MariaDB 10.3 Digital Ocean Singapore +deb [arch=amd64,arm64,ppc64el] http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main +deb-src http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main -# MariaDB 10.5 Digital Ocean San Francisco -deb [arch=amd64,arm64,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu bionic main -deb-src http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu bionic main +# MariaDB 10.3 Digital Ocean San Francisco +deb [arch=amd64,arm64,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main +deb-src http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main -# MariaDB 10.5 Yamagata University Japan -deb [arch=amd64,arm64,ppc64el] http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/repo/10.5/ubuntu bionic main -deb-src http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/repo/10.5/ubuntu bionic main +# MariaDB 10.3 Yamagata University Japan +deb [arch=amd64,arm64,ppc64el] http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/repo/10.3/ubuntu bionic main +deb-src http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/repo/10.3/ubuntu bionic main -# MariaDB 10.5 UKFast Manchester -deb [arch=amd64,arm64,ppc64el] http://mirrors.ukfast.co.uk/sites/mariadb/repo/10.5/ubuntu bionic main -deb-src http://mirrors.ukfast.co.uk/sites/mariadb/repo/10.5/ubuntu bionic main +# MariaDB 10.3 UKFast Manchester +deb [arch=amd64,arm64,ppc64el] http://mirrors.ukfast.co.uk/sites/mariadb/repo/10.3/ubuntu bionic main +deb-src http://mirrors.ukfast.co.uk/sites/mariadb/repo/10.3/ubuntu bionic main -# MariaDB 10.5 PicoNets Mumbai -# deb [arch=amd64,arm64,ppc64el] http://mirrors.piconets.webwerks.in/mariadb-mirror/repo/10.5/ubuntu bionic main -# deb-src http://mirrors.piconets.webwerks.in/mariadb-mirror/repo/10.5/ubuntu bionic main +# MariaDB 10.3 PicoNets Mumbai +# deb [arch=amd64,arm64,ppc64el] http://mirrors.piconets.webwerks.in/mariadb-mirror/repo/10.3/ubuntu bionic main +# deb-src http://mirrors.piconets.webwerks.in/mariadb-mirror/repo/10.3/ubuntu bionic main diff --git a/provision/core/mariadb/sources-ubuntu-focal.list b/provision/core/mariadb/sources-ubuntu-focal.list index 6e2a561dd..552c3e8f0 100644 --- a/provision/core/mariadb/sources-ubuntu-focal.list +++ b/provision/core/mariadb/sources-ubuntu-focal.list @@ -1,23 +1,24 @@ -# MariaDB 10.5 Amsterdam -deb [arch=amd64,arm64,ppc64el] http://ams2.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu focal main -deb-src http://ams2.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu focal main +## sorry, had to be 10.3 due to systemd and rc-d dependencies on 10.4 and 10.5 +# MariaDB 10.3 Amsterdam +deb [arch=amd64,arm64,ppc64el] http://ams2.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu focal main +deb-src http://ams2.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu focal main -# MariaDB 10.5 Digital Ocean Singapore -deb [arch=amd64,arm64,ppc64el] http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu focal main -deb-src http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu focal main +# MariaDB 10.3 Digital Ocean Singapore +deb [arch=amd64,arm64,ppc64el] http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu focal main +deb-src http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu focal main -# MariaDB 10.5 Digital Ocean San Francisco -deb [arch=amd64,arm64,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu focal main -deb-src http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu focal main +# MariaDB 10.3 Digital Ocean San Francisco +deb [arch=amd64,arm64,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu focal main +deb-src http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu focal main -# MariaDB 10.5 Yamagata University Japan -deb [arch=amd64,arm64,ppc64el] http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/repo/10.5/ubuntu focal main -deb-src http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/repo/10.5/ubuntu focal main +# MariaDB 10.3 Yamagata University Japan +deb [arch=amd64,arm64,ppc64el] http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/repo/10.3/ubuntu focal main +deb-src http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/repo/10.3/ubuntu focal main -# MariaDB 10.5 UKFast Manchester -deb [arch=amd64,arm64,ppc64el] http://mirrors.ukfast.co.uk/sites/mariadb/repo/10.5/ubuntu focal main -deb-src http://mirrors.ukfast.co.uk/sites/mariadb/repo/10.5/ubuntu focal main +# MariaDB 10.3 UKFast Manchester +deb [arch=amd64,arm64,ppc64el] http://mirrors.ukfast.co.uk/sites/mariadb/repo/10.3/ubuntu focal main +deb-src http://mirrors.ukfast.co.uk/sites/mariadb/repo/10.3/ubuntu focal main -# MariaDB 10.5 PicoNets Mumbai -# deb [arch=amd64,arm64,ppc64el] http://mirrors.piconets.webwerks.in/mariadb-mirror/repo/10.5/ubuntu focal main -# deb-src http://mirrors.piconets.webwerks.in/mariadb-mirror/repo/10.5/ubuntu focal main +# MariaDB 10.3 PicoNets Mumbai +# deb [arch=amd64,arm64,ppc64el] http://mirrors.piconets.webwerks.in/mariadb-mirror/repo/10.3/ubuntu focal main +# deb-src http://mirrors.piconets.webwerks.in/mariadb-mirror/repo/10.3/ubuntu focal main From d80d105e074f3a8d55b9d2d02acd902844c5a630 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 26 Sep 2021 20:35:01 +0700 Subject: [PATCH 007/112] Disable sync clocks ntpdate - docker use same clock as host --- config/homebin/vagrant_provision | 6 +++--- config/homebin/vagrant_up | 4 ++-- provision/provision.sh | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/config/homebin/vagrant_provision b/config/homebin/vagrant_provision index f9eb928bd..438954f08 100755 --- a/config/homebin/vagrant_provision +++ b/config/homebin/vagrant_provision @@ -25,8 +25,8 @@ vvv_info " * Restarting Nginx" sudo service nginx restart vvv_info " * Restarting MariaDB" sudo service mysql restart -vvv_info " * Syncing clocks" -sudo ntpdate -u ntp.ubuntu.com +vvv_info " * Syncing clocks disabled" +# sudo ntpdate -u ntp.ubuntu.com RED="\033[38;5;9m" GREEN="\033[01;32m" @@ -71,4 +71,4 @@ else # List failed provisioners, and pipe them through xargs to print them in a formatted way. ls -A /vagrant/failed_provisioners/ | xargs -I "LOGFILE" echo -e " - log/provisioners/${date_time}/LOGFILE.log" echo -e "${RED} ──────────────────────────────────────────────────${CRESET}" -fi \ No newline at end of file +fi diff --git a/config/homebin/vagrant_up b/config/homebin/vagrant_up index 52de305b1..d725bc347 100755 --- a/config/homebin/vagrant_up +++ b/config/homebin/vagrant_up @@ -34,8 +34,8 @@ vvv_info " * Restarting MariaDB" sudo service mysql restart if [ -x "$(command -v ntpdate)" ]; then - vvv_info " * Syncing clocks" - sudo ntpdate -u ntp.ubuntu.com + vvv_info " * Syncing clocks disabled" + # sudo ntpdate -u ntp.ubuntu.com else vvv_info " - skipping ntpdate clock sync, not installed yet" fi diff --git a/provision/provision.sh b/provision/provision.sh index 2f10746bc..8194f8f96 100755 --- a/provision/provision.sh +++ b/provision/provision.sh @@ -19,8 +19,8 @@ rm -f /vagrant/vvv-custom.yml rm -f /vagrant/config.yml if [ -x "$(command -v ntpdate)" ]; then - echo " * Syncing clocks" - sudo ntpdate -u ntp.ubuntu.com + echo " * Syncing clocks disabled" + # sudo ntpdate -u ntp.ubuntu.com else echo " - skipping ntpdate clock sync, not installed yet" fi From 79a57eaa95ce1dfa29c646df4cea6f13d43e2463 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 26 Sep 2021 20:35:33 +0700 Subject: [PATCH 008/112] Add apt-utils and add `/run/php` dir manually --- provision/core/php/provision.sh | 5 +++++ provision/core/vvv/provision.sh | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/provision/core/php/provision.sh b/provision/core/php/provision.sh index 66d916eb4..b91003a4e 100644 --- a/provision/core/php/provision.sh +++ b/provision/core/php/provision.sh @@ -95,6 +95,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/vvv/provision.sh b/provision/core/vvv/provision.sh index f6deb5236..2cce473f0 100644 --- a/provision/core/vvv/provision.sh +++ b/provision/core/vvv/provision.sh @@ -13,7 +13,7 @@ function vvv_register_packages() { fi #gnupg2 not installed; TODO: maybe add it to image - apt install gnupg2 software-properties-common -y + apt install gnupg2 software-properties-common apt-utils -y if ! vvv_apt_keys_has 'Varying Vagrant Vagrants'; then # Apply the VVV signing key @@ -91,7 +91,9 @@ 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 + # Docker: mv: cannot move '/tmp/hosts' to '/etc/hosts': Device or resource busy + # mv /tmp/hosts /etc/hosts + cat /tmp/hosts > /etc/hosts } export -f cleanup_vvv From 48ab4791794ec37d1ab3083eb3839f804489278d Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 26 Sep 2021 20:36:08 +0700 Subject: [PATCH 009/112] Update `is_module_enabled_fpm` --- config/homebin/switch_php_debugmod | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/homebin/switch_php_debugmod b/config/homebin/switch_php_debugmod index f6194c346..0852d39d4 100755 --- a/config/homebin/switch_php_debugmod +++ b/config/homebin/switch_php_debugmod @@ -51,7 +51,8 @@ enable_phpmod() { } is_module_enabled_fpm() { - if [ -f "/var/lib/php/modules/${1}/fpm/enabled_by_admin/${2}" ]; then + # Docker is enabled_by_maint, not admin, not sure why + if [ -f "/var/lib/php/modules/${1}/fpm/enabled_by_maint/${2}" ]; then return 0 fi return 1 From 23464a63e16c94c9e937868ac734981b44806b2d Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 26 Sep 2021 21:04:54 +0700 Subject: [PATCH 010/112] Fix type --- provision/core/mailhog/provision.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/provision/core/mailhog/provision.sh b/provision/core/mailhog/provision.sh index fb911ab3f..b41cb4c98 100644 --- a/provision/core/mailhog/provision.sh +++ b/provision/core/mailhog/provision.sh @@ -60,7 +60,7 @@ export -f mailhog_setup vvv_add_hook after_packages mailhog_setup if [ "${VVV_DOCKER}" != 1 ]; then - vvv_add_hook services_restart "kilall mailhog; /usr/bin/env /usr/local/bin/mailhog > /dev/null 2>&1 &" + vvv_add_hook services_restart "killall mailhog; /usr/bin/env /usr/local/bin/mailhog > /dev/null 2>&1 &" fi function mailhog_php_finalize() { From 7fd737ece3bd1cc6929d625cbc9161385d8108fa Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 26 Sep 2021 21:25:22 +0700 Subject: [PATCH 011/112] Refactor mailhog restart --- provision/core/mailhog/provision.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/provision/core/mailhog/provision.sh b/provision/core/mailhog/provision.sh index b41cb4c98..c2eb8ca59 100644 --- a/provision/core/mailhog/provision.sh +++ b/provision/core/mailhog/provision.sh @@ -59,8 +59,13 @@ export -f mailhog_setup vvv_add_hook after_packages mailhog_setup +function mailhog_restart() { + killall mailhog; /usr/bin/env /usr/local/bin/mailhog > /dev/null 2>&1 & +} +export -f mailhog_restart + if [ "${VVV_DOCKER}" != 1 ]; then - vvv_add_hook services_restart "killall mailhog; /usr/bin/env /usr/local/bin/mailhog > /dev/null 2>&1 &" + vvv_add_hook services_restart mailhog_restart fi function mailhog_php_finalize() { From 76a008b2f6f1697680d03381566cc18157e17f2d Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 26 Sep 2021 21:45:30 +0700 Subject: [PATCH 012/112] Fix vagrant up for docker container --- config/homebin/vagrant_up | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/config/homebin/vagrant_up b/config/homebin/vagrant_up index d725bc347..47c21884f 100755 --- a/config/homebin/vagrant_up +++ b/config/homebin/vagrant_up @@ -33,6 +33,15 @@ sudo service nginx restart vvv_info " * Restarting MariaDB" sudo service mysql restart +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 [ -x "$(command -v ntpdate)" ]; then vvv_info " * Syncing clocks disabled" # sudo ntpdate -u ntp.ubuntu.com @@ -40,6 +49,7 @@ else vvv_info " - skipping ntpdate clock sync, not installed yet" fi + mkdir -p /vagrant/failed_provisioners if [ -z "$(ls -A /vagrant/failed_provisioners/)" ]; then echo -e "${CRESET}" From b8a0c445f82ddad64934a2a481832ab30f65ccbf Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 3 Oct 2021 02:00:34 +0700 Subject: [PATCH 013/112] remove unnen --- provision/core/vvv/provision.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/provision/core/vvv/provision.sh b/provision/core/vvv/provision.sh index 2cce473f0..bcdc4e3b3 100644 --- a/provision/core/vvv/provision.sh +++ b/provision/core/vvv/provision.sh @@ -12,9 +12,6 @@ function vvv_register_packages() { vvv_error " ! VVV could not copy an Apt source file ( ${APTSOURCE} ), the current OS/Version (${OSID,,}-${OSCODENAME,,}) combination is unavailable" fi - #gnupg2 not installed; TODO: maybe add it to image - apt install gnupg2 software-properties-common apt-utils -y - if ! vvv_apt_keys_has 'Varying Vagrant Vagrants'; then # Apply the VVV signing key vvv_info " * Applying the Varying Vagrant Vagrants mirror signing key..." From fdade8b355f2d59ecc801dfec4196f2b213d8489 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 3 Oct 2021 12:55:50 +0700 Subject: [PATCH 014/112] Reinit /etc/hosts on up - Docker doesn't support persistent /etc/hosts --- config/homebin/vagrant_up | 5 +++++ provision/core/vvv/provision.sh | 4 ++++ provision/provision-helpers.sh | 23 +++++++++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/config/homebin/vagrant_up b/config/homebin/vagrant_up index 47c21884f..5718c3e81 100755 --- a/config/homebin/vagrant_up +++ b/config/homebin/vagrant_up @@ -9,6 +9,7 @@ # it does not exist, then we'll handle some basic tasks. set -eo pipefail source /srv/provision/provision-helpers.sh +#source /srv/provision/provision-site.sh RED="\033[38;5;9m" R=$RED @@ -27,6 +28,10 @@ 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" +re_init_etc_hosts + vvv_info " * Restarting Nginx" sudo service nginx restart diff --git a/provision/core/vvv/provision.sh b/provision/core/vvv/provision.sh index bcdc4e3b3..cfedefc3b 100644 --- a/provision/core/vvv/provision.sh +++ b/provision/core/vvv/provision.sh @@ -58,6 +58,10 @@ function vvv_register_packages() { # webp support libwebp-dev webp + + # not included in docker images by default, lets add + iputils-ping + net-tools ) } vvv_add_hook before_packages vvv_register_packages 0 diff --git a/provision/provision-helpers.sh b/provision/provision-helpers.sh index 217242f10..2bf31f537 100755 --- a/provision/provision-helpers.sh +++ b/provision/provision-helpers.sh @@ -545,3 +545,26 @@ vvv_apt_package_remove() { return 0 } export -f vvv_apt_package_remove + +# Docker additional helpers +function get_vvv_sites() { + local sites=$(shyaml -q keys "sites" <${VVV_CONFIG}) + echo "${sites}" +} + +function re_init_etc_hosts() { + local SITES=$(get_vvv_sites) + sudo rm /tmp/site-hosts + for SITE in $SITES; do + SITE_ESCAPED="${SITE//./\\.}" + VVV_SITE_NAME=${SITE} + local 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 + done + done + + sudo cat /tmp/site-hosts >> /etc/hosts +} + +export -f re_init_etc_hosts From d6ed3459f09ba9ccf66cfd8f634a8aaab92208bb Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 3 Oct 2021 13:05:05 +0700 Subject: [PATCH 015/112] Failsafe delete temporary hosts file --- provision/provision-helpers.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/provision/provision-helpers.sh b/provision/provision-helpers.sh index 2bf31f537..023d43535 100755 --- a/provision/provision-helpers.sh +++ b/provision/provision-helpers.sh @@ -553,8 +553,10 @@ function get_vvv_sites() { } function re_init_etc_hosts() { + if test -f "/tmp/site-hosts"; then + sudo rm /tmp/site-hosts + fi local SITES=$(get_vvv_sites) - sudo rm /tmp/site-hosts for SITE in $SITES; do SITE_ESCAPED="${SITE//./\\.}" VVV_SITE_NAME=${SITE} From a8101dfec746574b272f0e0b992fdf8ba2797677 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 3 Oct 2021 13:06:39 +0700 Subject: [PATCH 016/112] Cleanup --- provision/provision-helpers.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/provision/provision-helpers.sh b/provision/provision-helpers.sh index 023d43535..377d9018e 100755 --- a/provision/provision-helpers.sh +++ b/provision/provision-helpers.sh @@ -567,6 +567,11 @@ function re_init_etc_hosts() { done sudo cat /tmp/site-hosts >> /etc/hosts + + # cleanup + if test -f "/tmp/site-hosts"; then + sudo rm /tmp/site-hosts + fi } export -f re_init_etc_hosts From 636a530e2a5ad407e577485adef5b53aa16384f6 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Wed, 6 Oct 2021 11:55:03 +0700 Subject: [PATCH 017/112] Mac OS compatibility --- README.md | 22 +++++++++++++++++----- Vagrantfile | 28 ++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3f2ec08ef..3de2e3fd1 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,36 @@ # VVV ( Varying Vagrant Vagrants ) + ## with Docker as default provider -VVV is a local developer environment, mainly aimed at [WordPress](https://wordpress.org) developers. It uses [Vagrant](https://www.vagrantup.com) and Docker, and can be used to build sites, and contribute to WordPress. +VVV is a local developer environment, mainly aimed at [WordPress](https://wordpress.org) developers. It +uses [Vagrant](https://www.vagrantup.com) and Docker, and can be used to build sites, and contribute to WordPress. ## How To Use -To use it, download and install [Vagrant](https://www.vagrantup.com) and [Docker](https://docs.docker.com/engine/install/). Then, clone this repository and run: +To use it, download and install [Vagrant](https://www.vagrantup.com) +and [Docker](https://docs.docker.com/engine/install/). Then, clone this repository and run: ```shell git clone -b docker-provider https://github.com/pentatonicfunk/VVV-Docker.git ~/vvv-local cd ~/vvv-local vagrant plugin install --local + +# MAC Only ( see: https://docs.docker.com/desktop/mac/networking/#per-container-ip-addressing-is-not-possible ) +sudo ifconfig lo0 alias 192.168.50.4/24 +# !! this doesn't survive restart, do it again before next vagrant up on future boot +#MAC Only ( with this command in mac, now we can access 192.168.50.4, but we still have to publish ports, which will be done in Vagrantfile) + vagrant up --provision ``` When it's done, visit [http://vvv.test](http://vvv.test). -The online documentation contains more detailed [installation instructions](https://varyingvagrantvagrants.org/docs/en-US/installation/). +The online documentation contains more +detailed [installation instructions](https://varyingvagrantvagrants.org/docs/en-US/installation/). * **Web**: [https://varyingvagrantvagrants.org/](https://varyingvagrantvagrants.org/) -* **Contributing**: Contributions are more than welcome. Please see our current [contributing guidelines](https://varyingvagrantvagrants.org/docs/en-US/contributing/). Thanks! +* **Contributing**: Contributions are more than welcome. Please see our + current [contributing guidelines](https://varyingvagrantvagrants.org/docs/en-US/contributing/). Thanks! ## Minimum System requirements @@ -27,4 +38,5 @@ The online documentation contains more detailed [installation instructions](http ## Software included -For a comprehensive list, please see the [list of installed packages](https://varyingvagrantvagrants.org/docs/en-US/installed-packages/). +For a comprehensive list, please see +the [list of installed packages](https://varyingvagrantvagrants.org/docs/en-US/installed-packages/). diff --git a/Vagrantfile b/Vagrantfile index 73e42bf72..f04dccf90 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -72,6 +72,25 @@ end show_logo = true if %w[up resume status provision reload].include? ARGV[0] show_logo = false if ENV['VVV_SKIP_LOGO'] +# OS Detection +module OS + def OS.windows? + (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil + end + + def OS.mac? + (/darwin/ =~ RUBY_PLATFORM) != nil + end + + def OS.unix? + !OS.windows? + end + + def OS.linux? + OS.unix? and not OS.mac? + end +end + # Show the initial splash screen if show_logo git_or_zip = 'zip-no-vcs' @@ -436,6 +455,15 @@ Vagrant.configure('2') do |config| config.vm.provider :docker do |d| d.image = 'pentatonicfunk/vagrant-ubuntu-base-images:20.04' d.has_ssh = true + if OS.mac? + # Docker in mac need explicit ports publish to access + # before provision `sudo ifconfig lo0 alias 192.168.50.4/24` + d.ports = [ "#{vvv_config['vm_config']['private_network_ip']}:80:80" ] + d.ports += [ "#{vvv_config['vm_config']['private_network_ip']}:443:443" ] + d.ports += [ "#{vvv_config['vm_config']['private_network_ip']}:3306:3306" ] + d.ports += [ "#{vvv_config['vm_config']['private_network_ip']}:8025:8025" ] + d.ports += [ "#{vvv_config['vm_config']['private_network_ip']}:1025:1025" ] + end end if defined? vvv_config['vm_config']['box'] From da3b6979161c206132e347960b25372c3bbccf51 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Thu, 7 Oct 2021 18:08:14 +0700 Subject: [PATCH 018/112] Mariadb 10.5 compat --- config/homebin/vagrant_provision | 2 +- config/homebin/vagrant_up | 2 +- config/init/vvv-start.conf | 2 +- provision/core/mariadb/provision.sh | 26 ++++++------- .../core/mariadb/sources-ubuntu-bionic.list | 38 +++++++++---------- .../core/mariadb/sources-ubuntu-focal.list | 38 +++++++++---------- provision/core/vvv/provision.sh | 1 + 7 files changed, 53 insertions(+), 56 deletions(-) diff --git a/config/homebin/vagrant_provision b/config/homebin/vagrant_provision index 438954f08..70e8350f3 100755 --- a/config/homebin/vagrant_provision +++ b/config/homebin/vagrant_provision @@ -24,7 +24,7 @@ fi vvv_info " * Restarting Nginx" sudo service nginx restart vvv_info " * Restarting MariaDB" -sudo service mysql restart +sudo service mariadb restart vvv_info " * Syncing clocks disabled" # sudo ntpdate -u ntp.ubuntu.com diff --git a/config/homebin/vagrant_up b/config/homebin/vagrant_up index 5718c3e81..a7985505f 100755 --- a/config/homebin/vagrant_up +++ b/config/homebin/vagrant_up @@ -36,7 +36,7 @@ vvv_info " * Restarting Nginx" sudo service nginx restart vvv_info " * Restarting MariaDB" -sudo service mysql restart +sudo service mariadb restart vvv_info " * Restarting PHP-FPM" find /etc/init.d/ -name "php*-fpm" -exec bash -c 'sudo service "$(basename "$0")" restart' {} \; diff --git a/config/init/vvv-start.conf b/config/init/vvv-start.conf index 8fb71a525..b6c7ab079 100644 --- a/config/init/vvv-start.conf +++ b/config/init/vvv-start.conf @@ -8,7 +8,7 @@ script service nginx start service php7.4-fpm start service memcached start -service mysql start +service mariadb start service mailhog start service ntp start end script diff --git a/provision/core/mariadb/provision.sh b/provision/core/mariadb/provision.sh index 5ab6941b1..d165b7ced 100644 --- a/provision/core/mariadb/provision.sh +++ b/provision/core/mariadb/provision.sh @@ -8,8 +8,8 @@ function mariadb_register_packages() { # Use debconf-set-selections to specify the default password for the root MariaDB # account. This runs on every provision, even if MariaDB has been installed. If # MariaDB is already installed, it will not affect anything. - echo mariadb-server-10.3 mysql-server/root_password password "root" | debconf-set-selections - echo mariadb-server-10.3 mysql-server/root_password_again password "root" | debconf-set-selections + echo mariadb-server-10.5 mysql-server/root_password password "root" | debconf-set-selections + echo mariadb-server-10.5 mysql-server/root_password_again password "root" | debconf-set-selections vvv_info " * Setting up MySQL configuration file links..." @@ -57,12 +57,10 @@ function check_mysql_root_password() { vvv_info " * Checking the root user password is root" # Get if root has correct password and mysql_native_password as plugin sql=$( cat <<-SQL - -- 10.5 SELECT count(*) from mysql.user WHERE - -- User='root' AND - -- authentication_string=PASSWORD('root') AND - -- plugin='mysql_native_password'; - -- 10.3 - SELECT count(*) from mysql.user where User='root' AND Password=PASSWORD('root'); + SELECT count(*) from mysql.user WHERE + User='root' AND + authentication_string=PASSWORD('root') AND + plugin='mysql_native_password'; SQL ) vvv_info "${sql}" @@ -79,9 +77,7 @@ SQL # Do reset password in safemode vvv_warn " * The root password is not root, fixing" sql=$( cat <<-SQL - -- 10.5 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password USING PASSWORD('root'); - -- 10.3 - ALTER USER 'root'@'localhost' IDENTIFIED BY 'root'; + ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password USING PASSWORD('root'); FLUSH PRIVILEGES; SQL ) @@ -111,7 +107,7 @@ function mysql_setup() { # Due to systemd dependencies, in docker, mysql service is not auto started vvv_info " * Force Restarting mysql service" - service mysql restart + service mariadb restart if [ "${VVV_DOCKER}" != 1 ]; then check_mysql_root_password @@ -121,12 +117,12 @@ function mysql_setup() { # happens after a `vagrant halt`. Check to see if it's running before # deciding whether to start or restart. # output bit different on docker container, cause no systemd - if [ $(service mysql status|grep 'Uptime' | wc -l) -ne 1 ]; then + if [ $(service mariadb status|grep 'Uptime' | wc -l) -ne 1 ]; then vvv_info " * Starting the mysql service" - service mysql start + service mariadb start else vvv_info " * Restarting mysql service" - service mysql restart + service mariadb restart fi # IMPORT SQL diff --git a/provision/core/mariadb/sources-ubuntu-bionic.list b/provision/core/mariadb/sources-ubuntu-bionic.list index b08586315..05f5dad3f 100644 --- a/provision/core/mariadb/sources-ubuntu-bionic.list +++ b/provision/core/mariadb/sources-ubuntu-bionic.list @@ -1,24 +1,24 @@ -## sorry, had to be 10.3 due to systemd and rc-d dependencies on 10.4 and 10.5 -# MariaDB 10.3 Amsterdam -deb [arch=amd64,arm64,ppc64el] http://ams2.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main -deb-src http://ams2.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main +## sorry, had to be 10.5 due to systemd and rc-d dependencies on 10.4 and 10.5 +# MariaDB 10.5 Amsterdam +deb [arch=amd64,arm64,ppc64el] http://ams2.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu bionic main +deb-src http://ams2.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu bionic main -# MariaDB 10.3 Digital Ocean Singapore -deb [arch=amd64,arm64,ppc64el] http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main -deb-src http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main +# MariaDB 10.5 Digital Ocean Singapore +deb [arch=amd64,arm64,ppc64el] http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu bionic main +deb-src http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu bionic main -# MariaDB 10.3 Digital Ocean San Francisco -deb [arch=amd64,arm64,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main -deb-src http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main +# MariaDB 10.5 Digital Ocean San Francisco +deb [arch=amd64,arm64,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu bionic main +deb-src http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu bionic main -# MariaDB 10.3 Yamagata University Japan -deb [arch=amd64,arm64,ppc64el] http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/repo/10.3/ubuntu bionic main -deb-src http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/repo/10.3/ubuntu bionic main +# MariaDB 10.5 Yamagata University Japan +deb [arch=amd64,arm64,ppc64el] http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/repo/10.5/ubuntu bionic main +deb-src http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/repo/10.5/ubuntu bionic main -# MariaDB 10.3 UKFast Manchester -deb [arch=amd64,arm64,ppc64el] http://mirrors.ukfast.co.uk/sites/mariadb/repo/10.3/ubuntu bionic main -deb-src http://mirrors.ukfast.co.uk/sites/mariadb/repo/10.3/ubuntu bionic main +# MariaDB 10.5 UKFast Manchester +deb [arch=amd64,arm64,ppc64el] http://mirrors.ukfast.co.uk/sites/mariadb/repo/10.5/ubuntu bionic main +deb-src http://mirrors.ukfast.co.uk/sites/mariadb/repo/10.5/ubuntu bionic main -# MariaDB 10.3 PicoNets Mumbai -# deb [arch=amd64,arm64,ppc64el] http://mirrors.piconets.webwerks.in/mariadb-mirror/repo/10.3/ubuntu bionic main -# deb-src http://mirrors.piconets.webwerks.in/mariadb-mirror/repo/10.3/ubuntu bionic main +# MariaDB 10.5 PicoNets Mumbai +# deb [arch=amd64,arm64,ppc64el] http://mirrors.piconets.webwerks.in/mariadb-mirror/repo/10.5/ubuntu bionic main +# deb-src http://mirrors.piconets.webwerks.in/mariadb-mirror/repo/10.5/ubuntu bionic main diff --git a/provision/core/mariadb/sources-ubuntu-focal.list b/provision/core/mariadb/sources-ubuntu-focal.list index 552c3e8f0..626434f62 100644 --- a/provision/core/mariadb/sources-ubuntu-focal.list +++ b/provision/core/mariadb/sources-ubuntu-focal.list @@ -1,24 +1,24 @@ -## sorry, had to be 10.3 due to systemd and rc-d dependencies on 10.4 and 10.5 -# MariaDB 10.3 Amsterdam -deb [arch=amd64,arm64,ppc64el] http://ams2.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu focal main -deb-src http://ams2.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu focal main +## sorry, had to be 10.5 due to systemd and rc-d dependencies on 10.4 and 10.5 +# MariaDB 10.5 Amsterdam +deb [arch=amd64,arm64,ppc64el] http://ams2.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu focal main +deb-src http://ams2.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu focal main -# MariaDB 10.3 Digital Ocean Singapore -deb [arch=amd64,arm64,ppc64el] http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu focal main -deb-src http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu focal main +# MariaDB 10.5 Digital Ocean Singapore +deb [arch=amd64,arm64,ppc64el] http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu focal main +deb-src http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu focal main -# MariaDB 10.3 Digital Ocean San Francisco -deb [arch=amd64,arm64,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu focal main -deb-src http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu focal main +# MariaDB 10.5 Digital Ocean San Francisco +deb [arch=amd64,arm64,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu focal main +deb-src http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu focal main -# MariaDB 10.3 Yamagata University Japan -deb [arch=amd64,arm64,ppc64el] http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/repo/10.3/ubuntu focal main -deb-src http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/repo/10.3/ubuntu focal main +# MariaDB 10.5 Yamagata University Japan +deb [arch=amd64,arm64,ppc64el] http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/repo/10.5/ubuntu focal main +deb-src http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/repo/10.5/ubuntu focal main -# MariaDB 10.3 UKFast Manchester -deb [arch=amd64,arm64,ppc64el] http://mirrors.ukfast.co.uk/sites/mariadb/repo/10.3/ubuntu focal main -deb-src http://mirrors.ukfast.co.uk/sites/mariadb/repo/10.3/ubuntu focal main +# MariaDB 10.5 UKFast Manchester +deb [arch=amd64,arm64,ppc64el] http://mirrors.ukfast.co.uk/sites/mariadb/repo/10.5/ubuntu focal main +deb-src http://mirrors.ukfast.co.uk/sites/mariadb/repo/10.5/ubuntu focal main -# MariaDB 10.3 PicoNets Mumbai -# deb [arch=amd64,arm64,ppc64el] http://mirrors.piconets.webwerks.in/mariadb-mirror/repo/10.3/ubuntu focal main -# deb-src http://mirrors.piconets.webwerks.in/mariadb-mirror/repo/10.3/ubuntu focal main +# MariaDB 10.5 PicoNets Mumbai +# deb [arch=amd64,arm64,ppc64el] http://mirrors.piconets.webwerks.in/mariadb-mirror/repo/10.5/ubuntu focal main +# deb-src http://mirrors.piconets.webwerks.in/mariadb-mirror/repo/10.5/ubuntu focal main diff --git a/provision/core/vvv/provision.sh b/provision/core/vvv/provision.sh index cfedefc3b..037fdd771 100644 --- a/provision/core/vvv/provision.sh +++ b/provision/core/vvv/provision.sh @@ -42,6 +42,7 @@ function vvv_register_packages() { python3-pip python3-setuptools lftp + nano # ntp service to keep clock current ntp From de8c959503d7215e8432c529e7230ace586f07b1 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Fri, 8 Oct 2021 13:45:02 +0700 Subject: [PATCH 019/112] Remove text/html from nginx gzip_types - By default its always compressed --- provision/core/nginx/config/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/provision/core/nginx/config/nginx.conf b/provision/core/nginx/config/nginx.conf index 55a8a0501..838981424 100644 --- a/provision/core/nginx/config/nginx.conf +++ b/provision/core/nginx/config/nginx.conf @@ -80,7 +80,7 @@ http { image/x-icon text/css text/plain - text/html + # text/html Responses with the “text/html” type are always compressed. https://nginx.org/en/docs/http/ngx_http_gzip_module.html#gzip_types text/x-component; # Disable gzip for bad browsers From 58a2c880f0c0ad6073fb5a9c23c5abd7af186025 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Fri, 8 Oct 2021 14:04:27 +0700 Subject: [PATCH 020/112] Override debian.cnf - I guess backward compat ? --- provision/core/mariadb/config/debian.cnf | 15 +++++++++++++++ provision/core/mariadb/provision.sh | 4 ++++ 2 files changed, 19 insertions(+) create mode 100644 provision/core/mariadb/config/debian.cnf 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 d165b7ced..72184406e 100644 --- a/provision/core/mariadb/provision.sh +++ b/provision/core/mariadb/provision.sh @@ -105,6 +105,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 " * Force Restarting mysql service" service mariadb restart From 729da51d2a0caeab840092e6b2b775dfa1e64065 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sat, 9 Oct 2021 22:03:26 +0700 Subject: [PATCH 021/112] Add `less` package for wp cli --- provision/core/vvv/provision.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/provision/core/vvv/provision.sh b/provision/core/vvv/provision.sh index 037fdd771..0ad80c594 100644 --- a/provision/core/vvv/provision.sh +++ b/provision/core/vvv/provision.sh @@ -42,7 +42,6 @@ function vvv_register_packages() { python3-pip python3-setuptools lftp - nano # ntp service to keep clock current ntp @@ -63,6 +62,8 @@ function vvv_register_packages() { # not included in docker images by default, lets add iputils-ping net-tools + nano + less ) } vvv_add_hook before_packages vvv_register_packages 0 From 08c4db5347b303b03188cf984fa855902e3cafad Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sat, 16 Oct 2021 19:31:20 +0700 Subject: [PATCH 022/112] Rename OS var to VOS to avoid conflict with OS gem --- Vagrantfile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index f04dccf90..210ff3ada 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -73,21 +73,21 @@ show_logo = true if %w[up resume status provision reload].include? ARGV[0] show_logo = false if ENV['VVV_SKIP_LOGO'] # OS Detection -module OS - def OS.windows? +module VOS + def VOS.windows? (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil end - def OS.mac? + def VOS.mac? (/darwin/ =~ RUBY_PLATFORM) != nil end - def OS.unix? - !OS.windows? + def VOS.unix? + !VOS.windows? end - def OS.linux? - OS.unix? and not OS.mac? + def VOS.linux? + VOS.unix? and not VOS.mac? end end @@ -455,7 +455,7 @@ Vagrant.configure('2') do |config| config.vm.provider :docker do |d| d.image = 'pentatonicfunk/vagrant-ubuntu-base-images:20.04' d.has_ssh = true - if OS.mac? + if VOS.mac? # Docker in mac need explicit ports publish to access # before provision `sudo ifconfig lo0 alias 192.168.50.4/24` d.ports = [ "#{vvv_config['vm_config']['private_network_ip']}:80:80" ] From 1cda256f3dbdf93d07003ee5ba13f5de90fffbb2 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 17 Oct 2021 08:50:39 +0700 Subject: [PATCH 023/112] Remove debug #6 --- provision/core/mariadb/provision.sh | 5 ----- provision/core/mariadb/sources-ubuntu-bionic.list | 1 - provision/core/mariadb/sources-ubuntu-focal.list | 1 - 3 files changed, 7 deletions(-) diff --git a/provision/core/mariadb/provision.sh b/provision/core/mariadb/provision.sh index 72184406e..a28c98661 100644 --- a/provision/core/mariadb/provision.sh +++ b/provision/core/mariadb/provision.sh @@ -63,12 +63,7 @@ function check_mysql_root_password() { plugin='mysql_native_password'; SQL ) - vvv_info "${sql}" - root_matches=$(mysql -u root --password=root -s -N -e "${sql}") - - vvv_info "${root_matches}" - if [[ $? -eq 0 && $root_matches == "1" ]]; then # mysql connected and the SQL above matched vvv_success " * The database root password is the expected value" diff --git a/provision/core/mariadb/sources-ubuntu-bionic.list b/provision/core/mariadb/sources-ubuntu-bionic.list index 05f5dad3f..85ac48fb2 100644 --- a/provision/core/mariadb/sources-ubuntu-bionic.list +++ b/provision/core/mariadb/sources-ubuntu-bionic.list @@ -1,4 +1,3 @@ -## sorry, had to be 10.5 due to systemd and rc-d dependencies on 10.4 and 10.5 # MariaDB 10.5 Amsterdam deb [arch=amd64,arm64,ppc64el] http://ams2.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu bionic main deb-src http://ams2.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu bionic main diff --git a/provision/core/mariadb/sources-ubuntu-focal.list b/provision/core/mariadb/sources-ubuntu-focal.list index 626434f62..6e2a561dd 100644 --- a/provision/core/mariadb/sources-ubuntu-focal.list +++ b/provision/core/mariadb/sources-ubuntu-focal.list @@ -1,4 +1,3 @@ -## sorry, had to be 10.5 due to systemd and rc-d dependencies on 10.4 and 10.5 # MariaDB 10.5 Amsterdam deb [arch=amd64,arm64,ppc64el] http://ams2.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu focal main deb-src http://ams2.mirrors.digitalocean.com/mariadb/repo/10.5/ubuntu focal main From ff1b71b5b1e83dec42378dbdbcdf0d67894fa68e Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 17 Oct 2021 08:56:57 +0700 Subject: [PATCH 024/112] Keep vm.box for non docker compat #4 --- Vagrantfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 210ff3ada..8a8a4d5c5 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -417,7 +417,7 @@ Vagrant.configure('2') do |config| # 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 = 'bento/ubuntu-20.04' config.vm.box_check_update = false # If we're at a contributor day, switch the base box to the prebuilt one @@ -453,6 +453,7 @@ Vagrant.configure('2') do |config| # Docker use image. config.vm.provider :docker do |d| + config.vm.box = '' d.image = 'pentatonicfunk/vagrant-ubuntu-base-images:20.04' d.has_ssh = true if VOS.mac? From d103405e39d6552cf89f71a44ef91f8bb3f181be Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 17 Oct 2021 09:05:52 +0700 Subject: [PATCH 025/112] Move VB box to its own specific section to not break docker #4 --- Vagrantfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 8a8a4d5c5..b5f8a1cd6 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -417,7 +417,6 @@ Vagrant.configure('2') do |config| # 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 # If we're at a contributor day, switch the base box to the prebuilt one @@ -451,9 +450,13 @@ Vagrant.configure('2') do |config| override.vm.box = 'bento/ubuntu-20.04' end + # virtualbox + config.vm.provider :virtualbox do |_v, override| + override.vm.box = 'bento/ubuntu-20.04' + end + # Docker use image. config.vm.provider :docker do |d| - config.vm.box = '' d.image = 'pentatonicfunk/vagrant-ubuntu-base-images:20.04' d.has_ssh = true if VOS.mac? From 4acaa625dc4ca86021227e3431acbc21c2d1ada5 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 17 Oct 2021 09:17:59 +0700 Subject: [PATCH 026/112] Minimize default config changes #5 --- config/default-config.yml | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/config/default-config.yml b/config/default-config.yml index 96cf37143..cf79fc1bf 100644 --- a/config/default-config.yml +++ b/config/default-config.yml @@ -62,6 +62,22 @@ sites: hosts: - trunk.wordpress.test + # The following commented out site configuration will create a environment useful + # for contributions to the WordPress meta team, .e.g WordCamps, .org, etc: + wordpress-meta-environment: + skip_provisioning: true # disabled by default, this takes a long time to provision + description: "An environment useful for contributions to the WordPress meta team." + repo: https://github.com/WordPress/meta-environment.git + hosts: + - wp-meta.test + custom: + provision_site: + "buddypressorg.test": true + "jobs.wordpressnet.test": true + "wordcamp.test": true + "wordpressorg.test": true + "wordpresstv.test": true + # The following commented out site configuration will create a standard WordPress # site in www/example-site/ available at http://my-example-site.test. # Remember, whitespace is significant! Tabs and spaces mean different things @@ -77,8 +93,8 @@ utilities: core: # The core VVV utility - tls-ca # HTTPS SSL/TLS certificates - phpmyadmin # Web based database client - - memcached-admin # Object cache management - - opcache-status # opcache management + #- memcached-admin # Object cache management + #- opcache-status # opcache management #- webgrind # PHP Debugging #- mongodb # needed for Tideways/XHGui #- tideways # PHP profiling tool, also installs xhgui check https://varyingvagrantvagrants.org/docs/en-US/references/tideways-xhgui/ @@ -86,9 +102,9 @@ utilities: #- php56 #- php70 #- php71 - - php72 - - php73 - - php74 + #- php72 + #- php73 + #- php74 # 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. @@ -97,9 +113,9 @@ utilities: vm_config: # For WP core development we recommend at least 2GB ( 2048 ), # If you have 4GB of RAM, lower this to 768MB or you may encounter issues - # memory: 2048 + memory: 2048 # CPU cores: - # cores: 2 + cores: 2 # this tells VVV to use the prebuilt box copied from the USB drive at contributor days # once set to false, do not change back to true, and reprovision @@ -137,6 +153,5 @@ general: #github_token: xxxxxx # Settings for the vagrant plugins supported by VVV -# Docker doesn't need this -#vagrant-plugins: -# disksize: 10GB # requires the disk size vagrant plugin +vagrant-plugins: + disksize: 10GB # requires the disk size vagrant plugin From f0ae39afd59b533958172d555df5e23903935b13 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 17 Oct 2021 09:43:51 +0700 Subject: [PATCH 027/112] Follow vvv function name convention #7 --- config/homebin/vagrant_up | 2 +- provision/provision-helpers.sh | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/homebin/vagrant_up b/config/homebin/vagrant_up index a7985505f..8a428c11a 100755 --- a/config/homebin/vagrant_up +++ b/config/homebin/vagrant_up @@ -30,7 +30,7 @@ fi # /etc/host doesn't survive restart on docker vvv_info " * Reinit /etc/hosts" -re_init_etc_hosts +vvv_update_guest_hosts vvv_info " * Restarting Nginx" sudo service nginx restart diff --git a/provision/provision-helpers.sh b/provision/provision-helpers.sh index 377d9018e..4c1acee8f 100755 --- a/provision/provision-helpers.sh +++ b/provision/provision-helpers.sh @@ -547,16 +547,16 @@ vvv_apt_package_remove() { export -f vvv_apt_package_remove # Docker additional helpers -function get_vvv_sites() { +function vvv_get_sites() { local sites=$(shyaml -q keys "sites" <${VVV_CONFIG}) echo "${sites}" } -function re_init_etc_hosts() { +function vvv_update_guest_hosts() { if test -f "/tmp/site-hosts"; then sudo rm /tmp/site-hosts fi - local SITES=$(get_vvv_sites) + local SITES=$(vvv_get_sites) for SITE in $SITES; do SITE_ESCAPED="${SITE//./\\.}" VVV_SITE_NAME=${SITE} @@ -574,4 +574,4 @@ function re_init_etc_hosts() { fi } -export -f re_init_etc_hosts +export -f vvv_update_guest_hosts From 39d794f53a8bc983be3ff447853891396157c837 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 17 Oct 2021 09:55:00 +0700 Subject: [PATCH 028/112] Attempt to migrate `cat` and append to `tee` --- provision/core/vvv/provision.sh | 4 +--- provision/provision-helpers.sh | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/provision/core/vvv/provision.sh b/provision/core/vvv/provision.sh index 0ad80c594..c95246e96 100644 --- a/provision/core/vvv/provision.sh +++ b/provision/core/vvv/provision.sh @@ -94,9 +94,7 @@ 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 - # Docker: mv: cannot move '/tmp/hosts' to '/etc/hosts': Device or resource busy - # mv /tmp/hosts /etc/hosts - cat /tmp/hosts > /etc/hosts + echo "$( /dev/null } export -f cleanup_vvv diff --git a/provision/provision-helpers.sh b/provision/provision-helpers.sh index 4c1acee8f..5201d9257 100755 --- a/provision/provision-helpers.sh +++ b/provision/provision-helpers.sh @@ -566,7 +566,7 @@ function vvv_update_guest_hosts() { done done - sudo cat /tmp/site-hosts >> /etc/hosts + echo "$( /dev/null # cleanup if test -f "/tmp/site-hosts"; then From 47057c849f59ca94a97e80553fafec0220db1ceb Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Wed, 20 Oct 2021 15:00:59 +0700 Subject: [PATCH 029/112] Improve macos detection, and move ifconfig command to Vagrantfile - Solves #8 and #10 --- README.md | 6 ------ Vagrantfile | 40 +++++++++++++++++++--------------------- 2 files changed, 19 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 3de2e3fd1..022155031 100644 --- a/README.md +++ b/README.md @@ -14,12 +14,6 @@ and [Docker](https://docs.docker.com/engine/install/). Then, clone this reposito git clone -b docker-provider https://github.com/pentatonicfunk/VVV-Docker.git ~/vvv-local cd ~/vvv-local vagrant plugin install --local - -# MAC Only ( see: https://docs.docker.com/desktop/mac/networking/#per-container-ip-addressing-is-not-possible ) -sudo ifconfig lo0 alias 192.168.50.4/24 -# !! this doesn't survive restart, do it again before next vagrant up on future boot -#MAC Only ( with this command in mac, now we can access 192.168.50.4, but we still have to publish ports, which will be done in Vagrantfile) - vagrant up --provision ``` diff --git a/Vagrantfile b/Vagrantfile index b5f8a1cd6..5202a4a23 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -72,25 +72,6 @@ end show_logo = true if %w[up resume status provision reload].include? ARGV[0] show_logo = false if ENV['VVV_SKIP_LOGO'] -# OS Detection -module VOS - def VOS.windows? - (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil - end - - def VOS.mac? - (/darwin/ =~ RUBY_PLATFORM) != nil - end - - def VOS.unix? - !VOS.windows? - end - - def VOS.linux? - VOS.unix? and not VOS.mac? - end -end - # Show the initial splash screen if show_logo git_or_zip = 'zip-no-vcs' @@ -459,9 +440,8 @@ Vagrant.configure('2') do |config| config.vm.provider :docker do |d| d.image = 'pentatonicfunk/vagrant-ubuntu-base-images:20.04' d.has_ssh = true - if VOS.mac? + if Vagrant::Util::Platform.platform == 'darwin19' # Docker in mac need explicit ports publish to access - # before provision `sudo ifconfig lo0 alias 192.168.50.4/24` d.ports = [ "#{vvv_config['vm_config']['private_network_ip']}:80:80" ] d.ports += [ "#{vvv_config['vm_config']['private_network_ip']}:443:443" ] d.ports += [ "#{vvv_config['vm_config']['private_network_ip']}:3306:3306" ] @@ -891,6 +871,24 @@ Vagrant.configure('2') do |config| end end + # specific trigger for mac and docker + if Vagrant::Util::Platform.platform == 'darwin19' && vvv_config['vm_config']['provider'] == 'docker' + config.trigger.before :up do |trigger| + trigger.name = "VVV Setup docker local network before up" + trigger.run = {inline: "bash -c 'sudo ifconfig lo0 alias #{vvv_config['vm_config']['private_network_ip']}/24'"} + end + config.trigger.after :halt do |trigger| + trigger.name = 'VVV delete docker local network after halt' + trigger.run = {inline: "bash -c 'sudo ifconfig lo0 inet delete #{vvv_config['vm_config']['private_network_ip']}'"} + trigger.on_error = :continue + end + config.trigger.after :destroy do |trigger| + trigger.name = 'VVV delete docker local network after destroy' + trigger.run = {inline: "bash -c 'sudo ifconfig lo0 inet delete #{vvv_config['vm_config']['private_network_ip']}'"} + trigger.on_error = :continue + end + end + config.trigger.after :up do |trigger| trigger.name = 'VVV Post-Up' trigger.run_remote = { inline: '/srv/config/homebin/vagrant_up' } From 42efd1c56f84b6f91b6eba71047b28abe9798279 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sat, 29 Jan 2022 22:23:24 +0700 Subject: [PATCH 030/112] Fix: more new private ip address adjusment --- Vagrantfile | 6 +++--- config/wordpress-config/wp-tests-config.php | 2 +- database/sql/init.sql | 2 +- provision/core/memcached/config/memcached.conf | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 9193f04f4..2fea2f741 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -481,13 +481,13 @@ Vagrant.configure('2') do |config| # # A private network is created by default. This is the IP address through which your # host machine will communicate to the guest. In this default configuration, the virtual - # machine will have an IP address of 192.168.50.4 and a virtual network adapter will be - # created on your host machine with the IP of 192.168.50.1 as a gateway. + # machine will have an IP address of 192.168.56.4 and a virtual network adapter will be + # created on your host machine with the IP of 192.168.56.1 as a gateway. # # 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. # diff --git a/config/wordpress-config/wp-tests-config.php b/config/wordpress-config/wp-tests-config.php index 8d289d5e3..ad86c0c89 100755 --- a/config/wordpress-config/wp-tests-config.php +++ b/config/wordpress-config/wp-tests-config.php @@ -28,7 +28,7 @@ } else if ( file_exists( '/vagrant' ) ) { define( 'DB_HOST', 'localhost' ); } else { - define( 'DB_HOST', '192.168.50.4' ); + define( 'DB_HOST', '192.168.56.4' ); } define( 'DB_NAME', getenv( 'WP_TESTS_DB_NAME' ) ?: 'wordpress_unit_tests' ); if ( getenv( 'WP_TESTS_DB_USER' ) ) { diff --git a/database/sql/init.sql b/database/sql/init.sql index e0d3af767..2b72aa4a0 100644 --- a/database/sql/init.sql +++ b/database/sql/init.sql @@ -1,7 +1,7 @@ # Create the unit tests DB. CREATE DATABASE IF NOT EXISTS `wordpress_unit_tests`; GRANT ALL PRIVILEGES ON `wordpress_unit_tests`.* TO 'wp'@'localhost' IDENTIFIED BY 'wp'; -GRANT ALL PRIVILEGES ON `wordpress_unit_tests`.* TO 'wp'@'192.168.50.1' IDENTIFIED BY 'wp'; +GRANT ALL PRIVILEGES ON `wordpress_unit_tests`.* TO 'wp'@'192.168.56.1' IDENTIFIED BY 'wp'; # Create an external user with privileges on all databases in mysql so # that a connection can be made from the local machine without an SSH tunnel diff --git a/provision/core/memcached/config/memcached.conf b/provision/core/memcached/config/memcached.conf index a0b7506f1..d38c02f08 100644 --- a/provision/core/memcached/config/memcached.conf +++ b/provision/core/memcached/config/memcached.conf @@ -33,9 +33,9 @@ logfile /var/log/memcached/memcached.log # Specify which IP address to listen on. The default is to listen on all IP addresses # This parameter is one of the only security measures that memcached has, so make sure -# it's listening on a firewalled interface. Note that 192.168.50.4 is the private +# it's listening on a firewalled interface. Note that 192.168.56.4 is the private # network IP for the Vagrant box per the Vagrantfile, and as such, it is safe. --l 127.0.0.1,192.168.50.4 +-l 127.0.0.1,192.168.56.4 # Limit the number of simultaneous incoming connections. The daemon default is 1024 # -c 1024 From 1da5dd1c559e43190e6fcf747c9d63b31ea188f7 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Mon, 15 Aug 2022 22:10:54 +0700 Subject: [PATCH 031/112] Fix / revert default box --- Vagrantfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 69b618766..4121b5202 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -405,7 +405,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # 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 # If we're at a contributor day, switch the base box to the prebuilt one From 00d7499ff757ae8dd97f962384715aebadaae297 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Mon, 15 Aug 2022 23:11:14 +0700 Subject: [PATCH 032/112] Update readme, prepare using `develop` as upstream --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 022155031..a85577507 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,12 @@ VVV is a local developer environment, mainly aimed at [WordPress](https://wordpress.org) developers. It uses [Vagrant](https://www.vagrantup.com) and Docker, and can be used to build sites, and contribute to WordPress. +## Which branch of VVV it's using as upstream ? + +[develop](https://github.com/Varying-Vagrant-Vagrants/VVV). Although `develop` sometimes get new features that has issues, but this branch actively developed, and critical issue more than often get fixed in this branch fairly quick +This is nature of VVV : +> normally `develop` is more stable, but, `develop` can sometimes be unstable if something has just been merged and we didn't spot it in time + ## How To Use To use it, download and install [Vagrant](https://www.vagrantup.com) From a488c4ba5c58c7ac97a0fc71989320438c74a358 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Sun, 11 Sep 2022 17:18:26 +0100 Subject: [PATCH 033/112] remove duplicate apt package listings --- provision/core/vvv/provision.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/provision/core/vvv/provision.sh b/provision/core/vvv/provision.sh index d65f9e939..8e734a6a3 100644 --- a/provision/core/vvv/provision.sh +++ b/provision/core/vvv/provision.sh @@ -53,12 +53,6 @@ function vvv_register_packages() { # webp support libwebp-dev webp - - # not included in docker images by default, lets add - iputils-ping - net-tools - nano - less ) } vvv_add_hook register_apt_packages vvv_register_packages 0 From 1a5394a2951520d9adb6db4f389754d4888e77ef Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Sun, 11 Sep 2022 17:22:24 +0100 Subject: [PATCH 034/112] bring readme closer to original --- README.md | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 5ec1ee680..3f276f051 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,31 @@ # VVV -## with Docker as default provider +[![Codacy Badge](https://api.codacy.com/project/badge/Grade/206b06167aaf48aab24422cd417e8afa)](https://www.codacy.com/gh/Varying-Vagrant-Vagrants/VVV?utm_source=github.com&utm_medium=referral&utm_content=Varying-Vagrant-Vagrants/VVV&utm_campaign=Badge_Grade) [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/varying-vagrant-vagrants/vvv.svg)](http://isitmaintained.com/project/varying-vagrant-vagrants/vvv "Average time to resolve an issue") [![Percentage of issues still open](http://isitmaintained.com/badge/open/varying-vagrant-vagrants/vvv.svg)](http://isitmaintained.com/project/varying-vagrant-vagrants/vvv "Percentage of issues still open") -VVV is a local developer environment, mainly aimed at [WordPress](https://wordpress.org) developers. It -uses [Vagrant](https://www.vagrantup.com) and Docker, and can be used to build sites, and contribute to WordPress. +VVV is a local developer environment, mainly aimed at [WordPress](https://wordpress.org) developers. It uses [Vagrant](https://www.vagrantup.com) and VirtualBox/Parallels/HyperV to create a linux server environment for building sites, and contributing to WordPress itself. + +_VVV stands for Varying Vagrant Vagrants._ -## Which branch of VVV it's using as upstream ? +## With Docker as default provider -[develop](https://github.com/Varying-Vagrant-Vagrants/VVV). Although `develop` sometimes get new features that has issues, but this branch actively developed, and critical issue more than often get fixed in this branch fairly quick -This is nature of VVV : -> normally `develop` is more stable, but, `develop` can sometimes be unstable if something has just been merged and we didn't spot it in time +VVV is a local developer environment, mainly aimed at [WordPress](https://wordpress.org) developers. It +uses [Vagrant](https://www.vagrantup.com) and Docker, and can be used to build sites, and contribute to WordPress. ## How To Use -To use it, download and install [Vagrant](https://www.vagrantup.com) -and [Docker](https://docs.docker.com/engine/install/). Then, clone this repository and run: +To use it, download and install [Vagrant](https://www.vagrantup.com) and [VirtualBox](https://www.virtualbox.org/). Then, clone this repository and run: ```shell -git clone -b docker-provider https://github.com/pentatonicfunk/VVV-Docker.git ~/vvv-local -cd ~/vvv-local vagrant plugin install --local vagrant up --provision ``` When it's done, visit [http://vvv.test](http://vvv.test). -The online documentation contains more -detailed [installation instructions](https://varyingvagrantvagrants.org/docs/en-US/installation/). +The online documentation contains more detailed [installation instructions](https://varyingvagrantvagrants.org/docs/en-US/installation/). * **Web**: [https://varyingvagrantvagrants.org/](https://varyingvagrantvagrants.org/) -* **Contributing**: Contributions are more than welcome. Please see our - current [contributing guidelines](https://varyingvagrantvagrants.org/docs/en-US/contributing/). Thanks! +* **Contributing**: Contributions are more than welcome. Please see our current [contributing guidelines](https://varyingvagrantvagrants.org/docs/en-US/contributing/). Thanks! ## Minimum System requirements @@ -38,5 +33,4 @@ detailed [installation instructions](https://varyingvagrantvagrants.org/docs/en- ## Software included -For a comprehensive list, please see -the [list of installed packages](https://varyingvagrantvagrants.org/docs/en-US/installed-packages/). +For a comprehensive list, please see the [list of installed packages](https://varyingvagrantvagrants.org/docs/en-US/installed-packages/). From af1209f461de25d31ece3d417dbd26f29453b3d9 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Sun, 11 Sep 2022 17:23:50 +0100 Subject: [PATCH 035/112] mention docker and parallels --- README.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/README.md b/README.md index 3f276f051..130938dc9 100644 --- a/README.md +++ b/README.md @@ -6,14 +6,9 @@ VVV is a local developer environment, mainly aimed at [WordPress](https://wordpr _VVV stands for Varying Vagrant Vagrants._ -## With Docker as default provider - -VVV is a local developer environment, mainly aimed at [WordPress](https://wordpress.org) developers. It -uses [Vagrant](https://www.vagrantup.com) and Docker, and can be used to build sites, and contribute to WordPress. - ## 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 From 42f99f1fe5984c79ac40100d5a0475ed199c675c Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Sun, 11 Sep 2022 17:26:53 +0100 Subject: [PATCH 036/112] disable docker provider by default, make it opt in --- config/default-config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/default-config.yml b/config/default-config.yml index 0762b3cb8..ca00ecb15 100644 --- a/config/default-config.yml +++ b/config/default-config.yml @@ -124,7 +124,7 @@ vm_config: # provider: hyperv # provider: parallels # provider: vmware_desktop - provider: docker + # provider: docker # General VVV options general: From cbf19b9a335c595327bbfa9b8a781782fa4216b9 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Wed, 22 Feb 2023 15:40:39 +0000 Subject: [PATCH 037/112] change the default PHP to v8.0 --- config/default-config.yml | 7 ++----- config/php-config/php-fpm.conf | 6 +++--- config/php-config/php-www.conf | 2 +- config/php-config/upstream.conf | 2 +- provision/core/nginx/config/nginx.conf | 2 +- provision/core/php/provision.sh | 2 +- provision/provision-site.sh | 2 +- 7 files changed, 10 insertions(+), 13 deletions(-) diff --git a/config/default-config.yml b/config/default-config.yml index f8f0f3505..2c3bd59da 100644 --- a/config/default-config.yml +++ b/config/default-config.yml @@ -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 + #- php82 # 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. diff --git a/config/php-config/php-fpm.conf b/config/php-config/php-fpm.conf index 1d3c5bfcc..db615a4d2 100644 --- a/config/php-config/php-fpm.conf +++ b/config/php-config/php-fpm.conf @@ -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.0-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.0-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.0/fpm/pool.d/*.conf diff --git a/config/php-config/php-www.conf b/config/php-config/php-www.conf index bbf3005e5..fcbb4f56d 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.0-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..a54b43b4e 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; + server unix:/var/run/php8.0-fpm.sock; } diff --git a/provision/core/nginx/config/nginx.conf b/provision/core/nginx/config/nginx.conf index 5fdb01353..bdb329c06 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.0-fpm.sock; } include /etc/nginx/upstreams/*.conf; diff --git a/provision/core/php/provision.sh b/provision/core/php/provision.sh index 0a72223e7..fd01adb89 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.0"} function php_before_packages() { cp -f "/srv/provision/core/php/ondrej-ppa-pin" "/etc/apt/preferences.d/ondrej-ppa-pin" diff --git a/provision/provision-site.sh b/provision/provision-site.sh index 0fde26da2..3c78538e7 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.0" VVV_CONFIG=/vagrant/config.yml From 3f2e83a63d9fbdc00e24201372f08f6d25e0bad1 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Wed, 22 Feb 2023 15:56:08 +0000 Subject: [PATCH 038/112] remove json package --- provision/core/php/provision.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/provision/core/php/provision.sh b/provision/core/php/provision.sh index fd01adb89..8e6ebbdb7 100644 --- a/provision/core/php/provision.sh +++ b/provision/core/php/provision.sh @@ -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" From 762c5baeeda2a60c24e58b4a6cde56c3afc243ee Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Wed, 22 Feb 2023 15:56:58 +0000 Subject: [PATCH 039/112] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ba807fb6..712fe0f83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ permalink: /docs/en-US/changelog/ * 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 +* Switched the default PHP to v8.0 ( #2658 ) ### Bug Fixes From 35fe4f2b33e8077b96a6b1c49acf0bbacb5cdee8 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Wed, 22 Feb 2023 18:01:20 +0000 Subject: [PATCH 040/112] fix restore default php version script --- config/homebin/vvv_restore_php_default | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/homebin/vvv_restore_php_default b/config/homebin/vvv_restore_php_default index ae88fc1e0..0acb9c19f 100755 --- a/config/homebin/vvv_restore_php_default +++ b/config/homebin/vvv_restore_php_default @@ -1,6 +1,6 @@ #!/bin/bash -DEFAULTPHP="7.4" +DEFAULTPHP="8.0" php_version=$(readlink -f /usr/bin/php) if [[ $php_version != *"${DEFAULTPHP}"* ]]; then echo " * Restoring the default PHP CLI version ( ${DEFAULTPHP} )" From 83811773ad71f64906b8560d63d5f1ef9837cb62 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Wed, 22 Feb 2023 19:44:46 +0000 Subject: [PATCH 041/112] Update default-config.yml --- config/default-config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/default-config.yml b/config/default-config.yml index 2c3bd59da..09a27a10f 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 From 2783a1ffc0478781616be597be4a7adfecfb81a7 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Fri, 24 Feb 2023 09:18:47 +0000 Subject: [PATCH 042/112] fix duplicate php74 --- config/php-config/upstream.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/php-config/upstream.conf b/config/php-config/upstream.conf index a54b43b4e..15c43c1e1 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 { +upstream php80 { server unix:/var/run/php8.0-fpm.sock; } From c8a1acd2049f66ec2f47b2d9718eb072a0c5a2d0 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Fri, 24 Feb 2023 09:50:00 +0000 Subject: [PATCH 043/112] fix setting git rebase pull config value for non-root users --- CHANGELOG.md | 1 + provision/core/git/provision.sh | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 712fe0f83..e20e543bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ permalink: /docs/en-US/changelog/ * Simplified PHPCS installation bin dir setting ( #2648 ) * Virtualbox users running `sudo vagrant` commands now get a warning * Switched the default PHP to v8.0 ( #2658 ) +* Fixed setting of git rebase config for the vagrant nonroot user ( #2658 ) ### Bug Fixes diff --git a/provision/core/git/provision.sh b/provision/core/git/provision.sh index f8576c575..fcc99e37d 100644 --- a/provision/core/git/provision.sh +++ b/provision/core/git/provision.sh @@ -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 From 22fd6039834260efba3bef8a261a42b797eada78 Mon Sep 17 00:00:00 2001 From: Matias Saggiorato Date: Tue, 9 May 2023 14:17:40 -0300 Subject: [PATCH 044/112] Fix docker version detection --- Vagrantfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Vagrantfile b/Vagrantfile index 9efd0d1ab..3d7be6652 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -304,6 +304,8 @@ if show_logo provider_version = '??' when 'hyperv' provider_version = 'n/a' + when 'docker' + provider_version = VagrantPlugins::DockerProvider::Driver.new.execute("docker", "-v").gsub("Docker version ", "") else provider_version = '??' end From 4c7e6bf60e79a6a8b50fdc886d7ab4f9505fd101 Mon Sep 17 00:00:00 2001 From: Matias Saggiorato Date: Tue, 9 May 2023 14:19:25 -0300 Subject: [PATCH 045/112] Find open ports on the host to do port mapping outside of the defaults --- Vagrantfile | 54 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 3d7be6652..c5cb5e971 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" @@ -438,17 +439,42 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| override.vm.box = 'bento/ubuntu-20.04' end + def port_is_open?(*ports) + _port = 0 + ports.each do |port| + _port = port + begin + Socket.tcp('127.0.0.1', port, connect_timeout: 5) {} + rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT + return port + end + end + + loop do + _port = _port + 1 + begin + Socket.tcp('127.0.0.1', _port, connect_timeout: 5) {} + rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT + return _port + end + end + end + + http_port = port_is_open?(80, 8080, 8888, 8000) + https_port = port_is_open?(443, 8443, 9999, 9000) + mysql_port = port_is_open?(3306) + mailhog_port = port_is_open?(8025) + # Docker use image. config.vm.provider :docker do |d| d.image = 'pentatonicfunk/vagrant-ubuntu-base-images:20.04' d.has_ssh = true if Vagrant::Util::Platform.platform == 'darwin19' # Docker in mac need explicit ports publish to access - d.ports = [ "#{vvv_config['vm_config']['private_network_ip']}:80:80" ] - d.ports += [ "#{vvv_config['vm_config']['private_network_ip']}:443:443" ] - d.ports += [ "#{vvv_config['vm_config']['private_network_ip']}:3306:3306" ] - d.ports += [ "#{vvv_config['vm_config']['private_network_ip']}:8025:8025" ] - d.ports += [ "#{vvv_config['vm_config']['private_network_ip']}:1025:1025" ] + d.ports = [ "#{http_port}:80" ] + d.ports += [ "#{https_port}:443" ] + d.ports += [ "#{mysql_port}:3306" ] + d.ports += [ "#{mailhog_port}:8025" ] end end @@ -925,24 +951,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| end end - # specific trigger for mac and docker - if Vagrant::Util::Platform.platform == 'darwin19' && vvv_config['vm_config']['provider'] == 'docker' - config.trigger.before :up do |trigger| - trigger.name = "VVV Setup docker local network before up" - trigger.run = {inline: "bash -c 'sudo ifconfig lo0 alias #{vvv_config['vm_config']['private_network_ip']}/24'"} - end - config.trigger.after :halt do |trigger| - trigger.name = 'VVV delete docker local network after halt' - trigger.run = {inline: "bash -c 'sudo ifconfig lo0 inet delete #{vvv_config['vm_config']['private_network_ip']}'"} - trigger.on_error = :continue - end - config.trigger.after :destroy do |trigger| - trigger.name = 'VVV delete docker local network after destroy' - trigger.run = {inline: "bash -c 'sudo ifconfig lo0 inet delete #{vvv_config['vm_config']['private_network_ip']}'"} - trigger.on_error = :continue - end - end - config.trigger.after :up do |trigger| trigger.name = 'VVV Post-Up' trigger.run_remote = { inline: '/srv/config/homebin/vagrant_up' } From 206e661eae3bc6e5f6f8b1ff7b40849ba1b9362e Mon Sep 17 00:00:00 2001 From: Matias Saggiorato Date: Tue, 9 May 2023 14:19:39 -0300 Subject: [PATCH 046/112] Default to docker on ARM64 --- Vagrantfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index c5cb5e971..46453106d 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -217,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. From 69a65af458dff90a4c34f43d384dc4885b9c02dd Mon Sep 17 00:00:00 2001 From: Matias Saggiorato Date: Tue, 9 May 2023 14:20:01 -0300 Subject: [PATCH 047/112] Set up safe.directory for issues with docker WIP --- provision/core/git/provision.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/provision/core/git/provision.sh b/provision/core/git/provision.sh index fcc99e37d..6fef4bc30 100644 --- a/provision/core/git/provision.sh +++ b/provision/core/git/provision.sh @@ -58,5 +58,7 @@ 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 } vvv_add_hook after_packages git_after_packages From 60c553202c707322cb3a89b0b33cd68682634342 Mon Sep 17 00:00:00 2001 From: Matias Saggiorato Date: Thu, 11 May 2023 11:03:14 -0300 Subject: [PATCH 048/112] Map the hosts to be pointed early --- Vagrantfile | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 46453106d..408e0efa0 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -230,6 +230,26 @@ vvv_config['hosts'] = vvv_config['hosts'].uniq vvv_config['vagrant-plugins'] = {} unless vvv_config['vagrant-plugins'] +# Early mapping of the hosts to be added. +vvv_config['utilities'].each do |name, extensions| + extensions = {} unless extensions.is_a? Array + extensions.each do |extension| + if extension == 'tideways' + vvv_config['hosts'] += ['tideways.vvv.test'] + vvv_config['hosts'] += ['xhgui.vvv.test'] + end + end +end +vvv_config['extensions'].each do |name, extensions| + extensions = {} unless extensions.is_a? Array + extensions.each do |extension| + if extension == 'tideways' + vvv_config['hosts'] += ['tideways.vvv.test'] + vvv_config['hosts'] += ['xhgui.vvv.test'] + end + end +end + # Create a global variable to use in functions and classes $vvv_config = vvv_config @@ -833,10 +853,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| vvv_config['utilities'].each do |name, extensions| extensions = {} unless extensions.is_a? Array extensions.each do |extension| - if extension == 'tideways' - vvv_config['hosts'] += ['tideways.vvv.test'] - vvv_config['hosts'] += ['xhgui.vvv.test'] - end config.vm.provision "extension-#{name}-#{extension}", type: 'shell', keep_color: true, @@ -851,10 +867,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| vvv_config['extensions'].each do |name, extensions| extensions = {} unless extensions.is_a? Array extensions.each do |extension| - if extension == 'tideways' - vvv_config['hosts'] += ['tideways.vvv.test'] - vvv_config['hosts'] += ['xhgui.vvv.test'] - end config.vm.provision "extension-#{name}-#{extension}", type: 'shell', keep_color: true, From 459e5e2b6b55e74b62cc707d1eccb0c187b55f2e Mon Sep 17 00:00:00 2001 From: Matias Saggiorato Date: Thu, 11 May 2023 11:04:16 -0300 Subject: [PATCH 049/112] Remove unnecessary check --- Vagrantfile | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 408e0efa0..9d78ed1af 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -489,13 +489,11 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.provider :docker do |d| d.image = 'pentatonicfunk/vagrant-ubuntu-base-images:20.04' d.has_ssh = true - if Vagrant::Util::Platform.platform == 'darwin19' - # Docker in mac need explicit ports publish to access - d.ports = [ "#{http_port}:80" ] - d.ports += [ "#{https_port}:443" ] - d.ports += [ "#{mysql_port}:3306" ] - d.ports += [ "#{mailhog_port}:8025" ] - end + d.ports = [ "#{http_port}:80" ] + d.ports += [ "#{https_port}:443" ] + d.ports += [ "#{mysql_port}:3306" ] + d.ports += [ "#{mailhog_port}:8025" ] + end # Virtualbox. From c67bb0cf6cc8d127ff37ed0ea886f98d831d5d32 Mon Sep 17 00:00:00 2001 From: Matias Saggiorato Date: Thu, 11 May 2023 11:04:38 -0300 Subject: [PATCH 050/112] Make goodhosts work with docker --- Vagrantfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 9d78ed1af..9b85e8d8d 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -486,7 +486,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| mailhog_port = port_is_open?(8025) # Docker use image. - config.vm.provider :docker do |d| + config.vm.provider :docker do |d, override| d.image = 'pentatonicfunk/vagrant-ubuntu-base-images:20.04' d.has_ssh = true d.ports = [ "#{http_port}:80" ] @@ -494,6 +494,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| d.ports += [ "#{mysql_port}:3306" ] d.ports += [ "#{mailhog_port}:8025" ] + ## Fix goodhosts aliases format for docker + override.goodhosts.aliases = { '127.0.0.1' => vvv_config['hosts'], '::1' => vvv_config['hosts'] } end # Virtualbox. From 1f0c981559d36334586acd8f5b4710d023a704d6 Mon Sep 17 00:00:00 2001 From: Matias Saggiorato Date: Thu, 11 May 2023 11:05:32 -0300 Subject: [PATCH 051/112] Fix issue with docker not provisioning as expected --- Vagrantfile | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/Vagrantfile b/Vagrantfile index 9b85e8d8d..d279bc104 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -459,10 +459,44 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| override.vm.box = 'bento/ubuntu-20.04' end + ## Docker provider will refuse to provision these ports, even if the containers using them are turned off + ## Fix provided in some future version of Vagrant. https://github.com/hashicorp/vagrant/issues/13110 + ## TODO: Review this later + def get_docker_used_ports + docker_provisioner = VagrantPlugins::DockerProvider::Driver.new + used_ports = Hash.new{|hash,key| hash[key] = Set.new} + containers = docker_provisioner.execute('docker', 'ps', '-a', '-q', '--no-trunc').to_s.split + containers.each do |cid| + container_info = JSON.parse(docker_provisioner.execute('docker', 'inspect', cid)).first + + if container_info["HostConfig"]["PortBindings"] + port_bindings = container_info["HostConfig"]["PortBindings"] + next if port_bindings.empty? # Nothing defined, but not nil either + + port_bindings.each do |guest_port,host_mapping| + host_mapping.each do |h| + if h["HostIp"] == "" + hostip = "*" + else + hostip = h["HostIp"] + end + hostport = h["HostPort"] + used_ports[hostport].add(hostip) + end + end + end + end + + used_ports + end + + def port_is_open?(*ports) + used_ports = get_docker_used_ports() _port = 0 ports.each do |port| _port = port + next if used_ports.has_key?(_port) begin Socket.tcp('127.0.0.1', port, connect_timeout: 5) {} rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT @@ -472,6 +506,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| loop do _port = _port + 1 + next if used_ports.has_key?(_port) begin Socket.tcp('127.0.0.1', _port, connect_timeout: 5) {} rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT From c00531440e0fa68ea8d56d375fe9767dbf9a0ee7 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Mon, 26 Jun 2023 13:59:19 +0100 Subject: [PATCH 052/112] remove docker port testing code --- Vagrantfile | 71 ++++------------------------------------------------- 1 file changed, 5 insertions(+), 66 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index d279bc104..2a2844e6b 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -459,75 +459,14 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| override.vm.box = 'bento/ubuntu-20.04' end - ## Docker provider will refuse to provision these ports, even if the containers using them are turned off - ## Fix provided in some future version of Vagrant. https://github.com/hashicorp/vagrant/issues/13110 - ## TODO: Review this later - def get_docker_used_ports - docker_provisioner = VagrantPlugins::DockerProvider::Driver.new - used_ports = Hash.new{|hash,key| hash[key] = Set.new} - containers = docker_provisioner.execute('docker', 'ps', '-a', '-q', '--no-trunc').to_s.split - containers.each do |cid| - container_info = JSON.parse(docker_provisioner.execute('docker', 'inspect', cid)).first - - if container_info["HostConfig"]["PortBindings"] - port_bindings = container_info["HostConfig"]["PortBindings"] - next if port_bindings.empty? # Nothing defined, but not nil either - - port_bindings.each do |guest_port,host_mapping| - host_mapping.each do |h| - if h["HostIp"] == "" - hostip = "*" - else - hostip = h["HostIp"] - end - hostport = h["HostPort"] - used_ports[hostport].add(hostip) - end - end - end - end - - used_ports - end - - - def port_is_open?(*ports) - used_ports = get_docker_used_ports() - _port = 0 - ports.each do |port| - _port = port - next if used_ports.has_key?(_port) - begin - Socket.tcp('127.0.0.1', port, connect_timeout: 5) {} - rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT - return port - end - end - - loop do - _port = _port + 1 - next if used_ports.has_key?(_port) - begin - Socket.tcp('127.0.0.1', _port, connect_timeout: 5) {} - rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT - return _port - end - end - end - - http_port = port_is_open?(80, 8080, 8888, 8000) - https_port = port_is_open?(443, 8443, 9999, 9000) - mysql_port = port_is_open?(3306) - mailhog_port = port_is_open?(8025) - # 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 = [ "#{http_port}:80" ] - d.ports += [ "#{https_port}:443" ] - d.ports += [ "#{mysql_port}:3306" ] - d.ports += [ "#{mailhog_port}:8025" ] + 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'] } @@ -956,7 +895,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' From bd53f8f62b0592c69224092e683bc260073bf531 Mon Sep 17 00:00:00 2001 From: Matias Saggiorato Date: Wed, 28 Jun 2023 14:20:37 -0300 Subject: [PATCH 053/112] Implement vvv_safe_sed --- provision/provision-helpers.sh | 11 +++++++++++ provision/provision-site.sh | 23 ++++++++++++----------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/provision/provision-helpers.sh b/provision/provision-helpers.sh index 3e5fad11b..3bba7e5df 100755 --- a/provision/provision-helpers.sh +++ b/provision/provision-helpers.sh @@ -663,3 +663,14 @@ function vvv_update_guest_hosts() { } export -f vvv_update_guest_hosts + +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 diff --git a/provision/provision-site.sh b/provision/provision-site.sh index 0fde26da2..036bafa2d 100644 --- a/provision/provision-site.sh +++ b/provision/provision-site.sh @@ -153,10 +153,6 @@ function vvv_provision_site_nginx_config() { # 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}" # if php: is configured, set the upstream to match SITE_PHP=$(vvv_get_site_php_version) @@ -171,19 +167,24 @@ function vvv_provision_site_nginx_config() { NGINX_UPSTREAM='php' fi - sed -i "s#{upstream}#${NGINX_UPSTREAM}#" "${TMPFILE}" + cp -f "${SITE_NGINX_FILE}" "${TMPFILE}" + vvv_safe_sed "s#{vvv_path_to_folder}#${DIR}#" "${TMPFILE}" + vvv_safe_sed "s#{vvv_path_to_site}#${VM_DIR}#" "${TMPFILE}" + vvv_safe_sed "s#{vvv_site_name}#${SITE_NAME}#" "${TMPFILE}" + vvv_safe_sed "s#{vvv_hosts}#${VVV_HOSTS}#" "${TMPFILE}" + vvv_safe_sed "s#{upstream}#${NGINX_UPSTREAM}#" "${TMPFILE}" 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}" + vvv_safe_sed "s#{vvv_tls_cert}#ssl_certificate \"/srv/certificates/${SITE_NAME}/dev.crt\";#" "${TMPFILE}" + vvv_safe_sed "s#{vvv_tls_key}#ssl_certificate_key \"/srv/certificates/${SITE_NAME}/dev.key\";#" "${TMPFILE}" 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}" + vvv_safe_sed "s#{vvv_tls_cert}#\# TLS cert not included as the certificate file is not present#" "${TMPFILE}" + vvv_safe_sed "s#{vvv_tls_key}#\# TLS key not included as the certificate file is not present#" "${TMPFILE}" fi # Resolve relative paths since not supported in Nginx root. - while grep -sqE '/[^/][^/]*/\.\.' "${TMPFILE}"; do - sed -i 's#/[^/][^/]*/\.\.##g' "${TMPFILE}" + while grep -sqE '/[^/][^/]*/\.\.' "${TMPFILE}"; do + vvv_safe_sed 's#/[^/][^/]*/\.\.##g' "${TMPFILE}" done # "/etc/nginx/custom-sites/${DEST_NGINX_FILE}" From 6d14048cc4ee3764d48b9d342bc632c2a08335e4 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Wed, 28 Jun 2023 18:37:25 +0100 Subject: [PATCH 054/112] shellcheck improvements --- provision/provision-site.sh | 66 ++++++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 23 deletions(-) diff --git a/provision/provision-site.sh b/provision/provision-site.sh index 0fde26da2..59e1c294c 100644 --- a/provision/provision-site.sh +++ b/provision/provision-site.sh @@ -36,7 +36,8 @@ VVV_CONFIG=/vagrant/config.yml # @arg $1 string the config value to fetch # @arg $2 string the default value function vvv_get_site_config_value() { - local value=$(shyaml -q get-value "sites.${SITE_ESCAPED}.${1}" "${2}" < ${VVV_CONFIG}) + local value + value=$(shyaml -q get-value "sites.${SITE_ESCAPED}.${1}" "${2}" < ${VVV_CONFIG}) echo "${value}" } @@ -47,7 +48,7 @@ function vvv_get_site_php_version() { SITE_PHP=$(echo -n "${SITE_PHP}" | xargs | tr -d '\n' | tr -d '\r') # Handle when php:8 instead of 8.0 or if it's parsed as a number - if [[ "${#SITE_PHP}" -eq "1" ]]; then + if [[ ${#SITE_PHP} -eq 1 ]]; then SITE_PHP="${SITE_PHP}.0" fi @@ -55,9 +56,10 @@ function vvv_get_site_php_version() { } vvv_validate_site_php_version() { + local SITE_PHP SITE_PHP=$(vvv_get_site_php_version) - if [[ "${#SITE_PHP}" > "3" ]]; then - vvv_warn " ! Warning: PHP version defined is using a wrong format: '${SITE_PHP}' with length '${length}'" + if [[ ${#SITE_PHP} -gt 3 ]]; then + 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" fi @@ -102,7 +104,8 @@ function get_config_value() { # @see get_hosts_list # @stdout a space separated string of domains, defaulting to `sitename.test` if none are specified function get_hosts() { - local value=$(shyaml -q get-values-0 "sites.${SITE_ESCAPED}.hosts" < ${VVV_CONFIG} | tr '\0' ' ' | sed 's/ *$//') + local value + value=$(shyaml -q get-values-0 "sites.${SITE_ESCAPED}.hosts" < ${VVV_CONFIG} | tr '\0' ' ' | sed 's/ *$//') echo "${value:-"${VVV_SITE_NAME}.test"}" } @@ -112,7 +115,8 @@ function get_hosts() { # @see get_hosts # @stdout a space separated string of domains, defaulting to `sitename.test` if none are specified function get_hosts_list() { - 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}) echo "${value:-"${VVV_SITE_NAME}.test"}" } @@ -123,7 +127,8 @@ function get_hosts_list() { # @see get_hosts_list # @stdout the first host listed in the config file for this site, defaulting to `sitename.test` if none are specified function get_primary_host() { - local value=$(shyaml -q get-value "sites.${SITE_ESCAPED}.hosts.0" "${1}" < ${VVV_CONFIG}) + local value + value=$(shyaml -q get-value "sites.${SITE_ESCAPED}.hosts.0" "${1}" < ${VVV_CONFIG}) echo "${value:-"${VVV_SITE_NAME}.test"}" } @@ -144,7 +149,8 @@ function vvv_provision_site_nginx_config() { DEST_NGINX_FILE="vvv-auto-${DEST_NGINX_FILE}-$(md5sum <<< "${SITE_NGINX_FILE}" | cut -c1-32).conf" VVV_HOSTS=$(get_hosts) - local TMPFILE=$(mktemp /tmp/vvv-site-XXXXX) + local TMPFILE + TMPFILE=$(mktemp /tmp/vvv-site-XXXXX) cat "${SITE_NGINX_FILE}" >> "${TMPFILE}" vvv_info " * VVV is adding an Nginx config from ${SITE_NGINX_FILE}" @@ -218,7 +224,7 @@ function vvv_provision_hosts_file() { echo " - Added ${line} from ${HOSTFILE}" fi fi - done < "$HOSTFILE" + done < "${HOSTFILE}" done } @@ -229,7 +235,8 @@ function vvv_provision_hosts_file() { # @noargs function vvv_process_site_hosts() { echo " * Adding domains to the virtual machine's /etc/hosts file..." - local hosts=$(get_hosts_list) + local hosts + hosts=$(get_hosts_list) if [ ${#hosts[@]} -eq 0 ]; then echo " * No hosts were found in the VVV config, falling back to vvv-hosts" if [[ -f "${VM_DIR}/.vvv/vvv-hosts" ]]; then @@ -243,7 +250,8 @@ function vvv_process_site_hosts() { vvv_provision_hosts_file "${SITE}" "${VM_DIR}/vvv-hosts" else echo " * Searching subfolders 4 levels down for a vvv-hosts file ( this can be skipped by using ./vvv-hosts, .vvv/vvv-hosts, or provision/vvv-hosts" - local HOST_FILES=$(find "${VM_DIR}" -maxdepth 4 -name 'vvv-hosts'); + local HOST_FILES + HOST_FILES=$(find "${VM_DIR}" -maxdepth 4 -name 'vvv-hosts'); if [[ -z $HOST_FILES ]] ; then vvv_error " ! Warning: No vvv-hosts file was found, and no hosts were defined in the vvv config, this site may be inaccessible" else @@ -255,7 +263,7 @@ function vvv_process_site_hosts() { else echo " * Adding hosts for the site to the VM hosts file" for line in $hosts; do - if [[ -z "$(grep -q "^127.0.0.1 $line$" /etc/hosts)" ]]; 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 ${VVV_CONFIG}" fi @@ -276,6 +284,7 @@ function vvv_provision_site_repo() { echo " * Any local changes not present on the server will be discarded in favor of the remote branch" cd "${VM_DIR}" echo " * Checking that remote origin is ${REPO}" + local CURRENTORIGIN CURRENTORIGIN=$(noroot git remote get-url origin) if [[ "${CURRENTORIGIN}" != "${REPO}" ]]; then vvv_error " ! The site config said to use ${REPO}" @@ -357,12 +366,14 @@ function vvv_provision_site_script() { SUCCESS=$? else vvv_warn " * Warning: A site provisioner was not found at .vvv/vvv-init.sh provision/vvv-init.sh or vvv-init.sh, searching 3 folders down, please be patient..." - local SITE_INIT_SCRIPTS=$(find "${VM_DIR}" -maxdepth 3 -name 'vvv-init.sh'); + local SITE_INIT_SCRIPTS + SITE_INIT_SCRIPTS=$(find "${VM_DIR}" -maxdepth 3 -name 'vvv-init.sh'); if [[ -z $SITE_INIT_SCRIPTS ]] ; then vvv_warn " * Warning: No site provisioner was found, VVV could not perform any scripted setup that might install software for this site" else for SITE_INIT_SCRIPT in $SITE_INIT_SCRIPTS; do - local DIR="$(dirname "$SITE_INIT_SCRIPT")" + local DIR + DIR="$(dirname "${SITE_INIT_SCRIPT}")" vvv_run_site_template_script "vvv-init.sh" "${DIR}" done fi @@ -387,7 +398,8 @@ function vvv_provision_site_nginx() { vvv_warn " - ${VM_DIR}/provision/vvv-nginx.conf" vvv_warn " - ${VM_DIR}/vvv-nginx.conf" vvv_warn " * VVV will search 3 folders down to find an Nginx config, please be patient..." - local NGINX_CONFIGS=$(find "${VM_DIR}" -maxdepth 3 -name 'vvv-nginx.conf'); + local NGINX_CONFIGS + NGINX_CONFIGS=$(find "${VM_DIR}" -maxdepth 3 -name 'vvv-nginx.conf'); if [[ -z $NGINX_CONFIGS ]] ; then vvv_warn " * VVV did not found an Nginx config file, it will use a fallback config file." noroot mkdir -p "${VM_DIR}/log" @@ -424,7 +436,8 @@ function vvv_custom_folder_composer() { if keys=$(shyaml keys -y -q "sites.${SITE_ESCAPED}.folders.${folder}.composer" < "${VVV_CONFIG}"); then for key in $keys; do cd "${folder}" - local value=$(vvv_get_site_config_value "folders.${folder}.composer.${key}" "") + local value + value=$(vvv_get_site_config_value "folders.${folder}.composer.${key}" "") if [[ "install" == "${key}" ]]; then if [[ "True" == "${value}" ]]; then vvv_info " * Running composer install in ${folder}" @@ -455,7 +468,8 @@ function vvv_custom_folder_npm() { if keys=$(shyaml keys -y -q "sites.${SITE_ESCAPED}.folders.${folder}.npm" < "${VVV_CONFIG}"); then for key in $keys; do cd "${folder}" - local value=$(vvv_get_site_config_value "folders.${folder}.npm.${key}" "") + local value + value=$(vvv_get_site_config_value "folders.${folder}.npm.${key}" "") if [[ "install" == "${key}" ]]; then if [[ "True" == "${value}" ]]; then vvv_info " * Running npm install in ${folder}" @@ -483,11 +497,17 @@ function vvv_custom_folder_npm() { # @internal # @see vvv_clone_site_git_folder function vvv_custom_folder_git() { - local folder="${1}" - local repo=$(vvv_get_site_config_value "folders.${folder}.git.repo" "?") - local overwrite_on_clone=$(vvv_get_site_config_value "folders.${folder}.git.overwrite_on_clone" "False") - local hard_reset=$(vvv_get_site_config_value "folders.${folder}.git.hard_reset" "False") - local pull=$(vvv_get_site_config_value "folders.${folder}.git.pull" "False") + local folder + local repo + local overwrite_on_clone + local hard_reset + local pull + + folder="${1}" + repo=$(vvv_get_site_config_value "folders.${folder}.git.repo" "?") + overwrite_on_clone=$(vvv_get_site_config_value "folders.${folder}.git.overwrite_on_clone" "False") + hard_reset=$(vvv_get_site_config_value "folders.${folder}.git.hard_reset" "False") + pull=$(vvv_get_site_config_value "folders.${folder}.git.pull" "False") if [ ! -d "${VVV_PATH_TO_SITE}/${folder}" ]; then vvv_clone_site_git_folder "${repo}" "${folder}" @@ -496,7 +516,7 @@ function vvv_custom_folder_git() { if [ ! -d "${VVV_PATH_TO_SITE}/${folder}/.git" ]; then vvv_info " - VVV was asked to clone into a folder that already exists (${folder}), but does not contain a git repo" vvv_info " - overwrite_on_clone is turned on so VVV will purge with extreme predjudice and clone over the folders grave" - rm -rf "${VVV_PATH_TO_SITE}/${folder}" + rm -rf "${VVV_PATH_TO_SITE:?}/${folder}" vvv_clone_site_git_folder "${repo}" "${folder}" fi else From 906b15eb93486535867bc6ccb822ac6713fed7b9 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Wed, 28 Jun 2023 18:38:53 +0100 Subject: [PATCH 055/112] added new search replace token functions --- provision/provision-site.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/provision/provision-site.sh b/provision/provision-site.sh index 59e1c294c..d0e1161de 100644 --- a/provision/provision-site.sh +++ b/provision/provision-site.sh @@ -132,6 +132,31 @@ function get_primary_host() { echo "${value:-"${VVV_SITE_NAME}.test"}" } +# @description Takes a string and replaces all instances of a token with a value +vvv_site_template_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}" +} + +# @description Takes a file, and replaces all instances of a token with a value +vvv_site_template_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_site_template_search_replace "${content}" "${2}" "${3}" + else + return 1 + fi +} + # @description processes and installs an Nginx config for a site. # The function performs variable substitutions, and installs the resulting config. # This includes inserting SSL key references, host names, and paths. From abea1f59de627e5276178d730ce1e61c74f6b10a Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Wed, 28 Jun 2023 18:40:16 +0100 Subject: [PATCH 056/112] improvements and docker related fixes for Nginx config handling --- provision/provision-site.sh | 52 +++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/provision/provision-site.sh b/provision/provision-site.sh index d0e1161de..f9605e5a0 100644 --- a/provision/provision-site.sh +++ b/provision/provision-site.sh @@ -183,11 +183,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_site_template_search_replace_in_file "${SITE_NGINX_FILE}" "{vvv_path_to_folder}" "${DIR}") + NCONFIG=$(vvv_site_template_search_replace "${NCONFIG}" "{vvv_path_to_site}" "${VM_DIR}/") + NCONFIG=$(vvv_site_template_search_replace "${NCONFIG}" "{vvv_site_name}" "${SITE_NAME}") + NCONFIG=$(vvv_site_template_search_replace "${NCONFIG}" "{vvv_hosts}" "${VVV_HOSTS}") # if php: is configured, set the upstream to match SITE_PHP=$(vvv_get_site_php_version) @@ -202,30 +205,35 @@ function vvv_provision_site_nginx_config() { NGINX_UPSTREAM='php' fi - sed -i "s#{upstream}#${NGINX_UPSTREAM}#" "${TMPFILE}" + NCONFIG=$(vvv_site_template_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_site_template_search_replace "${NCONFIG}" "{vvv_tls_cert}" "ssl_certificate \"/srv/certificates/${SITE_NAME}/dev.crt\";") + NCONFIG=$(vvv_site_template_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_site_template_search_replace "${NCONFIG}" "{vvv_tls_cert}" "# TLS cert not included as the certificate file is not present") + NCONFIG=$(vvv_site_template_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" @@ -241,9 +249,9 @@ 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 " - Added ${line} from ${HOSTFILE}" From cd3d1e3eafc44b89baff15efbf8a6ec6a847121c Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Thu, 29 Jun 2023 11:50:52 +0100 Subject: [PATCH 057/112] added vvv_search_replace and vvv_search_replace_in_file functions --- provision/provision-helpers.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/provision/provision-helpers.sh b/provision/provision-helpers.sh index 3bba7e5df..e9a68e88e 100755 --- a/provision/provision-helpers.sh +++ b/provision/provision-helpers.sh @@ -674,3 +674,30 @@ function vvv_safe_sed() { 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 From e6341885d33eda0e0dfb6c6a6e56fceea5915205 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Thu, 29 Jun 2023 11:51:11 +0100 Subject: [PATCH 058/112] description for vvv_safe_sed --- provision/provision-helpers.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/provision/provision-helpers.sh b/provision/provision-helpers.sh index e9a68e88e..fe93bf88a 100755 --- a/provision/provision-helpers.sh +++ b/provision/provision-helpers.sh @@ -661,9 +661,10 @@ function vvv_update_guest_hosts() { sudo rm /tmp/site-hosts fi } - 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}" From 798b6b6cec9665df4f2bab5804e2b616e319dbc3 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Thu, 29 Jun 2023 11:53:03 +0100 Subject: [PATCH 059/112] shellcheck improvements for provision helpers --- provision/provision-helpers.sh | 67 +++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 26 deletions(-) diff --git a/provision/provision-helpers.sh b/provision/provision-helpers.sh index fe93bf88a..dc9c881d8 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,15 +640,16 @@ 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 @@ -644,11 +657,13 @@ 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) 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 done From 9f5f064ab0de801be477c03c61a2f809827d8713 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Thu, 29 Jun 2023 11:53:43 +0100 Subject: [PATCH 060/112] removed old site template search replace functions --- provision/provision-site.sh | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/provision/provision-site.sh b/provision/provision-site.sh index f9605e5a0..5f163898f 100644 --- a/provision/provision-site.sh +++ b/provision/provision-site.sh @@ -132,31 +132,6 @@ function get_primary_host() { echo "${value:-"${VVV_SITE_NAME}.test"}" } -# @description Takes a string and replaces all instances of a token with a value -vvv_site_template_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}" -} - -# @description Takes a file, and replaces all instances of a token with a value -vvv_site_template_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_site_template_search_replace "${content}" "${2}" "${3}" - else - return 1 - fi -} - # @description processes and installs an Nginx config for a site. # The function performs variable substitutions, and installs the resulting config. # This includes inserting SSL key references, host names, and paths. From b8f3745ca0f9bcfcd017346f4663d6a0ea6cc55b Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Thu, 29 Jun 2023 11:54:04 +0100 Subject: [PATCH 061/112] use the renamed functions --- provision/provision-site.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/provision/provision-site.sh b/provision/provision-site.sh index 5f163898f..0ce2624ca 100644 --- a/provision/provision-site.sh +++ b/provision/provision-site.sh @@ -162,10 +162,10 @@ function vvv_provision_site_nginx_config() { DIR="$(dirname "${SITE_NGINX_FILE}")" local NCONFIG - NCONFIG=$(vvv_site_template_search_replace_in_file "${SITE_NGINX_FILE}" "{vvv_path_to_folder}" "${DIR}") - NCONFIG=$(vvv_site_template_search_replace "${NCONFIG}" "{vvv_path_to_site}" "${VM_DIR}/") - NCONFIG=$(vvv_site_template_search_replace "${NCONFIG}" "{vvv_site_name}" "${SITE_NAME}") - NCONFIG=$(vvv_site_template_search_replace "${NCONFIG}" "{vvv_hosts}" "${VVV_HOSTS}") + 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) @@ -180,15 +180,15 @@ function vvv_provision_site_nginx_config() { NGINX_UPSTREAM='php' fi - NCONFIG=$(vvv_site_template_search_replace "${NCONFIG}" "{upstream}" "${NGINX_UPSTREAM}") + NCONFIG=$(vvv_search_replace "${NCONFIG}" "{upstream}" "${NGINX_UPSTREAM}") if [ -f "/srv/certificates/${SITE_NAME}/dev.crt" ]; then - NCONFIG=$(vvv_site_template_search_replace "${NCONFIG}" "{vvv_tls_cert}" "ssl_certificate \"/srv/certificates/${SITE_NAME}/dev.crt\";") - NCONFIG=$(vvv_site_template_search_replace "${NCONFIG}" "{vvv_tls_key}" "ssl_certificate_key \"/srv/certificates/${SITE_NAME}/dev.key\";") + 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 - NCONFIG=$(vvv_site_template_search_replace "${NCONFIG}" "{vvv_tls_cert}" "# TLS cert not included as the certificate file is not present") - NCONFIG=$(vvv_site_template_search_replace "${NCONFIG}" "{vvv_tls_key}" "# TLS key not included as the certificate file is not present") + 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 From f4696ea7810e1ae8c1377a5ccfb5e30cda3c5d1b Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Thu, 29 Jun 2023 15:47:14 +0100 Subject: [PATCH 062/112] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c3dca00c..eae5df1a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ permalink: /docs/en-US/changelog/ ## 3.11.3 ( 2023 WIP ) +### Enhancements + +* Monolithic docker beta support ( #2632 ) + ### Bug Fixes * Fixed a vagrantfile error on Arm when the vagrant-parallels plugin is missing ( #2670 ) From 4e599f021a9888e0cc8b2a93381bb4111f177d11 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Thu, 3 Aug 2023 21:01:13 +0100 Subject: [PATCH 063/112] start 3.13 cycle --- CHANGELOG.md | 4 ++++ version | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b681f67e..7a3bb8fc3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ permalink: /docs/en-US/changelog/ # Changelog +## 3.13 ( 2023 ) + +WIP + ## 3.12 ( 2023 August 3rd ) ### Enhancements diff --git a/version b/version index e4fba2183..24ee5b1be 100644 --- a/version +++ b/version @@ -1 +1 @@ -3.12 +3.13 From ba1e4ba976f0bfe0e9c00ac55bc600d9db8b06e7 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Sun, 1 Oct 2023 16:53:03 +0100 Subject: [PATCH 064/112] bump VIPCS and WPCS to v3 --- provision/core/phpcs/composer.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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": { From 7a9b73fbcd3c67db73ceb734a74688853d0c5e33 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Sun, 1 Oct 2023 16:58:45 +0100 Subject: [PATCH 065/112] added a readme for PHPCS as well as an ignore file for installed files --- provision/core/phpcs/.gitignore | 3 +++ provision/core/phpcs/readme.md | 8 ++++++++ 2 files changed, 11 insertions(+) create mode 100644 provision/core/phpcs/.gitignore create mode 100644 provision/core/phpcs/readme.md 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/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. + From 21ef1c385ff79b95c2576adda9d760dc1f8bbbbb Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Sun, 1 Oct 2023 16:58:55 +0100 Subject: [PATCH 066/112] updated the changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45585bcf1..e738822bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,8 @@ permalink: /docs/en-US/changelog/ ### Enhancements * Switched the default PHP to v8.0 ( #2658 ) -* Experimental docker support ( #2632 ) +* WP Coding standards v3 ( #2688 ) +* VIP Coding standards v3 ( #2688 ) ## 3.12 ( 2023 August 3rd ) From 3ccfa72058a74a16787c4f04e0e0755e94ec4a72 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Sun, 15 Oct 2023 11:56:52 +0100 Subject: [PATCH 067/112] Better PHP warnings and IP6 VM hostfiles When VVV detects the requested PHP version is missing, remind the user they need to install it themselves via config.yml and link out to the PHP changing doc Also add `::1` too when updating the VMs hosts file --- provision/provision-site.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/provision/provision-site.sh b/provision/provision-site.sh index f1ec83e98..064e6f075 100644 --- a/provision/provision-site.sh +++ b/provision/provision-site.sh @@ -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 } @@ -228,7 +232,8 @@ function vvv_provision_hosts_file() { 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 @@ -273,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 From faebd2979ea14bda3ff94c24c455554ed110822a Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Sun, 15 Oct 2023 11:59:28 +0100 Subject: [PATCH 068/112] Update CHANGELOG.md --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e738822bc..c45b47a5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,11 @@ permalink: /docs/en-US/changelog/ * Switched the default PHP to v8.0 ( #2658 ) * 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 ) + +### 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 ) ## 3.12 ( 2023 August 3rd ) From fe310087202f202c7ebcf1034d010b638fe02230 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Mon, 16 Oct 2023 12:16:45 +0100 Subject: [PATCH 069/112] opt out of dotnet telemetry --- provision/core/env/homedir/.bash_profile | 3 +++ 1 file changed, 3 insertions(+) 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) From 7af06181360533354324f3b777660526cff2dcf1 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Mon, 16 Oct 2023 12:17:37 +0100 Subject: [PATCH 070/112] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c45b47a5a..cfec2791d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ permalink: /docs/en-US/changelog/ * 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 ) ### Bug Fixes From 22ce286cd6f2bc5a2d995481718acadc6ee859cb Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Tue, 28 Nov 2023 10:36:40 +0000 Subject: [PATCH 071/112] switch to php 8.2 as the default Switch to 8.2 as the default PHP, 8.0 is no longer supported, 8.1 is security fixes only, and 8.3 is brand new, so 8.2 it is! If people need 8.0 or other versions they can use the core extensions --- provision/core/php/provision.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/provision/core/php/provision.sh b/provision/core/php/provision.sh index ffb2a7cdc..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:-"8.0"} +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" From e1671d599708dd6fcf3ba8e9e59b375dda591f8d Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Tue, 28 Nov 2023 10:37:36 +0000 Subject: [PATCH 072/112] Update php-fpm.conf --- config/php-config/php-fpm.conf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/php-config/php-fpm.conf b/config/php-config/php-fpm.conf index db615a4d2..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/php8.0-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/php8.0-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/php8.0-fpm.log ; To configure the pools it is recommended to have one .conf file per ; pool in the following directory: -include=/etc/php/8.0/fpm/pool.d/*.conf +include=/etc/php/8.2/fpm/pool.d/*.conf From 2e6a2a9938de00f41a183eeabb5bb6367e1a92af Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Tue, 28 Nov 2023 10:38:02 +0000 Subject: [PATCH 073/112] Update upstream.conf --- config/php-config/upstream.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/php-config/upstream.conf b/config/php-config/upstream.conf index 15c43c1e1..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 php80 { - server unix:/var/run/php8.0-fpm.sock; +upstream php82 { + server unix:/var/run/php8.2-fpm.sock; } From f472154d86ca45728101c28c45e884e4d26edf44 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Tue, 28 Nov 2023 10:38:30 +0000 Subject: [PATCH 074/112] Update php-www.conf --- config/php-config/php-www.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/php-config/php-www.conf b/config/php-config/php-www.conf index fcbb4f56d..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/php8.0-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) From e008cda2a256d6dad1777559c56dca9ffa34d674 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Tue, 28 Nov 2023 10:39:21 +0000 Subject: [PATCH 075/112] Update default-config.yml --- config/default-config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/default-config.yml b/config/default-config.yml index ff42e399f..824132dac 100644 --- a/config/default-config.yml +++ b/config/default-config.yml @@ -90,7 +90,7 @@ extensions: #- php74 #- php80 #- php81 - #- php82 + #- 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. From 36228648a9633164f814fac79c45ac2b8c6d6ae0 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Tue, 28 Nov 2023 10:40:29 +0000 Subject: [PATCH 076/112] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cfec2791d..bde119965 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ permalink: /docs/en-US/changelog/ ### Enhancements -* Switched the default PHP to v8.0 ( #2658 ) +* Switched the default PHP to v8.2 ( #2690 ) * 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 ) From 6b53d26cfbcdc661089fdc2a24bf996700b7bdaf Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Tue, 28 Nov 2023 10:40:56 +0000 Subject: [PATCH 077/112] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bde119965..3e1ea9e0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ permalink: /docs/en-US/changelog/ # Changelog -## 3.13 ( 2023 ) +## 3.13 ( 2023 December TBA ) ### Enhancements From 9f9a1b3150859fe5a792b3c1c8981fdaa468a1f0 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Tue, 28 Nov 2023 10:56:23 +0000 Subject: [PATCH 078/112] Update provision-site.sh for php 8.2 --- provision/provision-site.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/provision/provision-site.sh b/provision/provision-site.sh index 064e6f075..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="8.0" +DEFAULTPHP="8.2" VVV_CONFIG=/vagrant/config.yml From 0f2000add94804b7a54d9f94396c852ce3e164d9 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Tue, 28 Nov 2023 15:08:06 +0000 Subject: [PATCH 079/112] Update vvv_restore_php_default --- config/homebin/vvv_restore_php_default | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/homebin/vvv_restore_php_default b/config/homebin/vvv_restore_php_default index 0acb9c19f..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="8.0" +DEFAULTPHP="8.2" php_version=$(readlink -f /usr/bin/php) if [[ $php_version != *"${DEFAULTPHP}"* ]]; then echo " * Restoring the default PHP CLI version ( ${DEFAULTPHP} )" From 93047930f206cb4aac0f3e8d1c1773af4d6b7a05 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Tue, 28 Nov 2023 15:27:40 +0000 Subject: [PATCH 080/112] upgrade workflow action versions --- .github/workflows/vvv-provisioning.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/vvv-provisioning.yml b/.github/workflows/vvv-provisioning.yml index 530bddd71..6f0c74469 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,7 +104,7 @@ 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 @@ -119,12 +119,12 @@ 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 with: ref: stable - name: Cache Vagrant boxes - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.vagrant.d/boxes key: ${{ runner.os }}-vagrant-${{ hashFiles('Vagrantfile') }} @@ -137,7 +137,7 @@ jobs: - name: vagrant up (stable) run: vagrant up - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: clean: false @@ -147,7 +147,7 @@ jobs: - name: tests run: provision/tests/macos-tests.sh - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 if: ${{ always() }} with: name: logs-on-stable @@ -161,12 +161,12 @@ 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 with: ref: develop - name: Cache Vagrant boxes - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.vagrant.d/boxes key: ${{ runner.os }}-vagrant-${{ hashFiles('Vagrantfile') }} @@ -180,7 +180,7 @@ jobs: - name: vagrant up (develop) run: vagrant up - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: clean: false @@ -190,7 +190,7 @@ jobs: - name: tests run: provision/tests/macos-tests.sh - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 if: ${{ always() }} with: name: logs-on-develop @@ -204,10 +204,10 @@ 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 - name: Cache Vagrant boxes - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.vagrant.d/boxes key: ${{ runner.os }}-vagrant-${{ hashFiles('Vagrantfile') }} @@ -223,7 +223,7 @@ jobs: - name: tests run: provision/tests/macos-tests.sh - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 if: ${{ always() }} with: name: logs-on-clean From 61ac5c84e154feab31fc70e4f9de285b3f14cb76 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Tue, 28 Nov 2023 15:32:26 +0000 Subject: [PATCH 081/112] install node 16 not 14 by default --- provision/core/node-nvm/provision.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/provision/core/node-nvm/provision.sh b/provision/core/node-nvm/provision.sh index 715192d4e..302a600f5 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 16 via nvm" + nvm install 16 + nvm use 16 vvv_info " - Ensuring vagrant user owns its own nvm folder" chown -R vagrant:vagrant /home/vagrant/.nvm/ From 58d8a673fc2b84a5e91632d8d30a10473383ad32 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Tue, 28 Nov 2023 15:39:02 +0000 Subject: [PATCH 082/112] Update default-config.yml --- config/default-config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/default-config.yml b/config/default-config.yml index 824132dac..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: 8.0 # 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 From e4948b4ab869b2a48ebebb8012f8b5f3d8e589cd Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Tue, 28 Nov 2023 15:39:42 +0000 Subject: [PATCH 083/112] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e1ea9e0d..9de53e3fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ permalink: /docs/en-US/changelog/ ### Enhancements -* Switched the default PHP to v8.2 ( #2690 ) +* Switched the default PHP from v7.4 to v8.2 and default Node from v14 to v16 ( #2690 ) * 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 ) From 9af28297375277416cec78ee1f048efea196d07f Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Tue, 28 Nov 2023 15:42:43 +0000 Subject: [PATCH 084/112] Update vvv-start.conf --- config/init/vvv-start.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From 5dde91b269418442d47357ce2e0097641da692a1 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Tue, 28 Nov 2023 15:43:50 +0000 Subject: [PATCH 085/112] Update nginx.conf --- provision/core/nginx/config/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/provision/core/nginx/config/nginx.conf b/provision/core/nginx/config/nginx.conf index bdb329c06..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/php8.0-fpm.sock; + server unix:/var/run/php8.2-fpm.sock; } include /etc/nginx/upstreams/*.conf; From fba477fd4a9861ee6713bec0b1f9e80037694b0f Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Tue, 28 Nov 2023 15:47:49 +0000 Subject: [PATCH 086/112] Update site-fallback.conf --- provision/core/nginx/config/site-fallback.conf | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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} From 32b12a64c90e71cdbbea6f97b6ab5b6375d267f7 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Tue, 28 Nov 2023 15:54:45 +0000 Subject: [PATCH 087/112] Update bug-report.yml --- .github/ISSUE_TEMPLATE/bug-report.yml | 1 + 1 file changed, 1 insertion(+) 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' From 784435ec08348c31d8464e575d6750ed16460855 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Tue, 28 Nov 2023 15:57:02 +0000 Subject: [PATCH 088/112] Delete .github/ISSUE_TEMPLATE/monteray-virtualbox-timeouts.yml --- .../monteray-virtualbox-timeouts.yml | 35 ------------------- 1 file changed, 35 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/monteray-virtualbox-timeouts.yml 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 From eab33069bf9d89ba729538e9254ad393a65198ee Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Sat, 2 Dec 2023 21:58:03 +0000 Subject: [PATCH 089/112] replace squiz repo reference with the new standard repo --- provision/core/phpcs/provision.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/provision/core/phpcs/provision.sh b/provision/core/phpcs/provision.sh index f4bc8dcd5..1b6ba6b11 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" From 0d05abc7b9483a527558ef50dd024cd4677fcdde Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Sat, 2 Dec 2023 22:01:22 +0000 Subject: [PATCH 090/112] Add a note to encourage sponsorship of PHPCS standards org when provisioning PHPCS --- provision/core/phpcs/provision.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/provision/core/phpcs/provision.sh b/provision/core/phpcs/provision.sh index 1b6ba6b11..f772bc30c 100644 --- a/provision/core/phpcs/provision.sh +++ b/provision/core/phpcs/provision.sh @@ -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 From 80c89f7827289b1db255ceb98e9727aee3496153 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Mon, 4 Dec 2023 11:18:13 +0000 Subject: [PATCH 091/112] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cfec2791d..c9d8ae946 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ permalink: /docs/en-US/changelog/ * 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 ) ### Bug Fixes From f90082001bd9522ceccbf9a3cb36e84a0c505f5d Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Tue, 2 Jan 2024 09:39:03 +0000 Subject: [PATCH 092/112] use the bento box for parallels arm64 --- Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index d408b8908..ea506a906 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -447,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 From 89f48bcd047d59460b86b861804d010d2195bbab Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Tue, 2 Jan 2024 09:41:20 +0000 Subject: [PATCH 093/112] Update CHANGELOG.md --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 524d238ba..d258a7b60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ permalink: /docs/en-US/changelog/ # Changelog -## 3.13 ( 2023 December TBA ) +## 3.13 ( 2024 TBA ) ### Enhancements @@ -17,6 +17,10 @@ permalink: /docs/en-US/changelog/ * Opted out of Dotnet package telemetry ( #2689 ) * Replace references to the Squizlab PHPCS with that from the PHPCS Standards org ( #2692 ) +### Maintenance + +* Switch the Parallels Arm64 box from `mpasternak/focal64-arm` to `bento/ubuntu-22.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 ) From 32bc3e7c92460fc3a0e012b258f23a29abd02b84 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Tue, 2 Jan 2024 09:43:48 +0000 Subject: [PATCH 094/112] switch to Node 20 to match WP core defaults --- provision/core/node-nvm/provision.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/provision/core/node-nvm/provision.sh b/provision/core/node-nvm/provision.sh index 302a600f5..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 16 via nvm" - nvm install 16 - nvm use 16 + 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/ From 19bd1029d2b2e1ab1cee74afee1ff680140284fb Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Tue, 2 Jan 2024 09:45:33 +0000 Subject: [PATCH 095/112] Update CHANGELOG.md --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 524d238ba..b8af23fcd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,8 @@ permalink: /docs/en-US/changelog/ ### Enhancements -* Switched the default PHP from v7.4 to v8.2 and default Node from v14 to v16 ( #2690 ) +* 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 ) From f438ef39e40947f0c9054f7409020ded449e787c Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Wed, 10 Jan 2024 15:33:38 +0000 Subject: [PATCH 096/112] remove macos testers on CI the old versions no longer have runners and we need to upgrade but newer versions are missing necessary software, we can re-add them later once they're fixed and useful again --- .github/workflows/vvv-provisioning.yml | 119 ------------------------- 1 file changed, 119 deletions(-) diff --git a/.github/workflows/vvv-provisioning.yml b/.github/workflows/vvv-provisioning.yml index 6f0c74469..0ea2a8782 100644 --- a/.github/workflows/vvv-provisioning.yml +++ b/.github/workflows/vvv-provisioning.yml @@ -109,122 +109,3 @@ jobs: 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@v4 - with: - ref: stable - - - name: Cache Vagrant boxes - uses: actions/cache@v3 - 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@v4 - with: - clean: false - - - name: vagrant up (current branch) - run: vagrant up --provision - - - name: tests - run: provision/tests/macos-tests.sh - - - uses: actions/upload-artifact@v3 - 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@v4 - with: - ref: develop - - - name: Cache Vagrant boxes - uses: actions/cache@v3 - 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@v4 - with: - clean: false - - - name: vagrant up (current branch) - run: vagrant up --provision - - - name: tests - run: provision/tests/macos-tests.sh - - - uses: actions/upload-artifact@v3 - 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@v4 - - - name: Cache Vagrant boxes - uses: actions/cache@v3 - 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@v3 - if: ${{ always() }} - with: - name: logs-on-clean - path: "${{ github.workspace }}/log" From 2812d7c64c0fc74fd0feb841f3b043d66d47a7f0 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Wed, 10 Jan 2024 15:35:05 +0000 Subject: [PATCH 097/112] Update CHANGELOG.md --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8af23fcd..b950caea2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ permalink: /docs/en-US/changelog/ # Changelog -## 3.13 ( 2023 December TBA ) +## 3.13 ( 2024 TBA ) ### Enhancements @@ -21,6 +21,7 @@ permalink: /docs/en-US/changelog/ ### 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 ) +* Removed old MacOS PR workflows, no runners available ( #2698 ) ## 3.12 ( 2023 August 3rd ) From 8e2b0bc9e9e5e34886dec747580735a31c20aea5 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Wed, 14 Feb 2024 11:48:34 +0000 Subject: [PATCH 098/112] improve the output and some checks on the debug switching script --- config/homebin/switch_php_debugmod | 54 ++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 14 deletions(-) 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." From 3c97a594415cff308916fefb10dc23641ee8db13 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Wed, 14 Feb 2024 12:03:38 +0000 Subject: [PATCH 099/112] include the PHP and xdebug version numbers in the info pages --- www/default/phpinfo/index.php | 4 ++-- www/default/xdebuginfo/index.php | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) 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 @@ ?> From 34ef09c2459c689796b5dd87382af96e7002d2cf Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Wed, 14 Feb 2024 12:04:18 +0000 Subject: [PATCH 100/112] update changelogs --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b950caea2..bde1b7fde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ permalink: /docs/en-US/changelog/ * 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 ) ### Bug Fixes From 1b8adb069d7165e7446c3c8a3a22b97eba986338 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Thu, 13 Jun 2024 16:16:19 +0100 Subject: [PATCH 101/112] Do not add hosts entries for files on vvv_update_guest_hosts if the domain is already present --- provision/provision-helpers.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/provision/provision-helpers.sh b/provision/provision-helpers.sh index dc9c881d8..9822ca767 100755 --- a/provision/provision-helpers.sh +++ b/provision/provision-helpers.sh @@ -665,7 +665,10 @@ function vvv_update_guest_hosts() { 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 + if [[ -z "$(grep -q "^127.0.0.1 ${v:-"${VVV_SITE_NAME}.test"}$" /etc/hosts)" ]]; then + echo "127.0.0.1 ${v:-"${VVV_SITE_NAME}.test"} # vvv-auto" >> "/etc/hosts" + echo "::1 ${v:-"${VVV_SITE_NAME}.test"} # vvv-auto" >> "/etc/hosts" + fi done done From d9d016ac1c21f6f967e0e9c3e6615ab6d04d4a4b Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Fri, 14 Jun 2024 21:01:25 +0100 Subject: [PATCH 102/112] 2709: Fix an expired Nginx signing key --- .../nginx/apt-keys/nginx-archive-keyring.gpg | Bin 0 -> 8537 bytes .../core/nginx/apt-keys/nginx_signing.key | 28 ------------------ provision/core/nginx/provision.sh | 11 +++++-- 3 files changed, 8 insertions(+), 31 deletions(-) create mode 100644 provision/core/nginx/apt-keys/nginx-archive-keyring.gpg delete mode 100644 provision/core/nginx/apt-keys/nginx_signing.key 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 0000000000000000000000000000000000000000..8f9e9bf8e2a0c5a4195d71cef359f6109e8cb532 GIT binary patch literal 8537 zcma)=Ra9MDvu+peuyA*G5AH6(3GPmCcXubaB)EHUcM0wi+${uHI0V*7&OQ6y+=u_P z{Wz=5HXeHW#;9JE1&IP}sl|i?0R%MkdM}bMF=H{vEIN=wlYY@;#2Ij2QWQ`#0ilqX z`MJY^2$@?9hVM~Gvh=pc4lnrG`#5(mc9l*fj?ZB(1s+khuQ94^YH9@2sU6|msA($* z`Y?21{kt1)0-=<}h(MGhx={g3L4UGi6w^geM)zIv zLey4}AdQ|-&dB-|^pH;P(5t$ah2jp*ZK}g0jy=lu9_h|Uh3$SYd2LHzkHqw$alSN` zFBe4iOVg6)64XB;^rKrY8-1V5qU{-RWVDBAfR9g7%pPKksN2*3@YrM9SDwCoRyo8k zgqgk0%KyFzBOq{;bKu!^S}ZAhZ2v?UWdQwpsFsX4O7N{#eD5f*eV0|F`F}&2J(r6ngTAi>ctTdBY?C1ADG8zw-5ip7k z`^e3q9sPqwz)HZqAuT8u*HEdM$*!hdBtC`IH3*qG%5$H<+S(oR9k-o!9vsWSz$ZHsyVkh9rc7#D@R?s+7^*c%n39Utb5LrWU@y zmha%sPFZRn$XqlYic*P@Z>MnQ6XR?`dMzxqiloo)oul1=w+{F+b)%Vl6q}5{TY!&z zLw3rG!bLuE&ukuv^b@mS{Zy5|o|Z(*WhVgXI2m9g&~Di>HsoK-MlItm(}k8RMlZR5 z^*w!AIJ|3iVkl zd09;COXj5zF5aZ`bkeCx=8PetQ3F+TLp=GA67SQEDc%to(20c9*fBjS&Ke)5Yht6` z6^tY0*bm^TbQ0BNuF?U<3~opAK^K4Oh2omZIo&`Je2tXaNurfd5p|i{Js>$})ZJh?n8g39&T78I&DO*8TDUzlwrL zOc{&pfG24dYE7|gL~oKoa*G%#K{iWPdS{mH7RvotMB6mIW^-W?IVNjKHNFpPvK0Vs2XrXYh{FE;Hc`zRB zLRy}gj&$8{Ozyi2UycbP{%Q2B+x|L(WqJ2R)azAX6Q(OQrz%p_Q$anwu(^qkT6u@g z(}K4G`jM0AqDsJWio-sq1TXt)*i&5X zs}b3?5Uo@}a)-1=gDgylkeH8XfycM{H#IGR*N;MpUFJaV(yFSv?hxO#UeiC+gc$!& z`=_EQ2=@z_p$B2b?u#Y7<%BytBWgIF?}gRibGn1!XldZ-=oc|yc)NmZ4drK|`@v6Z z5Gw48CMLRBPr;AY0XE1>ElJwNyNMwE3MW}q9OmkB~C@!AvSGp(8P{lQDC^7w`-Z?~XCvAXgi%DC#4X>mhb?O$E zY11~Egv4E6`WiG$q>2q>FY(e#xK%HwIj<=bce9od1%bRI$1?&XG=jlnAlhKHW&fV- zsn@)1x5iuvc#YsiN5mX>D*twjGYER9T+(}Qo))S^h26;jPQqicXu0at5A_^sXO6E- zj^l~ZkpC}h%U*W-P-_*C^qCuWW76+6vLEyj|4@^+|3mGcNLgw{iqRhP~UV^k1+FROP5$R)+Dl;O@F#r1}g>#K$#Wa4Zu$cj_+c z=xf$qrsP0#SKGI_M>(EAV?X?zLUdlkZT`pGN>T0;5V&;lYHO zh5x-t1O7@;`|^UZ)Q`M!kf!+-9WDXWG@ypLNkH`5r+j@4X6@{{m<@IPr}_Sp zz!%1+GKQd%x7f~g=S$>{jwI`{fvS8`=V(rEm8i@}BpFy;B^J31xUcQ|vzbN#9M-$v z;(z>7#=o=U)q_9o(mtI5atLaLslaxN4DX+JRv7iuf2w7u{jei#L05HFExPnfUD?2r zZ>Wp$L#pKLd5rbOU;WoH-x>6YA73dZ9&XOLeQG1}#QWy92{RtdrD_J8j4A$%py&s( z*=Q!lM|iIYF@VqHR;ibjQj(M#d8uQSYg=?mkcLi--R6kJKnjDP?fRAi*M+yMREX_K z@rH((e6~w>A45JlVcp&mgg@BA-~`yFBJ7QixC0|58o*So?#vGF!7g8Y&58;$!8#l7 z+amy2K|(NiCx<0%>N&eq$xgLMJ=Neee>$2-cF;NHlz2h-?%Hz8l?T8=gYeZd2CR zH>WsK<o^0<|wZ+!6@88 zo}}o;4C;Hq#^JV?HJEQ?lVN6*O*bT6scgBdv#*q!9x5o>T;m# z3ctpx_Cy-aaHuG_CLa6 z)=^&VIpdbMVv3_XvXIW>(p5%5eClfA0`=C;-xGOHbq~7@7=`i*zD8z2pg=1rahU#Y zEpJ%&hy-mB_-|8Hka^myJWkkd%dk1Ynn_vdlTP|udMAosk!AGC3p0h#8}9w{rMIal zM`o$itU7F}vgK_pnbvm^u2H_$@5+!ON>`(V+z7@)PQy#!ubD>-DZyd%=}C0>Tn7F`_>x}Y)=!6N+v5VW{pMJG+MGW!d~A}tbmNF?EjCs z(f{w}_P4h|2>9^eEas1sWq7g6%njBGx@RY(#AOv z`Ql*Oftah(+cEw4yW72(=}fM8L)QtPWn>Y^D1c56>$49|K~OO}N|I8#3f2b9D5P{g z@-If$D~&rwvYwn}J&Jd+gTZ5Hb2~fJzmUe=W1yeVr3H+$Oi#RvyRl$3ork}17^CPX zJ0QGvL_=u)1_%!j`Hk*BLi_DI|DkiMd~Jq7ATA|X_?zqc4%{nN#?dpr;bKsR%(do> zG-|__`g4v?l3^?!g{h}FQL1njth{UQCB-NF`E4k8nY~7ojm!e_8Aq-SU9JXE$-j67 z24uc;Wg(QP6n@`tl`L-@+o~%2d2Ro>1itL_XdNmvjW@cqF`CofF$ANk*O5JUOL+1dwQ3CWL3Scp?l>q*d&i(1M^p747d^~Q zbiPBuji@X+Z`wK`fVKo*^XdEAkI*33Lyp9{6~}xqRJZ_ifu=352qcpgirFMEHe%e^ zm+yrlS_P~BLJJrTDa&Svu~P^ru)h>M@LPZ@DB+01by59Wdj6v-O8tTMk17gD!@Y@c zMY1B`J+NHs)vndpDT?J|K9hidsmEcJ?&$%LWi#^}xC*mLk7;^h$&=0JRj?PjR{O;4 z=Q+RQJQ<8!!sn{Zy=QjUu zVT6IyGHrf@LBJy+75h7Nx&&}wErJf}Pmwe~jV>Crzrz4(yj^MszO@+wYaviGp#a>h zn&e()5wE2!LpkUA%DCGfjh%VV86xNmtcZsT%+j1wTFaMivXes&IlBfMhRKmv`R-OS zYIwez3LD_h{A5fa75)yA#yyTp?@TmAyYZYs>7_V3f{4WESA`yS@Q;pcTG=Rzp+eH3 z)}@k_qP5wD+$aLpkgR`5+9oRSg~GT2YHtwnOK zM>`kZ=c?HSRd6|jrVPjj@CRaF>T)$q97~5uXB4pSC(+!z8OD!%ZKcxBZsWz;sYM=N z$6s{Xyfa2HMhZ_i+3n3Yvr^m^(j4%+ldN3;`reWC<(h0iFai%IFJ~Nupad&WL3{VG0 z2#oiqpm@ox+71`DWEirZA;)>k&)dhZ`18XCLJaJU^eW;1GKw0uLCN6B5T)dhR@dXB zLSc?mTCTp}A%ohFxoxOu$x4D$ZpMVJ^jt)#Bt&^z0mFq1WiZZjefA&Z(yg zSDUJ@wzvPlTi*|{6Pa=T*!oi56!97K7A&Sl_ z=V+H$uS`Q4i9n1s%uP-%W2953GeE6%M91!OA0-V9ME@T;dh>ti{J1(rV!|a0 zRqX-fm)Q)ggAY5LpG<4Sp+{g1RI3UJY%&uP&8|I{A(4>b15}#dK(?K3?LUl%)|g#A$pOiS#!AgG5EO+ zF=6OmNxu7^^Z${2Arl~=Zpm|ZAO}K7-PQTmBt^#R5H!sCw_XjkE3|%XhHzuYnBjHE z{+4ZX+t9Usv$%CP z-A8ZhH~7#s&ZrH1UJS~Yj-Rs~poPyy5nXR5n@RQi-(DMnn^UfHwYTC)yFtU~Fg9Gn zOs1>pZ;~^x<84>AEikrhVAIW;!lEF|uNXQ@6Klv!WL}rhwMS;I>!$54Z{e5M{xG@JclNa|cF>!HdDcXpcSu6IlSsp+grK{$ zSkV+-7IqAN&gwo3nQ7?D1e;%82N|^Xq>>d}V1-@Qjp+LReeWvk&?|{l6k03}jrUYm zfwi^-OwNxw$_bE0f1-TZQq#5#Ms8pkcc8@Q_S_FFYN|}-)&yv@R{cMNv{vyOh=QJ? zhDg2OmyxCWiE2x=EWd7?m~kC6_s}gCg1fB2h3@bv-@+M5>6ZdEg)Ew02F`L}N!6J5 zQNxG8%XRgJg(WPYWo5FDQ?3i@Nawvfs>qo}du~SVIM|-mO&Jk+d48l{@*YAfB$ip_KE_}e83lXJ? z?1laGPJI+Q&!l5;AM+5I9{WVR*LyMI(xj&wOB0@Q!P4~7PMTw*4C^x-Q3n<=&WVH+ zMba@>&0Si6i-s;Va;Gs;c7aB0RwaT-ci+-lk{yQ9kTbXn;v|pM9!Ui`Y|KDVe5(5= z{M<|fS72+%Y@`7V_r1*Aq%+0d@VtlC%o5IUoTF({@kfbC#^ebmy$>>R^9vop0ce!XIHcq+71L|-T{LGCmiGhdmr>SzB`6V^TVWVB;wjdM z!m{UiHqHvhTDmclk5Fojkm^r+NU?e!>}Q|AwRdr=Iue7O3HPgS z<|Y}n#j7I%zcS&U#?j_Rgo%9aiv)$nR+KDl4pyJ{FHeKp$Mlq) zl%v$_djnf!^-`N!St!nTPY?Ei$?=AGclL`Nu5+d{vNQ1*>jO%kuOOuT>#-&f`j%hr zg)w-x#GLaL*vLB#6m{^y(WYsp=$kAwEALC0w6EmX6dsKGmJKQmF&X3)X$aMIm$=%M zhok*vyALJ0mfUUdN_{o;BRoVovm|!r;fsH*COY_{0QLKEmYemLl`%kydYR*HI~++R z4RUnMDyvuH-d7}?@Co7gApQG8qy6)Injm7!Q?ZDzH;)zJ%a6rBSVgo@L555X%iQBh zMbxN=dVEM;(nTCENpc*FueQYFEC${rc$?41BAym|J({yRbUAj2lV~Y+#K=Gw^)*qI zxmBlz?Ne6LJ~BwJnCO$1Oty+FmCbya`x9kKXh~uCXf1Yp<3YEgVtVdHO6`tSAhtvV2pw{>M;7@V9V8SYb|JZqQqfH9C|sa+#Rtz}2x zT+U~XcHStff=R#|O8~M~<~gPLWJcNGRJ+i*r(qsP@81uDLi>YewUYR(0a|RjL|61j zD1liy09KQkI&<_*<4RiMl<1my&5bf0{jBpduMQYH`AH#3Z1S#)q7(xev$jW(T8jY{ zl`YC&XHP>jfNN_CEUT;B;Pw7UYs{Br`J5-+kzcm{WdUn!VXwiPfsHnYyXXH)MkY$wy zlcJC=?Z8bzjdYJ&H1{$L&luYW>m6i@AookFv??0VcG|LV!#LJ*<7D9xwRzr$mr^(u z9&keTqnXW>Cedx`pfaU+()@y|aG!bfcJ zzqv1kI7(b^VjT%(qP89Z@RELrB$S01DvaQju+0n38^ zD9B#$DeeP#%T^pd1bhSKeV=*pRo3<`!$~Wb>ftZfFnXu6!;3_0n5DX0IYHU31Cl1a znXBHUy3#6a)|Aun%>~9efg=wIx_06osP-TC_m9xpRv^~KR$gt3Jy#-P1}3dnVd2_k zdV~?}h+CT*pbs4Hn)z-+{>{uGaQde&{4;Zmgu?xThxyh|L5_DAE)V0=ld~pBr~Vbm z&iajUE`@9VM;TOYm&KCUh~nfi^+NA;AMwjdus?)pv2_2igzSrgo`RE+NwLZ|6 z7g=jriiwRgK2*7Zqf!RdK9`4khs-flG#NP>uz;M4CZDT@dQmcEaZOoXHH#|%7e9$a zOnhRJLK4~)0=Ea6NI{wL*m&@c?FME7qFOeuN!iSH^KrlDELWwuR5zi(BF(+J2n*)V zR2)I=(1Yv-@ek-Jn1$_@Aig^iS|Iu8sDlXe-_-uYkgFwl^M~3$>uEs{Jm8CYxZu5K zeKz&+=yc5YLdZ|#J62Gx$6W0~y zra-Ydt1*5Hb`mTnkTV}RPpJ11Ts>;ll^bR?uR;*HTwkop?KZ*aTT zP2twIMcslixI&fVTNCJzPalMCdXttA#;}!@*E%y?G)Rurv2H@IYv`z6mY->;<>eBA z^^UCY*x+?6yTPmy5W%OAo9ZS?jU-fJAwX=&9LwKM*j1#d!_PUnXBpF<{I3K z2DW7}S>?6)k#(%$fTWPUBgenPUs&;74+nlfBklP<$U449?ADr^fB%!lO0T1GY{NxT)0HR>E0&ljFzQiZNvD2h5g9?QY|=r}xy`NFvk z!dNguT=yp&py$<4OLWHdY#GdlwCY#KY6F$&wi{Y3(GK`s(C%11T;HA0D_UFiu0eIr zy}5<_^s5#xF`TC7?Jp&S%p@1L>Ar8yQ$wMHO>-_Dv9Nh1I`situnPgV8(iSzGleLIl!tY_;IR4WX>kD^ja1)Nv$M=-XLfOukMZ&-~U9*BPwGG z`%w92aZErNd}w`Xp-E@-Si>0j7K&t0g=CE~BLMcJpvdK|jG91ue~s+Fo-FsT%=Q0U zPlqKSfhFLYud=@T#wZ%~r(pQz6EAjXH8op@C#I%8G!!{&-?6~f<0q`X@N=MVr3_^G zkb;wvlf;gbjBbuGr*H-*{gpyx=J^PlijA8(u|Jz$*eSNAd&{4s3TI>tA8LT zw`0=CrhmUNsk;MI$W&yTc<=b?W%1N+v$30SAMNEon3g6#*B@RcpJz9^U$>D=%f(G0 zo6*1mySJBrClVt)c)q`s9K7pG+h1#7yT_oB#C@u5AD)(g!%k0P< zhq*`eLu{DnHIzeOAy^?S;S}=GA&jG@G`M3oM|zmJq0bm6?^f*A>+SW{#~O+_dz!5O zhz@}C*(cV?stN;zaxH^|)T3E>^m1#gAi}Yj5J1EoN+O(a8FiJCrG=ZyR?A8jhen`u zY}pR;&>ld(aP5L;j-Z!#rE~myH!|6AJ^GDMNq)dCeCNuU?tCz<9Bn}QJf&ciRx eXU@LBMjcBtAfygRQk4Ls8mW8lNXqXK<@;Y18pl8Y literal 0 HcmV?d00001 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/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 From 0ed18e9a54f3a4e6f650ffd212e6379bc2e1dcac Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Fri, 14 Jun 2024 21:03:49 +0100 Subject: [PATCH 103/112] 2709: Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34b2633b8..b9bd8bebd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ permalink: /docs/en-US/changelog/ * The host file inside the VM was only adding sites with `127.0.0.1` addresses, now it adds the IPVv6 `::1` too ( #2689 ) * Removed old MacOS PR workflows, no runners available ( #2698 ) +* Replace an outdated Nginx signing key ( #2710 ) ## 3.12 ( 2023 August 3rd ) From 335610cb136104857b74020c3e3f0c70a3394ad5 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Fri, 14 Jun 2024 21:21:27 +0100 Subject: [PATCH 104/112] 2709: re-add the GPG keyring and tell git that gpg files are considered binary --- .gitattributes | 1 + .../nginx/apt-keys/nginx-archive-keyring.gpg | Bin 8537 -> 8538 bytes 2 files changed, 1 insertion(+) 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/provision/core/nginx/apt-keys/nginx-archive-keyring.gpg b/provision/core/nginx/apt-keys/nginx-archive-keyring.gpg index 8f9e9bf8e2a0c5a4195d71cef359f6109e8cb532..632dba3abf2858e70ddc5ec36f54b3527ec6f10b 100644 GIT binary patch delta 14 VcmccVbjxW2KOZCSW_~^|VE`!%1V8`) delta 12 TcmccRbkk`AKi_5nJ}+SaBC`ZD From efefb254d7b4d7f708b0875fb51891b1cb49f91a Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Sat, 15 Jun 2024 14:58:26 +0100 Subject: [PATCH 105/112] 2702: Fix cleanup_vvv host to not duplicate the hosts file when called, and copy the hosts file into place, also fixed not cleaning up the temporary hosts file --- provision/core/vvv/provision.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/provision/core/vvv/provision.sh b/provision/core/vvv/provision.sh index 8e734a6a3..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 - echo "$( /dev/null + 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 From dea0bb929a46bc13fe01bd3352f30df04687c0fe Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Sat, 15 Jun 2024 14:59:45 +0100 Subject: [PATCH 106/112] 2702: Refactor vvv_update_guest_hosts to do more cleanup and help with Docker compatibility --- provision/provision-helpers.sh | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/provision/provision-helpers.sh b/provision/provision-helpers.sh index 9822ca767..5761a24ed 100755 --- a/provision/provision-helpers.sh +++ b/provision/provision-helpers.sh @@ -654,30 +654,24 @@ 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 SITES=$(vvv_get_sites) + cp -f /etc/hosts /tmp/hosts for SITE in $SITES; do SITE_ESCAPED="${SITE//./\\.}" VVV_SITE_NAME=${SITE} local value value=$(shyaml -q get-values "sites.${SITE_ESCAPED}.hosts" <${VVV_CONFIG}) for v in $value; do - if [[ -z "$(grep -q "^127.0.0.1 ${v:-"${VVV_SITE_NAME}.test"}$" /etc/hosts)" ]]; then - echo "127.0.0.1 ${v:-"${VVV_SITE_NAME}.test"} # vvv-auto" >> "/etc/hosts" - echo "::1 ${v:-"${VVV_SITE_NAME}.test"} # vvv-auto" >> "/etc/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 - - # 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 From cbfde189398ce7172ffc296b97adabff120e35c1 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Sat, 15 Jun 2024 15:14:13 +0100 Subject: [PATCH 107/112] 2709: Cleanup duplicate hosts file lines --- provision/provision-helpers.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/provision/provision-helpers.sh b/provision/provision-helpers.sh index 5761a24ed..7bf1458a9 100755 --- a/provision/provision-helpers.sh +++ b/provision/provision-helpers.sh @@ -657,6 +657,8 @@ function vvv_update_guest_hosts() { 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} @@ -670,6 +672,10 @@ function vvv_update_guest_hosts() { fi done done + + # Remove duplicate lines then replace hosts file. + awk -i inplace '!seen[$0]++' /tmp/hosts + cp -f /tmp/hosts /etc/hosts rm /tmp/hosts } From 830048fb21c2efc595041bb7c0d3b20b83a7d6ae Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Sat, 15 Jun 2024 15:15:40 +0100 Subject: [PATCH 108/112] 2709: update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9bd8bebd..d554f4774 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ permalink: /docs/en-US/changelog/ ### 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 ) From 52b05121e038c7470825720c2767666652883717 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Sun, 16 Jun 2024 11:30:26 +0100 Subject: [PATCH 109/112] Fix Clock synchronisation happening during Docker provisioning --- config/homebin/vagrant_provision | 20 +++++++++++--------- config/homebin/vagrant_up | 20 +++++++++++--------- provision/provision.sh | 20 +++++++++++--------- 3 files changed, 33 insertions(+), 27 deletions(-) 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 7331d32fb..4ec3e6b6b 100755 --- a/config/homebin/vagrant_up +++ b/config/homebin/vagrant_up @@ -46,15 +46,17 @@ sudo service memcached restart vvv_info " * Restarting Mailhog" /usr/bin/env /usr/local/bin/mailhog > /dev/null 2>&1 & -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 mkdir -p /vagrant/failed_provisioners diff --git a/provision/provision.sh b/provision/provision.sh index 693428f22..1b9738163 100755 --- a/provision/provision.sh +++ b/provision/provision.sh @@ -18,15 +18,17 @@ 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 From 4d7743c84f1909aab7b2c9224418f6121c186b22 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Sun, 16 Jun 2024 11:30:45 +0100 Subject: [PATCH 110/112] shellcheck improvement for provisioned_at file contents --- provision/provision.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/provision/provision.sh b/provision/provision.sh index 1b9738163..fdbe4baf3 100755 --- a/provision/provision.sh +++ b/provision/provision.sh @@ -32,7 +32,7 @@ if [ ! -f /.dockerenv ]; then 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 From 5b57729279b946d17c3c1631f2fbd48a07d272f6 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Sun, 16 Jun 2024 11:34:23 +0100 Subject: [PATCH 111/112] Update changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d554f4774..6f7ed4ada 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,7 @@ permalink: /docs/en-US/changelog/ ### Maintenance -* Switch the Parallels Arm64 box from `mpasternak/focal64-arm` to `bento/ubuntu-22.04-arm64` to match x86 boxes ( #2695 ) +* Switch the Parallels Arm64 box from `mpasternak/focal64-arm` to `bento/ubuntu-20.04-arm64` to match x86 boxes ( #2695 ) ### Bug Fixes @@ -30,6 +30,7 @@ permalink: /docs/en-US/changelog/ * 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 ( 2023 August 3rd ) From 62159d7a40877e76cdb6a89e000a0667b49f80e8 Mon Sep 17 00:00:00 2001 From: Tom J Nowell Date: Sun, 16 Jun 2024 11:36:41 +0100 Subject: [PATCH 112/112] v3.13.1 --- CHANGELOG.md | 4 ++-- version | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f7ed4ada..67a0d319d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ permalink: /docs/en-US/changelog/ # Changelog -## 3.13 ( 2024 TBA ) +## 3.13.1 ( 2024 June 16th ) ### Enhancements @@ -32,7 +32,7 @@ permalink: /docs/en-US/changelog/ * Replace an outdated Nginx signing key ( #2710 ) * Don't sync clocks when using the docker provider ( #2711 ) -## 3.12 ( 2023 August 3rd ) +## 3.12.1 ( 2023 August 3rd ) ### Enhancements diff --git a/version b/version index 24ee5b1be..c10780c62 100644 --- a/version +++ b/version @@ -1 +1 @@ -3.13 +3.13.1