diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md
index 448d26252..b4ccaedd6 100644
--- a/.github/ISSUE_TEMPLATE/bug-report.md
+++ b/.github/ISSUE_TEMPLATE/bug-report.md
@@ -1,8 +1,8 @@
---
name: Bug report
about: Create a report to help us improve
-title: ''
-labels: 'bug'
+title: 'Bug: '
+labels: 'type:bug'
assignees: ''
---
@@ -19,7 +19,7 @@ assignees: ''
-## Possible Solution
+## Possible Solution?
@@ -42,5 +42,5 @@ log into a gist at gist.github.com and paste the link here. -->
## Logs
-
-
+
+
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 000000000..25125da2e
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,8 @@
+blank_issues_enabled: false
+contact_links:
+ - name: VVV Troubleshooting
+ url: https://varyingvagrantvagrants.org/docs/en-US/troubleshooting/
+ about: Run through these to solve common issues
+ - name: VVV Support on Slack
+ url: https://varyingvagrantvagrants.org/docs/en-US/slack/
+ about: Join our support channel for help
diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md
index d4ffae8fc..9f60233ab 100644
--- a/.github/ISSUE_TEMPLATE/feature-request.md
+++ b/.github/ISSUE_TEMPLATE/feature-request.md
@@ -1,24 +1,18 @@
---
name: Feature request
-about: Suggest an idea for this project
+about: Suggest a feature for this project
title: ''
-labels: 'feature'
+labels: 'type:feature'
assignees: ''
---
-**Is your feature request related to a problem? Please describe.**
-
-A clear and concise description of what the problem is. e.g. _I'm always frustrated when ..._
-
-**Describe the solution you'd like**
-
-A clear and concise description of what you want to happen.
+
**Describe alternatives you've considered**
-A clear and concise description of any alternative solutions or features you've considered.
+
**Additional context**
-Add any other context or screenshots about the feature request here.
+
diff --git a/.github/ISSUE_TEMPLATE/problems-provisioning-windows.md b/.github/ISSUE_TEMPLATE/problems-provisioning-windows.md
index 8190a0d1b..ae882287d 100644
--- a/.github/ISSUE_TEMPLATE/problems-provisioning-windows.md
+++ b/.github/ISSUE_TEMPLATE/problems-provisioning-windows.md
@@ -1,8 +1,8 @@
---
name: Problems Provisioning on Windows
about: For when running vagrant up --provision or vagrant provision
-title: ''
-labels: 'Windows'
+title: 'Bug: Windows: '
+labels: 'os:windows,type:support'
assignees: ''
---
diff --git a/.github/ISSUE_TEMPLATE/problems-provisioning.md b/.github/ISSUE_TEMPLATE/problems-provisioning.md
index 355d9b474..3d546aae3 100644
--- a/.github/ISSUE_TEMPLATE/problems-provisioning.md
+++ b/.github/ISSUE_TEMPLATE/problems-provisioning.md
@@ -1,8 +1,8 @@
---
-name: Problems Provisioning
-about: For when running vagrant up --provision or vagrant provision
+name: Problems Provisioning on MacOS/Linux
+about: For when running vagrant up --provision or vagrant provision fails
title: ''
-labels: ''
+labels: 'type:bug'
assignees: ''
---
diff --git a/.github/ISSUE_TEMPLATE/support.md b/.github/ISSUE_TEMPLATE/support.md
index 056f83ac4..9826aaa74 100644
--- a/.github/ISSUE_TEMPLATE/support.md
+++ b/.github/ISSUE_TEMPLATE/support.md
@@ -1,8 +1,8 @@
---
name: Support/Question
about: Having Trouble? Unsure of how something works? Don't spend all day trying to debug it, we can help!
-title: ''
-labels: 'support, question'
+title: 'Q: '
+labels: 'type:support, type:question'
assignees: ''
---
diff --git a/.github/workflows/vvv-provisioning.yml b/.github/workflows/vvv-provisioning.yml
index 3f51c017e..6ffc58418 100644
--- a/.github/workflows/vvv-provisioning.yml
+++ b/.github/workflows/vvv-provisioning.yml
@@ -30,13 +30,18 @@ jobs:
sudo apt-get -q --autoremove --purge remove php*
sudo apt-get -q autoclean
+ # remove pre-installed composer
+ if [ -f /usr/bin/composer ]; then
+ sudo rm -f /usr/bin/composer
+ fi
+
# create vagrant user
sudo groupadd -g 2000 vagrant
sudo useradd -u 2000 -g vagrant -m vagrant
# vvv_symlink function to sumulate synced folders
function vvv_symlink() {
- if [ ! -d "${1}" ]; then
+ if [ ! -d "${1}" ]; then
sudo mkdir -p "${1}"
fi
sudo chown -R vagrant:vagrant "${1}"
@@ -87,7 +92,7 @@ jobs:
# TODO: Ideas
# - Add screenshots of provisioned sites
# - CURL mailhog API to see if it's working or not
- # - Check VM hostfile
+ # - Check VM hostfile
- name: Prepare Output
if: ${{ always() }}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d70870fae..f40286d44 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,10 +6,67 @@ permalink: /docs/en-US/changelog/
# Changelog
-## 3.6.x ( 2021 )
+## 3.7.x ( 2021 )
### Enhancements
+* Improved site provisioning messages
+* MariaDB upgraded to v10.5
+* Improved Apt source file handling in core provisioners
+* Upgraded to Composer 2
+* Upgraded to Python 3 setuptools and pip3
+* PHPCS installation improvements
+* Added ARM64 support for Mailhog
+* Improved the splash screen provider version fetching
+* Added improved apt package upgrade routines
+* Provisioners now ask to install only packages that aren't installed
+* General package handling performance improvements
+* New config to exclude databases from backup in `config.yml` ( #2346 )
+* New config to gzip compress database backups in `config.yml` ( #2346 )
+* Experimental Apple silicon support using vagrant + parallels
+* Disable backup and restore of databases by default
+* Updated Mailhog to 1.0.1 for new installs
+* Improved MailHog downloading with retries and error output
+* Improved Composer installation
+* webp support in Imagemagick
+* Switch from Ubuntu 18.04 to 20.04 (current LTS release)
+* Simplified config folder
+* Increased the default PHP memory limit from 128MB to 256MB
+
+### Bug Fixes
+
+* Fixed `vvv_error` not always printing messages
+* When a sites repo has the wrong URL for the origin remote, the user is now told. This avoids certain mistakes being made.
+* Remote changes are now fetched before resetting, not afterwards.
+* Increased the priority of Nodesource and Ondrej packages to avoid issues
+* Fixed Parallels mount permissions
+* Fixes for site names containing spaces causing Nginx and TLS issues
+* Warnings that you're missing vagrant plugins no longer show when running vagrant plugin commands
+* Force the Virtual Machine to 64bit on VirtualBox to avoid infinite loops on 32bit architectures
+* Force the installation and update of grunt and grunt-cli so that old grunt is always overwritten when updated
+* Sync clocks before provisioning if ntpdate is available to avoid Apt mirror time issues
+* Fixed cloning the dashboard git repository with unknown remote branches
+
+## 3.6.2 ( 2021 March 17th )
+
+### Bug Fixes
+
+* Replaced PHPCS symlinking to avoid issues with Windows
+
+## 3.6.1 ( 2021 March 16th )
+
+### Important Note
+
+Lots of provisioners now run in strict mode. Your custom site and utility provisioners may fail if they do not handle bad return codes from commands correctly. For example if you ran `composer create-project` on a folder that was not empty, it will fail. In v3.5 this failure was ignored and the script continued despite the critical error, in v3.6 VVV will halt provisioning so that the error can be seen.
+
+Make sure that commands are only ran at their appropriate times, e.g. only install things if they aren't installed, and if you're checking the return value of a command, do it in an if check, not as a temporary variable. If you're feeling adventurous you can unset the strict flags ( danger! ).
+
+Finally, check that your custom modifications haven't been added in the official site templates.
+
+### Enhancements
+
+* Improve the way that PHPCS gets provisioned to avoid conflicts with composer v2 (#2357)
+* PHP v7.4 is now the default PHP ( other versions are available on CLI if installed via `php73`, `php72`, etc )
* Beautify the PHP debug switcher script
* Support for basic formatting tags in `vvv_warn` `vvv_error` `vvv_info` and `vvv_success`
* A new `vvv_output` and `vvv_format_output` bash functions
@@ -18,17 +75,22 @@ permalink: /docs/en-US/changelog/
* SHDocs added to core provisioners
* A new `/srv/vvv` folder for files created inside the VM related to provisioning ( #2328 )
* Improved PHP configuration file installation
+* Sites can now define composer create-project/install/update commands to run in their folders section in addition to the git options added in v3.5.1
* Adds a `vagrant` command inside the virtual machine to tell users they are still inside the VM and need to exit
+* `switch_php_debugmod` now checks if a module is installed and enabled, with improved output to make it clearer which versions of PHP support the module
+* Print provision log if there are errors
+* Adds an Xdebug Info button to the dashboard when Xdebug is enabled
### Bug Fixes
-* Fixed the user of `vvv_warn` `vvv_success` `vvv_error` and `vvv_info` outside of provisioners
+* Fixed the use of `vvv_warn` `vvv_success` `vvv_error` and `vvv_info` outside of provisioners
* Don't try to install shyaml if it's already installed
* Global composer packages were only updated when composer itself was updated
* Skip the WordPress unit tests database when running backups
* Don't back up databases that have no tables
* Xdebug deprecated configuration option warnings fixed
* Use HTTPS instead of SSH for WP CLI Doctor subcommand installation
+* Install missing library for Xdebug support
## 3.5.1 ( 2020 December 11th )
diff --git a/README.md b/README.md
index 028d318a2..f55aa3846 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ VVV is a local developer environment, mainly aimed at [WordPress](https://wordpr
To use it, download and install [Vagrant](https://www.vagrantup.com) and [VirtualBox](https://www.virtualbox.org/). Then, clone this repository and run:
```shell
-vagrant plugin install vagrant-goodhosts --local
+vagrant plugin install --local
vagrant up --provision
```
diff --git a/Vagrantfile b/Vagrantfile
index f17a54fad..ffe67b757 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -6,81 +6,6 @@ Vagrant.require_version '>= 2.2.4'
require 'yaml'
require 'fileutils'
-def virtualbox_path
- @vboxmanage_path = nil
- if Vagrant::Util::Platform.windows? || Vagrant::Util::Platform.cygwin?
- @vboxmanage_path = Vagrant::Util::Which.which('VBoxManage')
-
- # On Windows, we use the VBOX_INSTALL_PATH environmental
- # variable to find VBoxManage.
- if !@vboxmanage_path && (ENV.key?('VBOX_INSTALL_PATH') ||
- ENV.key?('VBOX_MSI_INSTALL_PATH'))
-
- # Get the path.
- path = ENV['VBOX_INSTALL_PATH'] || ENV['VBOX_MSI_INSTALL_PATH']
-
- # There can actually be multiple paths in here, so we need to
- # split by the separator ";" and see which is a good one.
- path.split(';').each do |single|
- # Make sure it ends with a \
- single += '\\' unless single.end_with?('\\')
-
- # If the executable exists, then set it as the main path
- # and break out
- vboxmanage = "#{single}VBoxManage.exe"
- if File.file?(vboxmanage)
- @vboxmanage_path = Vagrant::Util::Platform.cygwin_windows_path(vboxmanage)
- break
- end
- end
- end
-
- # If we still don't have one, try to find it using common locations
- drive = ENV['SYSTEMDRIVE'] || 'C:'
- [
- "#{drive}/Program Files/Oracle/VirtualBox",
- "#{drive}/Program Files (x86)/Oracle/VirtualBox",
- "#{ENV['PROGRAMFILES']}/Oracle/VirtualBox"
- ].each do |maybe|
- path = File.join(maybe, 'VBoxManage.exe')
- if File.file?(path)
- @vboxmanage_path = path
- break
- end
- end
- elsif Vagrant::Util::Platform.wsl?
- unless Vagrant::Util::Platform.wsl_windows_access?
- raise Vagrant::Errors::WSLVirtualBoxWindowsAccessError
- end
-
- @vboxmanage_path = Vagrant::Util::Which.which('VBoxManage') || Vagrant::Util::Which.which('VBoxManage.exe')
- unless @vboxmanage_path
- # If we still don't have one, try to find it using common locations
- drive = '/mnt/c'
- [
- "#{drive}/Program Files/Oracle/VirtualBox",
- "#{drive}/Program Files (x86)/Oracle/VirtualBox"
- ].each do |maybe|
- path = File.join(maybe, 'VBoxManage.exe')
- if File.file?(path)
- @vboxmanage_path = path
- break
- end
- end
- end
- end
-
- # Fall back to hoping for the PATH to work out
- @vboxmanage_path ||= 'VBoxManage'
- @vboxmanage_path
-end
-
-def get_virtualbox_version
- vboxmanage = virtualbox_path
- s = Vagrant::Util::Subprocess.execute(vboxmanage, '--version')
- s.stdout.strip!
-end
-
def sudo_warnings
red = "\033[38;5;9m" # 124m"
creset = "\033[0m"
@@ -143,16 +68,19 @@ show_logo = false if ENV['VVV_SKIP_LOGO']
if show_logo
git_or_zip = 'zip-no-vcs'
branch = ''
+ commit = ''
if File.directory?("#{vagrant_dir}/.git")
git_or_zip = 'git::'
branch = `git --git-dir="#{vagrant_dir}/.git" --work-tree="#{vagrant_dir}" rev-parse --abbrev-ref HEAD`
branch = branch.chomp("\n"); # remove trailing newline so it doesn't break the ascii art
+ commit = `git --git-dir="#{vagrant_dir}/.git" --work-tree="#{vagrant_dir}" rev-parse --short HEAD`
+ commit = '(' + commit.chomp("\n") + ')'; # remove trailing newline so it doesn't break the ascii art
end
splashfirst = <<~HEREDOC
\033[1;38;5;196m#{red}__ #{green}__ #{blue}__ __
#{red}\\ V#{green}\\ V#{blue}\\ V / #{red}Varying #{green}Vagrant #{blue}Vagrants
- #{red} \\_/#{green}\\_/#{blue}\\_/ #{purple}v#{version}#{creset}-#{branch_c}#{git_or_zip}#{branch}#{creset}
+ #{red} \\_/#{green}\\_/#{blue}\\_/ #{purple}v#{version}#{creset}-#{branch_c}#{git_or_zip}#{branch}#{commit}#{creset}
HEREDOC
puts splashfirst
@@ -303,7 +231,11 @@ if show_logo
platform << 'HyperV-Enabled '
end
platform << 'HyperV-Admin ' if Vagrant::Util::Platform.windows_hyperv_admin?
- platform << 'HasWinAdminPriv ' if Vagrant::Util::Platform.windows_admin?
+ if Vagrant::Util::Platform.windows_admin?
+ platform << 'HasWinAdminPriv '
+ else
+ platform << 'missingWinAdminPriv ' unless Vagrant::Util::Platform.windows_admin?
+ end
else
platform << 'shell:' + ENV['SHELL'] if ENV['SHELL']
platform << 'systemd ' if Vagrant::Util::Platform.systemd?
@@ -317,7 +249,7 @@ if show_logo
platform << 'CaseSensitiveFS' if Vagrant::Util::Platform.fs_case_sensitive?
unless Vagrant::Util::Platform.terminal_supports_colors?
- platform << 'NoColour'
+ platform << 'monochrome-terminal'
end
if defined? vvv_config['vm_config']['wordcamp_contributor_day_box']
@@ -343,15 +275,28 @@ if show_logo
platform << 'shared_db_folder_default'
end
- virtualbox_version = 'N/A'
+ provider_version = '??'
+
+ provider_meta = nil
- if vvv_config['vm_config']['provider'] == 'virtualbox'
- virtualbox_version = get_virtualbox_version
+ case vvv_config['vm_config']['provider']
+ when 'virtualbox'
+ provider_meta = VagrantPlugins::ProviderVirtualBox::Driver::Meta.new()
+ provider_version = provider_meta.version
+ when 'parallels'
+ provider_meta = VagrantPlugins::Parallels::Driver::Meta.new()
+ provider_version = provider_meta.version
+ when 'vmware'
+ provider_version = '??'
+ when 'hyperv'
+ provider_version = 'n/a'
+ else
+ provider_version = '??'
end
splashsecond = <<~HEREDOC
#{yellow}Platform: #{yellow}#{platform.join(' ')}, #{purple}VVV Path: "#{vagrant_dir}"
- #{green}Vagrant: #{green}v#{Vagrant::VERSION}, #{blue}VirtualBox: #{blue}v#{virtualbox_version}
+ #{green}Vagrant: #{green}v#{Vagrant::VERSION}, #{blue}#{vvv_config['vm_config']['provider']}: #{blue}v#{provider_version}
#{docs}Docs: #{url}https://varyingvagrantvagrants.org/
#{docs}Contribute: #{url}https://github.com/varying-vagrant-vagrants/vvv
@@ -375,9 +320,7 @@ Vagrant.configure('2') do |config|
# Configurations from 1.0.x can be placed in Vagrant 1.1.x specs like the following.
config.vm.provider :virtualbox do |v|
- # Move the ubuntu-bionic-18.04-cloudimg-console.log file to log directory.
- v.customize ['modifyvm', :id, '--uartmode1', 'file', File.join(vagrant_dir, 'log/ubuntu-bionic-18.04-cloudimg-console.log')]
-
+ v.customize ['modifyvm', :id, '--uartmode1', 'file', File.join(vagrant_dir, 'log/ubuntu-cloudimg-console.log')]
v.customize ['modifyvm', :id, '--memory', vvv_config['vm_config']['memory']]
v.customize ['modifyvm', :id, '--cpus', vvv_config['vm_config']['cores']]
v.customize ['modifyvm', :id, '--natdnshostresolver1', 'on']
@@ -389,6 +332,10 @@ Vagrant.configure('2') do |config|
v.customize ['modifyvm', :id, '--rtcuseutc', 'on']
v.customize ['modifyvm', :id, '--audio', 'none']
v.customize ['modifyvm', :id, '--paravirtprovider', 'kvm']
+
+ # https://github.com/laravel/homestead/pull/63
+ v.customize ['modifyvm', :id, '--ostype', 'Ubuntu_64']
+
v.customize ['setextradata', :id, 'VBoxInternal2/SharedFoldersEnableSymlinksCreate//srv/www', '1']
v.customize ['setextradata', :id, 'VBoxInternal2/SharedFoldersEnableSymlinksCreate//srv/config', '1']
@@ -448,9 +395,10 @@ Vagrant.configure('2') do |config|
# Default Ubuntu Box
#
# This box is provided by Ubuntu vagrantcloud.com and is a nicely sized
- # box containing the Ubuntu 18.04 Bionic 64 bit release. Once this box is downloaded
+ # 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 = 'ubuntu/bionic64'
+ config.vm.box = 'ubuntu/focal64'
+ config.vm.box_version = '20210415.0.0'
# config.vm.box = "varying-vagrant-vagrants/ubuntu-18.04"
# If we're at a contributor day, switch the base box to the prebuilt one
@@ -462,18 +410,26 @@ Vagrant.configure('2') do |config|
# The Parallels Provider uses a different naming scheme.
config.vm.provider :parallels do |_v, override|
- override.vm.box = 'bento/ubuntu-18.04'
+ override.vm.box = 'bento/ubuntu-20.04'
+
+ # Vagrant currently runs under Rosetta on M1 devices. As a result,
+ # 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 = 'rueian/ubuntu20-m1'
+ override.vm.box_version = "0.0.1"
+ end
end
# The VMware Desktop Provider uses a different naming scheme.
config.vm.provider :vmware_desktop do |v, override|
- override.vm.box = 'bento/ubuntu-18.04'
+ override.vm.box = 'bento/ubuntu-20.04'
v.gui = false
end
# Hyper-V uses a different base box.
config.vm.provider :hyperv do |_v, override|
- override.vm.box = 'bento/ubuntu-18.04'
+ override.vm.box = 'bento/ubuntu-20.04'
end
if defined? vvv_config['vm_config']['box']
@@ -577,7 +533,7 @@ Vagrant.configure('2') do |config|
# those are specific to Virtualbox. The folder is therefore overridden with one that
# uses corresponding Parallels mount options.
config.vm.provider :parallels do |_v, override|
- override.vm.synced_folder 'database/data/', '/var/lib/mysql', create: true, owner: 9001, group: 9001, mount_options: []
+ override.vm.synced_folder 'database/data/', '/var/lib/mysql', create: true, owner: 9001, group: 9001, mount_options: [ 'share' ]
end
# Neither does the HyperV provider
config.vm.provider :hyperv do |_v, override|
@@ -629,21 +585,21 @@ Vagrant.configure('2') do |config|
# those are specific to Virtualbox. The folder is therefore overridden with one that
# uses corresponding Parallels mount options.
config.vm.provider :parallels do |_v, override|
- override.vm.synced_folder 'www/', '/srv/www', owner: 'vagrant', group: 'www-data', mount_options: []
+ override.vm.synced_folder 'www/', '/srv/www', owner: 'vagrant', group: 'www-data', mount_options: [ 'share' ]
- override.vm.synced_folder 'log/memcached', '/var/log/memcached', owner: 'root', create: true, group: 'syslog', mount_options: []
- override.vm.synced_folder 'log/nginx', '/var/log/nginx', owner: 'root', create: true, group: 'syslog', mount_options: []
- override.vm.synced_folder 'log/php', '/var/log/php', create: true, owner: 'root', group: 'syslog', mount_options: []
- override.vm.synced_folder 'log/provisioners', '/var/log/provisioners', create: true, owner: 'root', group: 'syslog', mount_options: []
+ override.vm.synced_folder 'log/memcached', '/var/log/memcached', owner: 'root', create: true, group: 'syslog', mount_options: [ 'share' ]
+ override.vm.synced_folder 'log/nginx', '/var/log/nginx', owner: 'root', create: true, group: 'syslog', mount_options: [ 'share' ]
+ override.vm.synced_folder 'log/php', '/var/log/php', create: true, owner: 'root', group: 'syslog', mount_options: [ 'share' ]
+ override.vm.synced_folder 'log/provisioners', '/var/log/provisioners', create: true, owner: 'root', group: 'syslog', mount_options: [ 'share' ]
if use_db_share == true
# Map the MySQL Data folders on to mounted folders so it isn't stored inside the VM
- override.vm.synced_folder 'database/data/', '/var/lib/mysql', create: true, owner: 112, group: 115, mount_options: []
+ override.vm.synced_folder 'database/data/', '/var/lib/mysql', create: true, owner: 112, group: 115, mount_options: [ 'share' ]
end
vvv_config['sites'].each do |site, args|
if args['local_dir'] != File.join(vagrant_dir, 'www', site)
- override.vm.synced_folder args['local_dir'], args['vm_dir'], owner: 'vagrant', group: 'www-data', mount_options: []
+ override.vm.synced_folder args['local_dir'], args['vm_dir'], owner: 'vagrant', group: 'www-data', mount_options: [ 'share' ]
end
end
end
@@ -853,8 +809,14 @@ Vagrant.configure('2') do |config|
config.hostsupdater.aliases = vvv_config['hosts']
config.hostsupdater.remove_on_suspend = true
else
- puts "! Neither the HostManager, GoodHosts or HostsUpdater plugins are installed!!! Domains won't work without one of these plugins!"
- puts "Run 'vagrant plugin install vagrant-goodhosts' then try again."
+ show_check = true if %w[up halt resume suspend status provision reload].include? ARGV[0]
+ if show_check
+ puts ""
+ puts " X ! There is no hosts file vagrant plugin installed!"
+ puts " X You need the vagrant-goodhosts plugin (or HostManager/ HostsUpdater ) for domains to work in the browser"
+ puts " X Run 'vagrant plugin install --local' to fix this."
+ puts ""
+ end
end
# Vagrant Triggers
diff --git a/config/default-config.yml b/config/default-config.yml
index 907075aa3..15294d2e5 100644
--- a/config/default-config.yml
+++ b/config/default-config.yml
@@ -131,12 +131,23 @@ vm_config:
# General VVV options
general:
+
+ # Back up Options
+ # You can always backup/restore manually using vagrant ssh -c "db_backup" or vagrant ssh -c "db_restore"
+
# Backup the databases to the database/backups subfolder on halt/suspend/destroy, set to false to disable
- db_backup: true
+ db_backup:
+ enable: false
+ gzip: true
+ #exclude:
+ # - wordpress-trunk
+
# Import the databases if they're missing from backups
- db_restore: true
+ db_restore: false
+
# set to true to use a synced shared folder for MariaDB database storage
db_share_type: false
+
# GitHub token to use from composer
#github_token: xxxxxx
diff --git a/config/homebin/db_backup b/config/homebin/db_backup
index 60d244b72..d6e6a888c 100755
--- a/config/homebin/db_backup
+++ b/config/homebin/db_backup
@@ -12,6 +12,8 @@ source /srv/provision/provision-helpers.sh
mkdir -p /srv/database/backups
vvv_info " * Performing Database Backups"
databases=()
+gzip=$(get_config_value "general.db_backup.gzip")
+exclude_list=$(get_config_values "general.db_backup.exclude")
vvv_info " * Fetching Database names"
mysql --user="root" --password="root" -e 'show databases' | \
@@ -25,6 +27,17 @@ do
[ "${db_name}" == "test" ] && vvv_info " - skipped ${db_name}" && continue;
[ "${db_name}" == "wordpress_unit_tests" ] && vvv_info " - skipped ${db_name}" && continue;
+ skip="false"
+ for exclude in ${exclude_list[@]}; do
+ if [ "${exclude}" == "${db_name}" ]; then
+ skip="true"
+ fi
+ done
+
+ if [ ${skip} == "true" ]; then
+ vvv_info " - skipped ${db_name}" && continue;
+ fi
+
# don't back up databases with no tables
mysql_cmd="SHOW TABLES FROM \`${db_name}\`" # Required to support hyphens in database names
db_exist=$(mysql -u root -proot --skip-column-names -e "${mysql_cmd}")
@@ -36,12 +49,20 @@ do
databases+=( "${db_name}" )
done < $TMPFIFODIR/dbnames
+ext=".sql"
+if [[ "${gzip}" == "True" ]]; then
+ ext=".sql.gz"
+fi
count=0
for db in "${databases[@]}"
do
- OUTPUT=$(printf " - %2s/%s Backing up %-23s to 'database/backups/%s.sql'" "${count}" "${#databases[@]}" "'${db}'" "${db}")
+ OUTPUT=$(printf " - %2s/%s Backing up %-23s to 'database/backups/%s${ext}'" "${count}" "${#databases[@]}" "'${db}'" "${db}")
vvv_output "${OUTPUT}"
- mysqldump -uroot -proot "${db}" > "/srv/database/backups/${db}.sql";
+ if [[ "${gzip}" == "True" ]]; then
+ mysqldump -uroot -proot "${db}" | gzip > "/srv/database/backups/${db}.sql.gz"
+ else
+ mysqldump -uroot -proot "${db}" > "/srv/database/backups/${db}.sql";
+ fi
let "count=count+1"
done
diff --git a/config/homebin/switch_php_debugmod b/config/homebin/switch_php_debugmod
index e16c70174..ebc5ebf94 100755
--- a/config/homebin/switch_php_debugmod
+++ b/config/homebin/switch_php_debugmod
@@ -24,24 +24,43 @@ disable_phpmods() {
# declare that our first param is an array
declare -a mods=("${!1}")
- # Take the mods array and turn it into a commar separated list
- local mods_joined=$(printf ", %s" "${mods[@]}")
- mods_joined=${mods_joined:1}
- mods_joined="${mods_joined#"${mods_joined%%[![:space:]]*}"}"
- #vvv_info " * Disabling if present: '${mods_joined}'"
-
for i in "${mods[@]}"
do
- if [[ ${enabled_mods,,} == *"${i}"* ]]; then
- vvv_info " * Disabling active PHP debug mod: '${i}'"
- sudo phpdismod "${i}"
- fi
+ 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 -v "${phpv}" "${i}"
+ fi
+ done
done
}
enable_phpmod() {
- vvv_info " * Enabling PHP debug mod: '${1}'"
- sudo phpenmod "${1}"
+ 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}"
+ else
+ vvv_info " * Skipped enabling ${1} in PHP v${phpv}, module isn't installed for this version"
+ fi
+ done
+}
+
+is_module_enabled_fpm() {
+ if [ -f "/var/lib/php/modules/${1}/fpm/enabled_by_admin/${2}" ]; then
+ return 0
+ fi
+ return 1
+}
+
+is_module_installed_fpm() {
+ if [ -f "/etc/php/${1}/mods-available/${2}.ini" ]; then
+ return 0
+ fi
+ return 1
}
restart_phpfpm() {
@@ -49,22 +68,24 @@ restart_phpfpm() {
find /etc/init.d/ -name "php*-fpm" -exec bash -c 'sudo service "$(basename "$0")" restart' {} \;
}
-#vvv_info " * Disabling active debug PHP mods"
disable_phpmods phpmods[@]
if [[ "${mod}" == "none" ]]; then
restart_phpfpm
- vvv_success " * All PHP Debug mods are now turned off."
+ vvv_success " ✔ All PHP Debug mods are now turned off."
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"
enable_phpmod "tideways_xhprof"
restart_phpfpm
- vvv_success " * PHP Debug mod switch to ${mod} complete."
+ vvv_success " ✔ PHP Debug mod switch to ${mod} complete."
exit 0
fi
@@ -77,4 +98,4 @@ fi
enable_phpmod "${mod}"
restart_phpfpm
-vvv_success " * PHP Debug mod switch to ${mod} complete."
+vvv_success " ✔ PHP Debug mod switch to ${mod} on all available PHP versions complete."
diff --git a/config/homebin/vagrant_destroy b/config/homebin/vagrant_destroy
index 7a957c07d..ef092ca3e 100755
--- a/config/homebin/vagrant_destroy
+++ b/config/homebin/vagrant_destroy
@@ -18,7 +18,7 @@ else
fi
# Check if backups are turned on or off
- run_backups=`cat ${VVV_CONFIG} | shyaml get-value general.db_backup 2> /dev/null`
+ run_backups=`cat ${VVV_CONFIG} | shyaml get-value general.db_backup.enable 2> /dev/null`
if [[ $run_backups != "False" ]]
then
diff --git a/config/homebin/vagrant_halt b/config/homebin/vagrant_halt
index f1f704e4e..6851e37f7 100755
--- a/config/homebin/vagrant_halt
+++ b/config/homebin/vagrant_halt
@@ -18,7 +18,7 @@ else
fi
# Check if backups are turned on or off
- run_backups=`cat ${VVV_CONFIG} | shyaml get-value general.db_backup 2> /dev/null`
+ run_backups=`cat ${VVV_CONFIG} | shyaml get-value general.db_backup.enable 2> /dev/null`
if [[ $run_backups != "False" ]]; then
/srv/config/homebin/db_backup
diff --git a/config/homebin/vagrant_suspend b/config/homebin/vagrant_suspend
index 1dcea1f64..f97c1653e 100755
--- a/config/homebin/vagrant_suspend
+++ b/config/homebin/vagrant_suspend
@@ -18,7 +18,7 @@ else
fi
# Check if backups are turned on or off
- run_backups=`cat ${VVV_CONFIG} | shyaml get-value general.db_backup 2> /dev/null`
+ run_backups=`cat ${VVV_CONFIG} | shyaml get-value general.db_backup.enable 2> /dev/null`
if [[ $run_backups != "False" ]]
then
diff --git a/config/homebin/vagrant_up b/config/homebin/vagrant_up
index c0368181b..52de305b1 100755
--- a/config/homebin/vagrant_up
+++ b/config/homebin/vagrant_up
@@ -29,10 +29,16 @@ fi
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
+
+if [ -x "$(command -v ntpdate)" ]; then
+ vvv_info " * Syncing clocks"
+ sudo ntpdate -u ntp.ubuntu.com
+else
+ vvv_info " - skipping ntpdate clock sync, not installed yet"
+fi
mkdir -p /vagrant/failed_provisioners
if [ -z "$(ls -A /vagrant/failed_provisioners/)" ]; then
diff --git a/config/homebin/vvv_restore_php_default b/config/homebin/vvv_restore_php_default
new file mode 100755
index 000000000..2e1506e29
--- /dev/null
+++ b/config/homebin/vvv_restore_php_default
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+DEFAULTPHP="7.4"
+echo " * Restoring the default PHP CLI version ( ${DEFAULTPHP} )"
+update-alternatives --set php "/usr/bin/php${DEFAULTPHP}"
+update-alternatives --set phar "/usr/bin/phar${DEFAULTPHP}"
+update-alternatives --set phar.phar "/usr/bin/phar.phar${DEFAULTPHP}"
+update-alternatives --set phpize "/usr/bin/phpize${DEFAULTPHP}"
+update-alternatives --set php-config "/usr/bin/php-config${DEFAULTPHP}"
+echo " * Restoration complete"
diff --git a/config/init/vvv-start.conf b/config/init/vvv-start.conf
index 632dbbfff..8fb71a525 100644
--- a/config/init/vvv-start.conf
+++ b/config/init/vvv-start.conf
@@ -6,7 +6,7 @@ start on runlevel [2345]
script
service nginx start
-service php7.3-fpm start
+service php7.4-fpm start
service memcached start
service mysql start
service mailhog start
diff --git a/config/nginx-config/sites/local-nginx-example.conf-sample b/config/nginx-config/sites/local-nginx-example.conf-sample
deleted file mode 100644
index 6ab238077..000000000
--- a/config/nginx-config/sites/local-nginx-example.conf-sample
+++ /dev/null
@@ -1,45 +0,0 @@
-################################################################
-# Example configuration file for nginx
-#
-# To add a new local WordPress domain to your environment, copy
-# this file using a filename that matches the domain you wish to
-# setup. For example - mylocaldomain.com.conf would be an ideal
-# filename for http://mylocaldomain.com
-#
-# Once copied, you will need to modify two settings in the server
-# configuration provided:
-#
-# 1. server_name - Change the server_name parameter in the server
-# configuration below to mylocaldomain.com
-# 2. root - Change root to the full path that your WordPress
-# site lives at inside Vagrant. An example would be
-# /srv/www/mylocal-wordpress
-#
-# You do not need to worry about modifying the listen or include
-# parameters as those are the same across all test sites for most
-# basic WordPress configurations.
-#
-# Once your new domain has been added, make sure to restart the
-# nginx process by running `vagrant provision` in your local
-# environment or `sudo service nginx restart` after `vagrant ssh`
-################################################################
-server {
- # Determines the port number that nginx will listen to for this
- # server configuration. 80 is the default http port.
- listen 80;
-
- # Listen for HTTPS requests as well
- listen 443 ssl;
-
- # Tells nginx what domain name should trigger this configuration. If
- # you would like multiple domains or subdomains, they can be space
- # delimited here. See http://nginx.org/en/docs/http/server_names.html
- server_name testserver.com;
-
- # Tells nginx which directory the files for this domain are located
- root /srv/www/wordpress-local;
-
- # Includes a basic WordPress configuration to help with the common
- # rules needed by a web server to deal with WordPress properly.
- include /etc/nginx/nginx-wp-common.conf;
-}
diff --git a/config/php-config/php-custom.ini b/config/php-config/php-custom.ini
index d0afcd788..435164e10 100644
--- a/config/php-config/php-custom.ini
+++ b/config/php-config/php-custom.ini
@@ -13,7 +13,7 @@ allow_call_time_pass_reference = Off
max_execution_time = 30
; Maximum amount of memory a script may consume.
-memory_limit = 128M
+memory_limit = 256M
; Show all errors except for notices.
error_reporting = E_ALL | E_STRICT
@@ -38,7 +38,7 @@ track_errors = Off
html_errors = 1
; Log errors to specified file.
-error_log = /var/log/php/php7.3_errors.log
+error_log = /var/log/php/php7.4_errors.log
; Maximum size of POST data that PHP will accept.
post_max_size = 1024M
diff --git a/config/php-config/php-fpm.conf b/config/php-config/php-fpm.conf
index d839b130c..1d3c5bfcc 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.3/fpm/*.conf
+;include=/etc/php/7.4/fpm/*.conf
;;;;;;;;;;;;;;;;;;
; Global Options ;
@@ -22,14 +22,14 @@
; Pid file
; Note: the default prefix is /var
; Default Value: none
-pid = /run/php/php7.3-fpm.pid
+pid = /run/php/php7.4-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.3-fpm.log
+error_log = /var/log/php/php7.4-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.3-fpm.log
; To configure the pools it is recommended to have one .conf file per
; pool in the following directory:
-include=/etc/php/7.3/fpm/pool.d/*.conf
+include=/etc/php/7.4/fpm/pool.d/*.conf
diff --git a/config/php-config/php-www.conf b/config/php-config/php-www.conf
index d3afbda78..bbf3005e5 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.3-fpm.sock
+listen = /var/run/php7.4-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 20c5f4387..e37744da1 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 php73 {
- server unix:/var/run/php7.3-fpm.sock;
+upstream php74 {
+ server unix:/var/run/php7.4-fpm.sock;
}
diff --git a/config/php-config/xdebug.ini b/config/php-config/xdebug.ini
index 940427d1e..fcb1c7f36 100644
--- a/config/php-config/xdebug.ini
+++ b/config/php-config/xdebug.ini
@@ -2,7 +2,7 @@ zend_extension=xdebug.so
[XDebug]
-xdebug.mode=debug,develop,profile
+xdebug.mode=debug,develop
xdebug.start_with_request=yes
xdebug.client_host=_gateway
xdebug.discover_client_host=0
diff --git a/database/sequelpro.spf b/database/sequelpro.spf
index a26657ae7..b92bbdeec 100644
--- a/database/sequelpro.spf
+++ b/database/sequelpro.spf
@@ -1,66 +1,98 @@
+
+ ContentFilters
+
+ auto_connect
+
+ data
- ContentFilters
-
- auto_connect
-
- data
+ connection
- connection
+ allowDataLocalInfile
+ 0
+ enableClearTextPlugin
+ 0
+ host
+ vvv.test
+ name
+ VVV
+ password
+ external
+ rdbms_type
+ mysql
+ sslCACertFileLocation
+
+ sslCACertFileLocationEnabled
+ 0
+ sslCertificateFileLocation
+
+ sslCertificateFileLocationEnabled
+ 0
+ sslKeyFileLocation
+
+ sslKeyFileLocationEnabled
+ 0
+ type
+ SPTCPIPConnection
+ useSSL
+ 0
+ user
+ external
+
+ session
+
+ connectionEncoding
+ utf8mb4
+ contentFilterV2
- host
- 127.0.0.1
- kcid
- -8492293750585840768
- name
- 127.0.0.1
- password
- root
- rdbms_type
- mysql
- ssh_host
- vvv
- ssh_keyLocation
-
- ssh_keyLocationEnabled
- 0
- ssh_password
-
- ssh_user
- vagrant
- sslCACertFileLocation
-
- sslCACertFileLocationEnabled
- 0
- sslCertificateFileLocation
-
- sslCertificateFileLocationEnabled
- 0
- sslKeyFileLocation
-
- sslKeyFileLocationEnabled
- 0
- type
- SPSSHTunnelConnection
- useSSL
- 0
- user
- root
+ children
+
+ filterClass
+ groupNode
+ isConjunction
+
- session
-
+ contentPageNumber
+ 1
+ contentSelection
+
+ YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0
+ b3BYJG9iamVjdHMSAAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRk
+ YXRhgAGoCwwXGBkaHiVVJG51bGzTDQ4PEBMWV05TLmtleXNaTlMu
+ b2JqZWN0c1YkY2xhc3OiERKAAoADohQVgASABYAHVHR5cGVUcm93
+ c18QHVNlbGVjdGlvbkRldGFpbFR5cGVOU0luZGV4U2V00hsPHB1c
+ TlNSYW5nZUNvdW50EACABtIfICEiWiRjbGFzc25hbWVYJGNsYXNz
+ ZXNaTlNJbmRleFNldKIjJFpOU0luZGV4U2V0WE5TT2JqZWN00h8g
+ JidcTlNEaWN0aW9uYXJ5oiYkAAgAEQAaACQAKQAyADcASQBMAFEA
+ UwBcAGIAaQBxAHwAgwCGAIgAigCNAI8AkQCTAJgAnQC9AMIAzwDR
+ ANMA2ADjAOwA9wD6AQUBDgETASAAAAAAAAACAQAAAAAAAAAoAAAA
+ AAAAAAAAAAAAAAABIw==
+
+ contentSortColIsAsc
+
+ contentViewport
+ {{0, 0}, {693, 474}}
+ isToolbarVisible
+
+ view
+ SP_VIEW_STRUCTURE
+ windowVerticalDividerPosition
+ 301.5
- encrypted
-
- format
- connection
- rdbms_type
- mysql
- rdbms_version
- 5.5.5-10.3.16-MariaDB-1:10.3.16+maria~bionic-log
- version
- 1
-
\ No newline at end of file
+ encrypted
+
+ format
+ connection
+ queryFavorites
+
+ rdbms_type
+ mysql
+ rdbms_version
+ 5.5.5-10.4.17-MariaDB-1:10.4.17+maria~bionic
+ version
+ 1
+
+
diff --git a/database/sql/import-sql.sh b/database/sql/import-sql.sh
index ee844c42f..6fec5b192 100755
--- a/database/sql/import-sql.sh
+++ b/database/sql/import-sql.sh
@@ -26,6 +26,7 @@ if [[ -f /srv/config/config.yml ]]; then
fi
run_restore=$(shyaml get-value general.db_restore 2> /dev/null < ${VVV_CONFIG})
+exclude_list=$(get_config_values "general.db_backup.exclude")
if [[ $run_restore == "False" ]]
then
@@ -41,16 +42,16 @@ cd /srv/database/backups/
# Parse through each file in the directory and use the file name to
# import the SQL file into the database of the same name
-sql_count=$(ls -1 ./*.sql 2>/dev/null | wc -l)
+sql_count=$(ls -1 ./*.sql* 2>/dev/null | wc -l)
if [ "$sql_count" != 0 ]
then
- for file in $( ls ./*.sql )
+ for file in $( ls ./*.sql* )
do
# get rid of the extension
- pre_dot=${file%%.sql}
-
- # get rid of the ./
- db_name=${pre_dot##./}
+ db_name=$(basename "${file}" .sql)
+ if [ "${file: -3}" == ".gz" ]; then
+ db_name=$(basename "${file}" .sql.gz)
+ fi
# skip these databases
[ "${db_name}" == "mysql" ] && continue;
@@ -64,6 +65,17 @@ then
[ "${db_name}" == "wordpress_unit_tests" ] && continue;
+ skip="false"
+ for exclude in ${exclude_list[@]}; do
+ if [ "${exclude}" == "${db_name}" ]; then
+ skip="true"
+ fi
+ done
+
+ if [ ${skip} == "true" ]; then
+ vvv_info " - skipped ${db_name}" && continue;
+ fi
+
mysql_cmd="SHOW TABLES FROM \`${db_name}\`" # Required to support hyphens in database names
db_exist=$(mysql -u root -proot --skip-column-names -e "${mysql_cmd}")
if [ "$?" != "0" ]
@@ -71,8 +83,12 @@ then
vvv_error " * Error - Create the ${db_name} database via init-custom.sql before attempting import"
else
if [ "" == "${db_exist}" ]; then
- vvv_info " * Importing ${db_name} from ${db_name}.sql"
- mysql -u root -proot "${db_name}" < "${db_name}.sql"
+ vvv_info " * Importing ${db_name} from ${file}"
+ if [ "${file: -3}" == ".gz" ]; then
+ gunzip < "${file}" | mysql -u root -proot "${db_name}"
+ else
+ mysql -u root -proot "${db_name}" < "${file}"
+ fi
vvv_success " * Import of '${db_name}' successful"
else
vvv_info " * Skipped import of \`${db_name}\` - tables already exist"
diff --git a/provision/core/composer/provision.sh b/provision/core/composer/provision.sh
index 0f5e4ec38..e956d07d6 100644
--- a/provision/core/composer/provision.sh
+++ b/provision/core/composer/provision.sh
@@ -1,38 +1,37 @@
#!/usr/bin/env bash
-# @description Installs composer and tools installed via composer packages
+# @description Installs Composer and tools installed via Composer packages
set -eo pipefail
# @noargs
function composer_setup() {
- # Disable xdebug before any composer provisioning.
+ # Disable XDebug before any Composer provisioning.
vvv_info " * Turning off XDebug to avoid Composer performance issues"
sh /srv/config/homebin/xdebug_off
- vvv_info " * Making sure the composer cache is not owned by root"
- mkdir -p /usr/local/src/composer
- mkdir -p /usr/local/src/composer/cache
- chown -R vagrant:www-data /usr/local/src/composer
- chown -R vagrant:www-data /usr/local/bin
-
# COMPOSER
export COMPOSER_ALLOW_SUPERUSER=1
export COMPOSER_NO_INTERACTION=1
+ export COMPOSER_RUNTIME_ENV="vagrant"
- vvv_info " * Checking Composer is installed"
- if [[ ! -f "/usr/local/bin/composer" ]]; then
+ vvv_info " * Checking if Composer is installed"
+ if ! command -v composer &> /dev/null; then
vvv_info " * Installing Composer..."
curl -sS "https://getcomposer.org/installer" | php
chmod +x "composer.phar"
+ chown -R vagrant:www-data /usr/local/bin
mv "composer.phar" "/usr/local/bin/composer"
- vvv_info " * Forcing composer to v1.x"
- composer selfupdate --1
vvv_success " * Composer installer steps completed"
fi
- vvv_info " * Checking for github tokens"
+ vvv_info " * Making sure the Composer cache is not owned by root"
+ COMPOSER_DATA_DIR=$(composer config -g data-dir)
+ mkdir -p "${COMPOSER_DATA_DIR}"/cache
+ chown -R vagrant:www-data "${COMPOSER_DATA_DIR}"
+
+ vvv_info " * Checking for GitHub tokens"
if github_token=$(shyaml get-value -q "general.github_token" < "${VVV_CONFIG}"); then
- vvv_info " * A personal GitHub token was found, configuring composer"
+ vvv_info " * A personal GitHub token was found, configuring Composer"
rm /srv/provision/github.token
echo "$github_token" >> /srv/provision/github.token
ghtoken=$(cat /srv/provision/github.token)
@@ -42,18 +41,20 @@ function composer_setup() {
# Update both Composer and any global packages. Updates to Composer are direct from
# the master branch on its GitHub repository.
- vvv_info " * Checking for composer updates"
- if [[ -n "$(noroot composer --version --no-ansi | grep 'Composer version')" ]]; then
+ vvv_info " * Checking for Composer updates"
+ if ! noroot composer --version --no-ansi | grep 'Composer version'; then
vvv_info " * Updating Composer..."
- COMPOSER_HOME=/usr/local/src/composer noroot composer --no-ansi global config bin-dir /usr/local/bin
- COMPOSER_HOME=/usr/local/src/composer noroot composer --no-ansi self-update --1 --stable --no-progress --no-interaction
+ COMPOSER_HOME="${COMPOSER_DATA_DIR}" noroot composer --no-ansi global config bin-dir /usr/local/bin
+ COMPOSER_HOME="${COMPOSER_DATA_DIR}" noroot composer --no-ansi self-update --2 --stable --no-progress --no-interaction
vvv_info " * Making sure the PHPUnit 7.5 package is available..."
- COMPOSER_HOME=/usr/local/src/composer noroot composer --no-ansi global require --prefer-dist --no-update --no-progress --no-interaction phpunit/phpunit:^7.5
+ COMPOSER_HOME="${COMPOSER_DATA_DIR}" noroot composer --no-ansi global require --prefer-dist --no-update --no-progress --no-interaction phpunit/phpunit:^7.5
fi
- vvv_info " * Updating global composer packages..."
- COMPOSER_HOME=/usr/local/src/composer noroot composer --no-ansi global update --no-progress --no-interaction
- vvv_success " * Global composer package update completed"
+ if [ -f "${COMPOSER_DATA_DIR}"/composer.json ]; then
+ vvv_info " * Updating global Composer packages..."
+ COMPOSER_HOME="${COMPOSER_DATA_DIR}" noroot composer --no-ansi global update --no-progress --no-interaction
+ vvv_success " * Global Composer package update completed"
+ fi
vvv_hook after_composer
}
diff --git a/config/bash_aliases b/provision/core/env/homedir/.bash_aliases
similarity index 100%
rename from config/bash_aliases
rename to provision/core/env/homedir/.bash_aliases
diff --git a/config/bash_profile b/provision/core/env/homedir/.bash_profile
similarity index 96%
rename from config/bash_profile
rename to provision/core/env/homedir/.bash_profile
index 2304baa11..188b557e5 100644
--- a/config/bash_profile
+++ b/provision/core/env/homedir/.bash_profile
@@ -13,6 +13,8 @@ if [ -n "$BASH_VERSION" ]; then
fi
fi
+export PATH="$PATH:/srv/www/phpcs/bin"
+
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
diff --git a/config/subversion-config b/provision/core/env/homedir/.subversion/subversion-config
similarity index 100%
rename from config/subversion-config
rename to provision/core/env/homedir/.subversion/subversion-config
diff --git a/config/subversion-servers b/provision/core/env/homedir/.subversion/subversion-servers
similarity index 100%
rename from config/subversion-servers
rename to provision/core/env/homedir/.subversion/subversion-servers
diff --git a/config/vimrc b/provision/core/env/homedir/.vimrc
similarity index 100%
rename from config/vimrc
rename to provision/core/env/homedir/.vimrc
diff --git a/config/update-motd.d/00-vvv-bash-splash b/provision/core/env/motd/00-vvv-bash-splash
similarity index 100%
rename from config/update-motd.d/00-vvv-bash-splash
rename to provision/core/env/motd/00-vvv-bash-splash
diff --git a/provision/core/env.sh b/provision/core/env/provision.sh
similarity index 62%
rename from provision/core/env.sh
rename to provision/core/env/provision.sh
index 15a9752a0..aa1075a5f 100644
--- a/provision/core/env.sh
+++ b/provision/core/env/provision.sh
@@ -57,7 +57,10 @@ function cleanup_terminal_splash() {
if [[ -f /etc/update-motd.d/98-cloudguest ]]; then
rm /etc/update-motd.d/98-cloudguest
fi
- cp -f "/srv/config/update-motd.d/00-vvv-bash-splash" "/etc/update-motd.d/00-vvv-bash-splash"
+ if [[ -f /etc/update-motd.d/00-vvv-bash-splash ]]; then
+ rm /etc/update-motd.d/00-vvv-bash-splash
+ fi
+ cp -f "/srv/provision/core/env/motd/00-vvv-bash-splash" "/etc/update-motd.d/00-vvv-bash-splash"
chmod +x /etc/update-motd.d/00-vvv-bash-splash
}
@@ -66,34 +69,35 @@ function cleanup_terminal_splash() {
function profile_setup() {
vvv_info " * Setting ownership of files in /home/vagrant to vagrant"
chown -R vagrant:vagrant /home/vagrant/
+
# Copy custom dotfiles and bin file for the vagrant user from local
- vvv_info " * Copying /srv/config/bash_profile to /home/vagrant/.bash_profile"
+ vvv_info " * Copying /srv/provision/core/env/homedir/.bash_profile to /home/vagrant/.bash_profile"
rm -f "/home/vagrant/.bash_profile"
- noroot cp -f "/srv/config/bash_profile" "/home/vagrant/.bash_profile"
+ noroot cp -f "/srv/provision/core/env/homedir/.bash_profile" "/home/vagrant/.bash_profile"
- vvv_info " * Copying /srv/config/bash_aliases to /home/vagrant/.bash_aliases"
+ vvv_info " * Copying /srv/provision/core/env/homedir/.bash_aliases to /home/vagrant/.bash_aliases"
rm -f "/home/vagrant/.bash_aliases"
- noroot cp -f "/srv/config/bash_aliases" "/home/vagrant/.bash_aliases"
+ noroot cp -f "/srv/provision/core/env/homedir/.bash_aliases" "/home/vagrant/.bash_aliases"
- vvv_info " * Copying /srv/config/bash_aliases to ${HOME}/.bash_aliases"
+ vvv_info " * Copying /srv/provision/core/env/homedir/.bash_aliases to ${HOME}/.bash_aliases"
rm -f "${HOME}/.bash_aliases"
- cp -f "/srv/config/bash_aliases" "${HOME}/.bash_aliases"
+ cp -f "/srv/provision/core/env/homedir/.bash_aliases" "${HOME}/.bash_aliases"
- vvv_info " * Copying /srv/config/vimrc to /home/vagrant/.vimrc"
+ vvv_info " * Copying /srv/provision/core/env/homedir/.vimrc to /home/vagrant/.vimrc"
rm -f "/home/vagrant/.vimrc"
- noroot cp -f "/srv/config/vimrc" "/home/vagrant/.vimrc"
+ noroot cp -f "/srv/provision/core/env/homedir/.vimrc" "/home/vagrant/.vimrc"
if [[ ! -d "/home/vagrant/.subversion" ]]; then
noroot mkdir -p "/home/vagrant/.subversion"
fi
- vvv_info " * Copying /srv/config/subversion-servers to /home/vagrant/.subversion/servers"
+ vvv_info " * Copying /srv/provision/core/env/homedir/.subversion/subversion-servers to /home/vagrant/.subversion/servers"
rm -f /home/vagrant/.subversion/servers
- noroot cp "/srv/config/subversion-servers" "/home/vagrant/.subversion/servers"
+ noroot cp "/srv/provision/core/env/homedir/.subversion/subversion-servers" "/home/vagrant/.subversion/servers"
- vvv_info " * Copying /srv/config/subversion-config to /home/vagrant/.subversion/config"
+ vvv_info " * Copying /srv/provision/core/env/homedir/.subversion/subversion-config to /home/vagrant/.subversion/config"
rm -f /home/vagrant/.subversion/config
- noroot cp "/srv/config/subversion-config" "/home/vagrant/.subversion/config"
+ noroot cp "/srv/provision/core/env/homedir/.subversion/subversion-config" "/home/vagrant/.subversion/config"
# If a bash_prompt file exists in the VVV config/ directory, copy to the VM.
if [[ -f "/srv/config/bash_prompt" ]]; then
@@ -101,13 +105,14 @@ function profile_setup() {
rm -f /home/vagrant/.bash_prompt
noroot cp "/srv/config/bash_prompt" "/home/vagrant/.bash_prompt"
fi
+
if [ -d "/etc/ssh" ]; then
- vvv_info " * Copying /srv/config/ssh_known_hosts to /etc/ssh/ssh_known_hosts"
- cp -f /srv/config/ssh_known_hosts /etc/ssh/ssh_known_hosts
- vvv_info " * Copying /srv/config/sshd_config to /etc/ssh/sshd_config"
- cp -f /srv/config/sshd_config /etc/ssh/sshd_config
- vvv_info " * Reloading SSH Daemon"
+ vvv_info " * Copying /srv/provision/core/env/ssh/ssh_known_hosts to /etc/ssh/ssh_known_hosts"
+ cp -f /srv/provision/core/env/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts
+ vvv_info " * Copying /srv/provision/core/env/ssh/sshd_config to /etc/ssh/sshd_config"
+ 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
fi
fi
@@ -123,4 +128,4 @@ function vvv_init_profile() {
profile_setup
}
-vvv_add_hook init vvv_init_profile 0
\ No newline at end of file
+vvv_add_hook init vvv_init_profile 0
diff --git a/config/ssh_known_hosts b/provision/core/env/ssh/ssh_known_hosts
similarity index 100%
rename from config/ssh_known_hosts
rename to provision/core/env/ssh/ssh_known_hosts
diff --git a/config/sshd_config b/provision/core/env/ssh/sshd_config
similarity index 100%
rename from config/sshd_config
rename to provision/core/env/ssh/sshd_config
diff --git a/config/apt-keys/git-lfs.key b/provision/core/git/apt-keys/git-lfs.key
similarity index 100%
rename from config/apt-keys/git-lfs.key
rename to provision/core/git/apt-keys/git-lfs.key
diff --git a/provision/core/git/provision.sh b/provision/core/git/provision.sh
index 3917bd039..4f2014159 100644
--- a/provision/core/git/provision.sh
+++ b/provision/core/git/provision.sh
@@ -13,14 +13,19 @@ function git_register_packages() {
vvv_info " * git-core/ppa already present, skipping"
fi
- if ! vvv_src_list_has "github/git-lfs"; then
- cp -f "/srv/provision/core/git/sources.list" "/etc/apt/sources.list.d/vvv-git-sources.list"
- fi
-
if ! vvv_apt_keys_has 'git-lfs'; then
# Apply the PackageCloud signing key which signs git lfs
vvv_info " * Applying the PackageCloud Git-LFS signing key..."
- apt-key add /srv/config/apt-keys/git-lfs.key
+ apt-key add /srv/provision/core/git/apt-keys/git-lfs.key
+ fi
+
+ local OSID=$(lsb_release --id --short)
+ local OSCODENAME=$(lsb_release --codename --short)
+ local APTSOURCE="/srv/provision/core/git/sources-${OSID,,}-${OSCODENAME,,}.list"
+ if [ -f "${APTSOURCE}" ]; then
+ cp -f "${APTSOURCE}" "/etc/apt/sources.list.d/vvv-git-sources.list"
+ else
+ vvv_error " ! VVV could not copy an Apt source file ( ${APTSOURCE} ), the current OS/Version (${OSID,,}-${OSCODENAME,,}) combination is unavailable"
fi
VVV_PACKAGE_LIST+=(
diff --git a/provision/core/git/sources.list b/provision/core/git/sources-ubuntu-bionic.list
similarity index 100%
rename from provision/core/git/sources.list
rename to provision/core/git/sources-ubuntu-bionic.list
diff --git a/provision/core/git/sources-ubuntu-focal.list b/provision/core/git/sources-ubuntu-focal.list
new file mode 100644
index 000000000..fef4a825a
--- /dev/null
+++ b/provision/core/git/sources-ubuntu-focal.list
@@ -0,0 +1,3 @@
+# git lfs (large file storage plugin for git)
+deb https://packagecloud.io/github/git-lfs/ubuntu/ focal main
+deb-src https://packagecloud.io/github/git-lfs/ubuntu/ focal main
diff --git a/provision/core/grunt/provision.sh b/provision/core/grunt/provision.sh
index c3c746dd9..52c2a5bec 100644
--- a/provision/core/grunt/provision.sh
+++ b/provision/core/grunt/provision.sh
@@ -3,7 +3,7 @@
function install_grunt() {
vvv_info " * Installing Grunt CLI"
- npm_config_loglevel=error npm install -g grunt grunt-cli --no-optional
+ npm_config_loglevel=error npm install -g grunt grunt-cli --no-optional --force
npm_config_loglevel=error hack_avoid_gyp_errors & npm install -g grunt-sass --no-optional; touch /tmp/stop_gyp_hack
npm_config_loglevel=error npm install -g grunt-cssjanus --no-optional
npm_config_loglevel=error npm install -g grunt-rtlcss --no-optional
@@ -12,7 +12,7 @@ function install_grunt() {
function update_grunt() {
vvv_info " * Updating Grunt CLI"
- npm_config_loglevel=error npm update -g grunt grunt-cli --no-optional
+ npm_config_loglevel=error npm update -g grunt grunt-cli --no-optional --force
npm_config_loglevel=error hack_avoid_gyp_errors & npm update -g grunt-sass; touch /tmp/stop_gyp_hack
npm_config_loglevel=error npm update -g grunt-cssjanus --no-optional
npm_config_loglevel=error npm update -g grunt-rtlcss --no-optional
@@ -50,4 +50,4 @@ function grunt_setup() {
}
export -f grunt_setup
-vvv_add_hook after_packages grunt_setup
\ No newline at end of file
+vvv_add_hook after_packages grunt_setup
diff --git a/provision/core/mailhog/provision.sh b/provision/core/mailhog/provision.sh
index f782cc6a8..af26671de 100644
--- a/provision/core/mailhog/provision.sh
+++ b/provision/core/mailhog/provision.sh
@@ -10,19 +10,35 @@ function mailhog_setup() {
if [[ ! -e /usr/local/bin/mailhog ]]; then
vvv_info " * Installing MailHog"
- curl --silent -L -o /usr/local/bin/mailhog https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_linux_amd64
- chmod +x /usr/local/bin/mailhog
- vvv_success " * Mailhog binary installed"
+ mailhog_bin="https://github.com/mailhog/MailHog/releases/download/v1.0.1/MailHog_linux_amd64"
+ if [[ "aarch64" == $(uname -m) ]]; then
+ mailhog_bin="https://github.com/evertiro/MailHog/releases/download/v1.0.1-M1/MailHog_linux_arm64"
+ fi
+ if curl --retry 3 --retry-delay 1 --show-error --silent -L -o /usr/local/bin/mailhog "${mailhog_bin}"; then
+ chmod +x /usr/local/bin/mailhog
+ vvv_success " * Mailhog binary installed"
+ else
+ vvv_error " ! MailHog failed to download, error code: '${?}', check that you have a stable reliable network connection then try again. VVV tried to download '${mailhog_bin}'"
+ return 1
+ fi
fi
if [[ ! -e /usr/local/bin/mhsendmail ]]; then
vvv_info " * Installing MHSendmail"
- curl --silent -L -o /usr/local/bin/mhsendmail https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64
- chmod +x /usr/local/bin/mhsendmail
- vvv_success " * MHSendmail installed"
+ mhsendmail_bin="https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64"
+ if [[ "aarch64" == $(uname -m) ]]; then
+ mhsendmail_bin="https://github.com/evertiro/mhsendmail/releases/download/v0.2.0-M1/mhsendmail_linux_arm64"
+ fi
+ if curl --retry 3 --retry-delay 1 --show-error --silent -L -o /usr/local/bin/mhsendmail "${mhsendmail_bin}"; then
+ chmod +x /usr/local/bin/mhsendmail
+ vvv_success " * MHSendmail downloaded"
+ else
+ vvv_error " ! MHSendmail failed to download, error code: '${?}', check that you have a stable reliable network connection then try again. VVV tried to download '${mhsendmail_bin}'"
+ return 1
+ fi
fi
- if [[ ! -e /etc/systemd/system/mailhog.service ]]; then
- vvv_info " * Mailhog service file missing, setting up"
+ if [[ -d /etc/systemd/system/ ]]; then
+ vvv_info " * Adding Mailhog service file"
# Make it start on reboot
cp -f "/srv/provision/core/mailhog/mailhog.service" "/etc/systemd/system/mailhog.service"
fi
@@ -47,7 +63,9 @@ fi
function mailhog_php_finalize() {
# Enable PHP MailHog sendmail settings by default
vvv_info " * Enabling MailHog for PHP"
- phpenmod -s ALL mailhog
+ if phpenmod -s ALL mailhog; then
+ vvv_success " * MailHog enabled"
+ fi
}
vvv_add_hook php_finalize mailhog_php_finalize
diff --git a/config/apt-keys/mariadb.key b/provision/core/mariadb/apt-keys/mariadb.key
similarity index 100%
rename from config/apt-keys/mariadb.key
rename to provision/core/mariadb/apt-keys/mariadb.key
diff --git a/config/mysql-config/my.cnf b/provision/core/mariadb/config/my.cnf
similarity index 100%
rename from config/mysql-config/my.cnf
rename to provision/core/mariadb/config/my.cnf
diff --git a/config/mysql-config/root-my.cnf b/provision/core/mariadb/config/root-my.cnf
similarity index 100%
rename from config/mysql-config/root-my.cnf
rename to provision/core/mariadb/config/root-my.cnf
diff --git a/config/mysql-config/vvv-core.cnf b/provision/core/mariadb/config/vvv-core.cnf
similarity index 100%
rename from config/mysql-config/vvv-core.cnf
rename to provision/core/mariadb/config/vvv-core.cnf
diff --git a/provision/core/mariadb/provision.sh b/provision/core/mariadb/provision.sh
index 5f668955d..b3b528240 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..."
@@ -31,17 +31,22 @@ function mariadb_register_packages() {
fi
mkdir -p "/etc/mysql/conf.d"
- vvv_info " * Copying /srv/config/mysql-config/vvv-core.cnf to /etc/mysql/conf.d/vvv-core.cnf"
- cp -f "/srv/config/mysql-config/vvv-core.cnf" "/etc/mysql/conf.d/vvv-core.cnf"
+ vvv_info " * Copying /srv/provision/core/mariadb/config/vvv-core.cnf to /etc/mysql/conf.d/vvv-core.cnf"
+ cp -f "/srv/provision/core/mariadb/config/vvv-core.cnf" "/etc/mysql/conf.d/vvv-core.cnf"
if ! vvv_apt_keys_has 'MariaDB'; then
# Apply the MariaDB signing keyg
vvv_info " * Applying the MariaDB signing key..."
- apt-key add /srv/config/apt-keys/mariadb.key
+ apt-key add /srv/provision/core/mariadb/apt-keys/mariadb.key
fi
- if ! vvv_src_list_has "MariaDB"; then
- cp -f "/srv/provision/core/mariadb/sources.list" "/etc/apt/sources.list.d/vvv-mariadb-sources.list"
+ local OSID=$(lsb_release --id --short)
+ local OSCODENAME=$(lsb_release --codename --short)
+ local APTSOURCE="/srv/provision/core/mariadb/sources-${OSID,,}-${OSCODENAME,,}.list"
+ if [ -f "${APTSOURCE}" ]; then
+ cp -f "${APTSOURCE}" "/etc/apt/sources.list.d/vvv-mariadb-sources.list"
+ else
+ vvv_error " ! VVV could not copy an Apt source file ( ${APTSOURCE} ), the current OS/Version (${OSID,,}-${OSCODENAME,,}) combination is unavailable"
fi
VVV_PACKAGE_LIST+=(mariadb-server)
@@ -88,12 +93,12 @@ function mysql_setup() {
vvv_info " * Setting up database configuration file links..."
# Copy mysql configuration from local
- cp "/srv/config/mysql-config/my.cnf" "/etc/mysql/my.cnf"
- vvv_info " * Copied /srv/config/mysql-config/my.cnf to /etc/mysql/my.cnf"
+ cp -f "/srv/provision/core/mariadb/config/my.cnf" "/etc/mysql/my.cnf"
+ vvv_info " * Copied /srv/provision/core/mariadb/config/my.cnf to /etc/mysql/my.cnf"
- cp -f "/srv/config/mysql-config/root-my.cnf" "/home/vagrant/.my.cnf"
+ cp -f "/srv/provision/core/mariadb/config/root-my.cnf" "/home/vagrant/.my.cnf"
chmod 0644 "/home/vagrant/.my.cnf"
- vvv_info " * Copied /srv/config/mysql-config/root-my.cnf to /home/vagrant/.my.cnf"
+ vvv_info " * Copied /srv/provision/core/mariadb/config/root-my.cnf to /home/vagrant/.my.cnf"
if [ "${VVV_DOCKER}" != 1 ]; then
check_mysql_root_password
@@ -109,6 +114,7 @@ function mysql_setup() {
vvv_info " * Restarting mysql service"
service mysql restart
fi
+
# IMPORT SQL
#
# Create the databases (unique to system) that will be imported with
@@ -124,7 +130,7 @@ function mysql_setup() {
# Setup MySQL by importing an init file that creates necessary
# users and databases that our vagrant setup relies on.
mysql -u "root" -p"root" < "/srv/database/init.sql"
- vvv_info " * Initial MySQL prep..."
+ vvv_info " * Initial SQL prep..."
# Process each mysqldump SQL file in database/backups to import
# an initial data set for MySQL.
diff --git a/provision/core/mariadb/sources-ubuntu-bionic.list b/provision/core/mariadb/sources-ubuntu-bionic.list
new file mode 100644
index 000000000..85ac48fb2
--- /dev/null
+++ b/provision/core/mariadb/sources-ubuntu-bionic.list
@@ -0,0 +1,23 @@
+# 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.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.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.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.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.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
new file mode 100644
index 000000000..6e2a561dd
--- /dev/null
+++ b/provision/core/mariadb/sources-ubuntu-focal.list
@@ -0,0 +1,23 @@
+# 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.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.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.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.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.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/mariadb/sources.list b/provision/core/mariadb/sources.list
deleted file mode 100644
index f96cb2f1c..000000000
--- a/provision/core/mariadb/sources.list
+++ /dev/null
@@ -1,23 +0,0 @@
-# MariaDB 10.4 Amsterdam
-deb [arch=amd64,arm64,ppc64el] http://ams2.mirrors.digitalocean.com/mariadb/repo/10.4/ubuntu bionic main
-deb-src http://ams2.mirrors.digitalocean.com/mariadb/repo/10.4/ubuntu bionic main
-
-# MariaDB 10.4 Digital Ocean Singapore
-deb [arch=amd64,arm64,ppc64el] http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.4/ubuntu bionic main
-deb-src http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.4/ubuntu bionic main
-
-# MariaDB 10.4 Digital Ocean San Francisco
-deb [arch=amd64,arm64,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.4/ubuntu bionic main
-deb-src http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.4/ubuntu bionic main
-
-# MariaDB 10.4 Yamagata University Japan
-deb [arch=amd64,arm64,ppc64el] http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/repo/10.4/ubuntu bionic main
-deb-src http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/repo/10.4/ubuntu bionic main
-
-# MariaDB 10.4 UKFast Manchester
-deb [arch=amd64,arm64,ppc64el] http://mirrors.ukfast.co.uk/sites/mariadb/repo/10.4/ubuntu bionic main
-deb-src http://mirrors.ukfast.co.uk/sites/mariadb/repo/10.4/ubuntu bionic main
-
-# MariaDB 10.4 PicoNets Mumbai
-deb [arch=amd64,arm64,ppc64el] http://mirrors.piconets.webwerks.in/mariadb-mirror/repo/10.4/ubuntu bionic main
-deb-src http://mirrors.piconets.webwerks.in/mariadb-mirror/repo/10.4/ubuntu bionic main
diff --git a/config/memcached-config/memcached.conf b/provision/core/memcached/config/memcached.conf
similarity index 100%
rename from config/memcached-config/memcached.conf
rename to provision/core/memcached/config/memcached.conf
diff --git a/provision/core/memcached/provision.sh b/provision/core/memcached/provision.sh
new file mode 100644
index 000000000..c76aff28c
--- /dev/null
+++ b/provision/core/memcached/provision.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+# @description Installs MemCached
+set -eo pipefail
+
+function vvv_memcached_register_packages() {
+ # MemCached
+ VVV_PACKAGE_LIST+=(
+ # memcached is made available for object caching
+ memcached
+ )
+}
+export -f vvv_memcached_register_packages
+vvv_add_hook before_packages vvv_memcached_register_packages
+
+function vvv_memcached_setup() {
+ # Copy memcached configuration from local
+ vvv_info " * Copying /srv/provision/core/memcached/config/memcached.conf to /etc/memcached.conf and /etc/memcached_default.conf"
+ cp -f "/srv/provision/core/memcached/config/memcached.conf" "/etc/memcached.conf"
+ cp -f "/srv/provision/core/memcached/config/memcached.conf" "/etc/memcached_default.conf"
+}
+export -f vvv_memcached_setup
+vvv_add_hook after_packages vvv_memcached_setup 60
+
+if [ "${VVV_DOCKER}" != 1 ]; then
+ vvv_add_hook services_restart "service memcached restart"
+fi
diff --git a/config/apt-keys/nginx_signing.key b/provision/core/nginx/apt-keys/nginx_signing.key
similarity index 100%
rename from config/apt-keys/nginx_signing.key
rename to provision/core/nginx/apt-keys/nginx_signing.key
diff --git a/config/nginx-config/nginx-wp-common.conf b/provision/core/nginx/config/nginx-wp-common.conf
similarity index 100%
rename from config/nginx-config/nginx-wp-common.conf
rename to provision/core/nginx/config/nginx-wp-common.conf
diff --git a/config/nginx-config/nginx.conf b/provision/core/nginx/config/nginx.conf
similarity index 98%
rename from config/nginx-config/nginx.conf
rename to provision/core/nginx/config/nginx.conf
index f3a045b51..55a8a0501 100644
--- a/config/nginx-config/nginx.conf
+++ b/provision/core/nginx/config/nginx.conf
@@ -88,7 +88,7 @@ http {
# Upstream to abstract backend connection(s) for PHP.
upstream php {
- server unix:/var/run/php7.3-fpm.sock;
+ server unix:/var/run/php7.4-fpm.sock;
}
include /etc/nginx/upstreams/*.conf;
diff --git a/config/nginx-config/sites/default.conf b/provision/core/nginx/config/sites/default.conf
similarity index 96%
rename from config/nginx-config/sites/default.conf
rename to provision/core/nginx/config/sites/default.conf
index fba3c2695..258b3a830 100644
--- a/config/nginx-config/sites/default.conf
+++ b/provision/core/nginx/config/sites/default.conf
@@ -48,7 +48,7 @@ server {
# be sure that it exists.
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- # Use the upstream for fastcgi / php5-fpm that we defined in nginx.conf
+ # Use the upstream for fastcgi / php-fpm that we defined in nginx.conf
fastcgi_pass php;
# And get to serving the file!
diff --git a/provision/core/nginx/provision.sh b/provision/core/nginx/provision.sh
index 6e9685142..d39c16cb1 100644
--- a/provision/core/nginx/provision.sh
+++ b/provision/core/nginx/provision.sh
@@ -3,8 +3,13 @@
set -eo pipefail
function nginx_register_packages() {
- if ! vvv_src_list_has "nginx.org"; then
- cp -f "/srv/provision/core/nginx/sources.list" "/etc/apt/sources.list.d/vvv-nginx-sources.list"
+ local OSID=$(lsb_release --id --short)
+ local OSCODENAME=$(lsb_release --codename --short)
+ local APTSOURCE="/srv/provision/core/nginx/sources-${OSID,,}-${OSCODENAME,,}.list"
+ if [ -f "${APTSOURCE}" ]; then
+ cp -f "${APTSOURCE}" "/etc/apt/sources.list.d/vvv-nginx-sources.list"
+ else
+ vvv_error " ! VVV could not copy an Apt source file ( ${APTSOURCE} ), the current OS/Version (${OSID,,}-${OSCODENAME,,}) combination is unavailable"
fi
# Before running `apt-get update`, we should add the public keys for
@@ -13,7 +18,7 @@ function nginx_register_packages() {
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/config/apt-keys/nginx_signing.key
+ apt-key add /srv/provision/core/nginx/apt-keys/nginx_signing.key
fi
VVV_PACKAGE_LIST+=(nginx)
@@ -45,11 +50,11 @@ function nginx_setup() {
vvv_info " * Setup configuration files..."
# Copy nginx configuration from local
- vvv_info " * Copying /srv/config/nginx-config/nginx.conf to /etc/nginx/nginx.conf"
- cp -f "/srv/config/nginx-config/nginx.conf" "/etc/nginx/nginx.conf"
+ vvv_info " * Copying /srv/provision/core/nginx/config/nginx.conf to /etc/nginx/nginx.conf"
+ cp -f "/srv/provision/core/nginx/config/nginx.conf" "/etc/nginx/nginx.conf"
- vvv_info " * Copying /srv/config/nginx-config/nginx-wp-common.conf to /etc/nginx/nginx-wp-common.conf"
- cp -f "/srv/config/nginx-config/nginx-wp-common.conf" "/etc/nginx/nginx-wp-common.conf"
+ vvv_info " * Copying /srv/provision/core/nginx/config/nginx-wp-common.conf to /etc/nginx/nginx-wp-common.conf"
+ cp -f "/srv/provision/core/nginx/config/nginx-wp-common.conf" "/etc/nginx/nginx-wp-common.conf"
if [[ ! -d "/etc/nginx/upstreams" ]]; then
mkdir -p "/etc/nginx/upstreams/"
@@ -60,8 +65,8 @@ function nginx_setup() {
if [[ ! -d "/etc/nginx/custom-sites" ]]; then
mkdir -p "/etc/nginx/custom-sites/"
fi
- vvv_info " * Rsync'ing /srv/config/nginx-config/sites/ to /etc/nginx/custom-sites"
- rsync -rvzh --delete "/srv/config/nginx-config/sites/" "/etc/nginx/custom-sites/"
+ vvv_info " * Rsync'ing /srv/provision/core/nginx/config/sites/ to /etc/nginx/custom-sites"
+ rsync -rvzh --delete "/srv/provision/core/nginx/config/sites/" "/etc/nginx/custom-sites/"
if [[ ! -d "/etc/nginx/custom-utilities" ]]; then
mkdir -p "/etc/nginx/custom-utilities/"
@@ -92,4 +97,5 @@ function nginx_cleanup() {
find /etc/nginx/custom-sites -name 'vvv-auto-*.conf' -exec rm {} \;
}
export -f nginx_cleanup
-vvv_add_hook finalize nginx_cleanup
\ No newline at end of file
+
+vvv_add_hook finalize nginx_cleanup
diff --git a/provision/core/nginx/sources.list b/provision/core/nginx/sources-ubuntu-bionic.list
similarity index 100%
rename from provision/core/nginx/sources.list
rename to provision/core/nginx/sources-ubuntu-bionic.list
diff --git a/provision/core/nginx/sources-ubuntu-focal.list b/provision/core/nginx/sources-ubuntu-focal.list
new file mode 100644
index 000000000..3be2c7edc
--- /dev/null
+++ b/provision/core/nginx/sources-ubuntu-focal.list
@@ -0,0 +1,3 @@
+# Provides Nginx mainline
+deb https://nginx.org/packages/mainline/ubuntu/ focal nginx
+deb-src https://nginx.org/packages/mainline/ubuntu/ focal nginx
diff --git a/config/apt-keys/nodesource.gpg.key b/provision/core/nodejs/apt-keys/nodesource.gpg.key
similarity index 100%
rename from config/apt-keys/nodesource.gpg.key
rename to provision/core/nodejs/apt-keys/nodesource.gpg.key
diff --git a/provision/core/nodejs/nodesource-ppa-pin b/provision/core/nodejs/nodesource-ppa-pin
new file mode 100644
index 000000000..91f418f81
--- /dev/null
+++ b/provision/core/nodejs/nodesource-ppa-pin
@@ -0,0 +1,3 @@
+Package: *
+Pin: origin deb.nodesource.com
+Pin-Priority: 1001
\ No newline at end of file
diff --git a/provision/core/nodejs/provision.sh b/provision/core/nodejs/provision.sh
index e6975007b..129ae5626 100644
--- a/provision/core/nodejs/provision.sh
+++ b/provision/core/nodejs/provision.sh
@@ -3,12 +3,21 @@
set -eo pipefail
function nodejs_register_packages() {
- cp -f "/srv/provision/core/nodejs/sources.list" "/etc/apt/sources.list.d/vvv-nodejs-sources.list"
+ local OSID=$(lsb_release --id --short)
+ local OSCODENAME=$(lsb_release --codename --short)
+ local APTSOURCE="/srv/provision/core/nodejs/sources-${OSID,,}-${OSCODENAME,,}.list"
+ if [ -f "${APTSOURCE}" ]; then
+ cp -f "${APTSOURCE}" "/etc/apt/sources.list.d/vvv-nodejs-sources.list"
+ else
+ vvv_error " ! VVV could not copy an Apt source file ( ${APTSOURCE} ), the current OS/Version (${OSID,,}-${OSCODENAME,,}) combination is unavailable"
+ fi
+
+ cp -f "/srv/provision/core/nodejs/nodesource-ppa-pin" "/etc/apt/preferences.d/nodesource-ppa-pin"
if ! vvv_apt_keys_has 'NodeSource'; then
# Retrieve the NodeJS signing key from nodesource.com
vvv_info " * Applying NodeSource NodeJS signing key..."
- apt-key add /srv/config/apt-keys/nodesource.gpg.key
+ apt-key add /srv/provision/core/nodejs/apt-keys/nodesource.gpg.key
fi
VVV_PACKAGE_LIST+=(
@@ -27,15 +36,18 @@ function reinstall_node() {
vvv_info " * Apt autoremove."
apt-get autoremove -y
vvv_info " * Installing Node 14 LTS."
- apt-get install -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew install --fix-missing --fix-broken nodejs
+ apt-get install -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew --fix-missing --fix-broken nodejs
vvv_success " ✓ Reinstalled Node, if you need another version use the nvm utility"
}
function node_setup() {
- if [[ $(nodejs -v | sed -ne 's/[^0-9]*\(\([0-9]\.\)\{0,4\}[0-9][^.]\).*/\1/p') != '14' ]]; then
- vvv_info " * Migrating to Node v14."
- reinstall_node
+ if [[ -f "/usr/bin/node" ]]; then
+ if [[ $(node -v | sed -ne 's/[^0-9]*\(\([0-9]\.\)\{0,4\}[0-9][^.]\).*/\1/p') != '14' ]]; then
+ vvv_info " * Migrating to Node v14."
+ reinstall_node
+ fi
fi
+
if [[ ! -f "/usr/bin/npm" ]]; then
vvv_warn " ! npm is missing in /usr/bin, reinstalling Node"
reinstall_node
diff --git a/provision/core/nodejs/sources.list b/provision/core/nodejs/sources-ubuntu-bionic.list
similarity index 100%
rename from provision/core/nodejs/sources.list
rename to provision/core/nodejs/sources-ubuntu-bionic.list
diff --git a/provision/core/nodejs/sources-ubuntu-focal.list b/provision/core/nodejs/sources-ubuntu-focal.list
new file mode 100644
index 000000000..f481d174b
--- /dev/null
+++ b/provision/core/nodejs/sources-ubuntu-focal.list
@@ -0,0 +1,3 @@
+# Provides Node.js
+deb https://deb.nodesource.com/node_14.x focal main
+deb-src https://deb.nodesource.com/node_14.x focal main
diff --git a/config/apt-keys/ondrej_keyserver_ubuntu.key b/provision/core/php/apt-keys/ondrej_keyserver_ubuntu.key
similarity index 100%
rename from config/apt-keys/ondrej_keyserver_ubuntu.key
rename to provision/core/php/apt-keys/ondrej_keyserver_ubuntu.key
diff --git a/provision/core/php/ondrej-ppa-pin b/provision/core/php/ondrej-ppa-pin
new file mode 100644
index 000000000..e65a45ef3
--- /dev/null
+++ b/provision/core/php/ondrej-ppa-pin
@@ -0,0 +1,7 @@
+Package: *
+Pin: release o=LP-PPA-ondrej-php
+Pin-Priority: 1001
+
+Package: *
+Pin: release o=LP-PPA-varying-vagrant-vagrants-php
+Pin-Priority: 400
diff --git a/provision/core/php/provision.sh b/provision/core/php/provision.sh
index ec937833b..66d916eb4 100644
--- a/provision/core/php/provision.sh
+++ b/provision/core/php/provision.sh
@@ -2,16 +2,23 @@
# @description Installs the default version of PHP
set -eo pipefail
-VVV_BASE_PHPVERSION=${VVV_BASE_PHPVERSION:-"7.3"}
+VVV_BASE_PHPVERSION=${VVV_BASE_PHPVERSION:-"7.4"}
function php_register_packages() {
- if ! vvv_src_list_has "ondrej/php"; then
- cp -f "/srv/provision/core/php/sources.list" "/etc/apt/sources.list.d/vvv-php-sources.list"
+ local OSID=$(lsb_release --id --short)
+ local OSCODENAME=$(lsb_release --codename --short)
+ local APTSOURCE="/srv/provision/core/php/sources-${OSID,,}-${OSCODENAME,,}.list"
+ if [ -f "${APTSOURCE}" ]; then
+ cp -f "${APTSOURCE}" "/etc/apt/sources.list.d/vvv-php-sources.list"
+ else
+ vvv_error " ! VVV could not copy an Apt source file ( ${APTSOURCE} ), the current OS/Version (${OSID,,}-${OSCODENAME,,}) combination is unavailable"
fi
+ cp -f "/srv/provision/core/php/ondrej-ppa-pin" "/etc/apt/preferences.d/ondrej-ppa-pin"
+
if ! vvv_apt_keys_has 'Ondřej'; then
# Apply the PHP signing key
vvv_info " * Applying the Ondřej PHP signing key..."
- apt-key add /srv/config/apt-keys/ondrej_keyserver_ubuntu.key
+ apt-key add /srv/provision/core/php/apt-keys/ondrej_keyserver_ubuntu.key
fi
VVV_PACKAGE_LIST+=(
@@ -29,7 +36,7 @@ function php_register_packages() {
# Extra PHP modules that we find useful
"php-pear"
- "php-pcov"
+ "php${VVV_BASE_PHPVERSION}-pcov"
"php${VVV_BASE_PHPVERSION}-ssh2"
"php${VVV_BASE_PHPVERSION}-yaml"
"php${VVV_BASE_PHPVERSION}-bcmath"
@@ -51,9 +58,9 @@ function php_register_packages() {
imagemagick
)
- # XDebug
+ # Xdebug
VVV_PACKAGE_LIST+=(
- php-xdebug
+ "php${VVV_BASE_PHPVERSION}-xdebug"
)
}
vvv_add_hook before_packages php_register_packages
@@ -70,7 +77,7 @@ function phpfpm_setup() {
cp -f "/srv/config/php-config/php-custom.ini" "/etc/php/${VVV_BASE_PHPVERSION}/fpm/conf.d/php-custom.ini"
fi
fi
-
+
vvv_info " * Checking supplementary PHP configs"
for V in /etc/php/*; do
@@ -126,24 +133,12 @@ function php_nginx_upstream() {
}
vvv_add_hook nginx_upstreams php_nginx_upstream
-function memcached_register_packages() {
+function vvv_php_memcached_register_packages() {
# MemCached
VVV_PACKAGE_LIST+=(
php${VVV_BASE_PHPVERSION}-memcache
php${VVV_BASE_PHPVERSION}-memcached
-
- # memcached is made available for object caching
- memcached
)
}
-vvv_add_hook before_packages memcached_register_packages
-function memcached_setup() {
- # Copy memcached configuration from local
- vvv_info " * Copying /srv/config/memcached-config/memcached.conf to /etc/memcached.conf and /etc/memcached_default.conf"
- cp -f "/srv/config/memcached-config/memcached.conf" "/etc/memcached.conf"
- cp -f "/srv/config/memcached-config/memcached.conf" "/etc/memcached_default.conf"
-}
-vvv_add_hook after_packages memcached_setup 60
-if [ "${VVV_DOCKER}" != 1 ]; then
- vvv_add_hook services_restart "service memcached restart"
-fi
+export -f vvv_php_memcached_register_packages
+vvv_add_hook before_packages vvv_php_memcached_register_packages
diff --git a/provision/core/php/sources.list b/provision/core/php/sources-ubuntu-bionic.list
similarity index 100%
rename from provision/core/php/sources.list
rename to provision/core/php/sources-ubuntu-bionic.list
diff --git a/provision/core/php/sources-ubuntu-focal.list b/provision/core/php/sources-ubuntu-focal.list
new file mode 100644
index 000000000..b7ac3b2bc
--- /dev/null
+++ b/provision/core/php/sources-ubuntu-focal.list
@@ -0,0 +1,3 @@
+# Provides PHP7
+deb http://ppa.launchpad.net/ondrej/php/ubuntu focal main
+deb-src http://ppa.launchpad.net/ondrej/php/ubuntu focal main
diff --git a/provision/core/phpcs/composer.json b/provision/core/phpcs/composer.json
new file mode 100644
index 000000000..d651e08d7
--- /dev/null
+++ b/provision/core/phpcs/composer.json
@@ -0,0 +1,19 @@
+{
+ "name": "vvv/phpcs",
+ "type": "metapackage",
+ "description": "An open source Vagrant configuration for developing with WordPress",
+ "keywords": [
+ "vagrant",
+ "phpcs"
+ ],
+ "homepage": "https://varyingvagrantvagrants.org/",
+ "license": "MIT",
+ "support": {
+ "issues": "https://github.com/Varying-Vagrant-Vagrants/VVV/issues/"
+ },
+ "require": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
+ "automattic/vipwpcs": "^2.2.0",
+ "phpcompatibility/php-compatibility": "^9.3.5"
+ }
+}
diff --git a/provision/core/phpcs/provision.sh b/provision/core/phpcs/provision.sh
index addba65d0..9f1317f66 100644
--- a/provision/core/phpcs/provision.sh
+++ b/provision/core/phpcs/provision.sh
@@ -6,24 +6,28 @@ function php_codesniff_setup() {
export COMPOSER_ALLOW_SUPERUSER=1
export COMPOSER_NO_INTERACTION=1
+ if [[ -f "/srv/www/phpcs/CodeSniffer.conf" ]]; then
+ vvv_info " * Upgrading from old PHPCS setup"
+ rm -rf /srv/www/phpcs
+ fi
+
# PHP_CodeSniffer (for running WordPress-Coding-Standards)
# Sniffs WordPress Coding Standards
- vvv_info " * Install/Update PHP_CodeSniffer (phpcs), see https://github.com/squizlabs/PHP_CodeSniffer"
- vvv_info " * Install/Update WordPress-Coding-Standards, sniffs for PHP_CodeSniffer, see https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards"
- cd /srv/provision/phpcs
- chown -R vagrant:www-data /srv/provision/phpcs
- noroot composer update --no-ansi --no-autoloader --no-progress
+ vvv_info " * Provisioning PHP_CodeSniffer (phpcs), see https://github.com/squizlabs/PHP_CodeSniffer"
+
+ noroot mkdir -p /srv/www/phpcs
+ noroot cp -f "/srv/provision/core/phpcs/composer.json" "/srv/www/phpcs/composer.json"
+ cd /srv/www/phpcs
+ COMPOSER_BIN_DIR="bin" noroot composer update --no-ansi --no-progress
- # Link `phpcbf` and `phpcs` to the `/usr/local/bin` directory so
- # that it can be used on the host in an editor with matching rules
- ln -sf "/srv/www/phpcs/bin/phpcbf" "/usr/local/bin/phpcbf"
- ln -sf "/srv/www/phpcs/bin/phpcs" "/usr/local/bin/phpcs"
+ vvv_info " * Setting WordPress-Core as the default PHPCodesniffer standard"
# Install the standards in PHPCS
- noroot phpcs --config-set installed_paths ./CodeSniffer/Standards/WordPress/,./CodeSniffer/Standards/VIP-Coding-Standards/,./CodeSniffer/Standards/PHPCompatibility/,./CodeSniffer/Standards/PHPCompatibilityParagonie/,./CodeSniffer/Standards/PHPCompatibilityWP/
- noroot phpcs --config-set default_standard WordPress-Core
- noroot phpcs -i
+ noroot /srv/www/phpcs/bin/phpcs --config-set default_standard WordPress-Core
+ vvv_info " * The following PHPCS standards are set up:"
+ noroot /srv/www/phpcs/bin/phpcs -i
+ vvv_success " * PHPCS provisioning has ended"
}
export -f php_codesniff_setup
-vvv_add_hook after_composer php_codesniff_setup
\ No newline at end of file
+vvv_add_hook after_composer php_codesniff_setup
diff --git a/provision/core/postfix/provision.sh b/provision/core/postfix/provision.sh
index 4a961b778..6b58b1cc4 100644
--- a/provision/core/postfix/provision.sh
+++ b/provision/core/postfix/provision.sh
@@ -14,4 +14,4 @@ function postfix_register_packages() {
VVV_PACKAGE_LIST+=(postfix)
}
-vvv_add_hook before_packages postfix_register_packages
\ No newline at end of file
+vvv_add_hook before_packages postfix_register_packages
diff --git a/config/apt-conf-d/99hashmismatch b/provision/core/vvv/apt-conf-d/99hashmismatch
similarity index 100%
rename from config/apt-conf-d/99hashmismatch
rename to provision/core/vvv/apt-conf-d/99hashmismatch
diff --git a/config/apt-keys/varying-vagrant-vagrants_keyserver_ubuntu.key b/provision/core/vvv/apt-keys/varying-vagrant-vagrants_keyserver_ubuntu.key
similarity index 100%
rename from config/apt-keys/varying-vagrant-vagrants_keyserver_ubuntu.key
rename to provision/core/vvv/apt-keys/varying-vagrant-vagrants_keyserver_ubuntu.key
diff --git a/provision/core/vvv/provision.sh b/provision/core/vvv/provision.sh
index 6ba9c8977..ff6fe6cca 100644
--- a/provision/core/vvv/provision.sh
+++ b/provision/core/vvv/provision.sh
@@ -3,14 +3,30 @@
set -eo pipefail
function vvv_register_packages() {
- cp -f "/srv/provision/core/vvv/sources.list" "/etc/apt/sources.list.d/vvv-sources.list"
+ local OSID=$(lsb_release --id --short)
+ local OSCODENAME=$(lsb_release --codename --short)
+ local APTSOURCE="/srv/provision/core/vvv/sources-${OSID,,}-${OSCODENAME,,}.list"
+ if [ -f "${APTSOURCE}" ]; then
+ cp -f "${APTSOURCE}" "/etc/apt/sources.list.d/vvv-sources.list"
+ else
+ vvv_error " ! VVV could not copy an Apt source file ( ${APTSOURCE} ), the current OS/Version (${OSID,,}-${OSCODENAME,,}) combination is unavailable"
+ fi
if ! vvv_apt_keys_has 'Varying Vagrant Vagrants'; then
# Apply the VVV signing key
vvv_info " * Applying the Varying Vagrant Vagrants mirror signing key..."
- apt-key add /srv/config/apt-keys/varying-vagrant-vagrants_keyserver_ubuntu.key
+ apt-key add /srv/provision/core/vvv/apt-keys/varying-vagrant-vagrants_keyserver_ubuntu.key
fi
+ VVV_PACKAGE_REMOVAL_LIST+=(
+ # remove the old Python 2 packages to avoid issues with python3-pip
+ python-pip
+ python-setuptools
+
+ # remove mysql-common to ensure mariadb installation works
+ mysql-common
+ )
+
VVV_PACKAGE_LIST+=(
software-properties-common
@@ -23,8 +39,8 @@ function vvv_register_packages() {
make
vim
colordiff
- python-pip
- python-setuptools
+ python3-pip
+ python3-setuptools
lftp
# ntp service to keep clock current
@@ -38,6 +54,10 @@ function vvv_register_packages() {
# Allows conversion of DOS style line endings to something less troublesome
# in Linux.
dos2unix
+
+ # webp support
+ libwebp-dev
+ webp
)
}
vvv_add_hook before_packages vvv_register_packages 0
@@ -48,8 +68,8 @@ function shyaml_setup() {
# Used for passing custom parameters to the bash provisioning scripts
if [ ! -f /usr/local/bin/shyaml ]; then
vvv_info " * Installing Shyaml for bash provisioning.."
- sudo pip install wheel
- sudo pip install shyaml
+ sudo pip3 install wheel
+ sudo pip3 install shyaml
fi
}
export -f shyaml_setup
@@ -78,8 +98,8 @@ fi
function apt_hash_missmatch_fix() {
if [ ! -f "/etc/apt/apt.conf.d/99hashmismatch" ]; then
- vvv_info " * Copying /srv/config/apt-conf-d/99hashmismatch to /etc/apt/apt.conf.d/99hashmismatch"
- cp -f "/srv/config/apt-conf-d/99hashmismatch" "/etc/apt/apt.conf.d/99hashmismatch"
+ vvv_info " * Copying /srv/provision/core/vvv/apt-conf-d/99hashmismatch to /etc/apt/apt.conf.d/99hashmismatch"
+ cp -f "/srv/provision/core/vvv/apt-conf-d/99hashmismatch" "/etc/apt/apt.conf.d/99hashmismatch"
fi
}
export -f apt_hash_missmatch_fix
diff --git a/provision/core/vvv/sources.list b/provision/core/vvv/sources-ubuntu-bionic.list
similarity index 100%
rename from provision/core/vvv/sources.list
rename to provision/core/vvv/sources-ubuntu-bionic.list
diff --git a/provision/core/vvv/sources-ubuntu-focal.list b/provision/core/vvv/sources-ubuntu-focal.list
new file mode 100644
index 000000000..fbf741d34
--- /dev/null
+++ b/provision/core/vvv/sources-ubuntu-focal.list
@@ -0,0 +1,3 @@
+# VVV mirror packages
+# deb http://ppa.launchpad.net/varying-vagrant-vagrants/php/ubuntu focal main
+# deb-src http://ppa.launchpad.net/varying-vagrant-vagrants/php/ubuntu focal main
diff --git a/provision/core/wp-cli/provision.sh b/provision/core/wp-cli/provision.sh
index 048419b3e..736541016 100644
--- a/provision/core/wp-cli/provision.sh
+++ b/provision/core/wp-cli/provision.sh
@@ -29,13 +29,13 @@ function wp_cli_setup() {
chown vagrant /srv/config/wp-cli/wp-completion.bash
else
vvv_info " * Updating wp-cli..."
- wp --allow-root cli update --nightly --yes
+ noroot wp cli update --nightly --yes
vvv_success " * WP CLI Nightly updated"
fi
if [ "${VVV_DOCKER}" != 1 ]; then
vvv_info " * Installing WP CLI doctor sub-command"
- wp --allow-root package install git@github.com:wp-cli/doctor-command.git
+ noroot wp package install git@github.com:wp-cli/doctor-command.git
vvv_info " * Installed WP CLI doctor sub-command"
fi
}
diff --git a/provision/phpcs/composer.json b/provision/phpcs/composer.json
deleted file mode 100644
index 5a93b4d3b..000000000
--- a/provision/phpcs/composer.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "name": "vvv/phpcs",
- "type": "project",
- "repositories": [
- {
- "type": "github",
- "url": "https://github.com/Automattic/VIP-Coding-Standards.git",
- "no-api": true
- }
- ],
- "require": {
- "oomphinc/composer-installers-extender": "^1.1",
- "wp-coding-standards/wpcs": "*",
- "automattic/vipwpcs": "*",
- "phpcompatibility/php-compatibility": "*",
- "phpcompatibility/phpcompatibility-paragonie": "*",
- "phpcompatibility/phpcompatibility-wp": "*"
- },
- "extra": {
- "installer-types": ["library", "phpcodesniffer-standard"],
- "installer-paths": {
- "/srv/www/phpcs/": ["squizlabs/php_codesniffer"],
- "/srv/www/phpcs/CodeSniffer/Standards/WordPress/": ["wp-coding-standards/wpcs"],
- "/srv/www/phpcs/CodeSniffer/Standards/VIP-Coding-Standards/": ["automattic/vipwpcs"],
- "/srv/www/phpcs/CodeSniffer/Standards/PHPCompatibility/": ["phpcompatibility/php-compatibility"],
- "/srv/www/phpcs/CodeSniffer/Standards/PHPCompatibilityParagonie/": ["phpcompatibility/phpcompatibility-paragonie"],
- "/srv/www/phpcs/CodeSniffer/Standards/PHPCompatibilityWP/": ["phpcompatibility/phpcompatibility-wp"]
- }
- },
- "config": {
- "bin-dir": "scripts"
- }
-}
diff --git a/provision/provision-dashboard.sh b/provision/provision-dashboard.sh
old mode 100644
new mode 100755
index c73fe90ec..f41c8b15d
--- a/provision/provision-dashboard.sh
+++ b/provision/provision-dashboard.sh
@@ -10,16 +10,23 @@ if [[ false != "dashboard" && false != "${REPO}" ]]; then
noroot mkdir -p "${DIR}"
# Clone or pull the resources repository
if [[ ! -d "${DIR}/.git" ]]; then
- vvv_info " * Cloning dashboard from '${REPO}' into '${DIR}' using the '${BRANCH}' branch."
- noroot git clone "${REPO}" --branch "${BRANCH}" "${DIR}" -q
- cd "${DIR}"
- noroot git checkout "${BRANCH}" -q
+ vvv_info " * Cloning dashboard from '${REPO}' into '${DIR}' using the '${BRANCH}' branch."
+
+ # Clone or pull the site repository
+ if noroot git clone --recursive --branch "${BRANCH}" "${REPO}" "${DIR}"; then
+ vvv_success " ✔ Dashboard cloned successfully"
+ else
+ vvv_error " ! Git failed to clone the dashboard. It tried to clone the ${BRANCH} of ${REPO} into ${DIR}${CRESET}"
+ exit 1
+ fi
else
vvv_info " * Updating dashboard on the '${BRANCH}' branch."
- cd "${DIR}"
- noroot git reset "origin/${BRANCH}" --hard -q
- noroot git pull origin "${BRANCH}" -q
- noroot git checkout "${BRANCH}" -q
+ popd "${DIR}"
+ vvv_info " * Fetching origin ${BRANCH}"
+ noroot git fetch origin "${BRANCH}"
+ vvv_info " * performing a hard reset on origin/${BRANCH}"
+ noroot git reset "origin/${BRANCH}" --hard
+ pushd
fi
vvv_warn " * Note that custom dashboards will be going away in a future update, use a site provisioner and a custom host instead such as dashboard.test."
else
diff --git a/provision/provision-helpers.sh b/provision/provision-helpers.sh
old mode 100644
new mode 100755
index 61e8bd6b6..93942579e
--- a/provision/provision-helpers.sh
+++ b/provision/provision-helpers.sh
@@ -59,7 +59,7 @@ export -f containsElement
# @arg $1 string The address to test
# @see check_network_connection_to_host
function network_detection() {
- local url=${1:-"https://ppa.launchpad.net"}
+ local url=${1:-"http://ppa.launchpad.net"}
check_network_connection_to_host "${url}"
}
export -f network_detection
@@ -71,7 +71,7 @@ export -f network_detection
# @exitcode 0 If the address is reachable
# @exitcode 1 If network issues are found
function check_network_connection_to_host() {
- local url=${1:-"https://ppa.launchpad.net"}
+ local url=${1:-"http://ppa.launchpad.net"}
vvv_info " * Testing network connection to ${url}"
# Network Detection
@@ -280,8 +280,8 @@ export -f vvv_info
#
# @arg $1 string The message to print
function vvv_error() {
- local MSG=$(vvv_format_output "${1}")
- echo -e "${MSG}"
+ local MSG=$(vvv_format_output )
+ vvv_output "${1}"
}
export -f vvv_error
@@ -409,16 +409,7 @@ vvv_hook() {
}
export -f vvv_hook
-# @description Installs a selection of packages via `apt`
-# @example
-# vvv_package_install wget curl etc
-vvv_package_install() {
- declare -a packages=($@)
-
- # fix https://github.com/Varying-Vagrant-Vagrants/VVV/issues/2150
- vvv_info " * Cleaning up dpkg lock file"
- rm /var/lib/dpkg/lock*
-
+vvv_apt_update() {
vvv_info " * Updating apt keys"
apt-key update -y
@@ -426,18 +417,21 @@ vvv_package_install() {
vvv_info " * Running apt-get update..."
rm -rf /var/lib/apt/lists/*
apt-get update -y --fix-missing
+}
- # Install required packages
- vvv_info " * Installing apt-get packages..."
-
- # To avoid issues on provisioning and failed apt installation
+vvv_apt_packages_upgrade() {
+ vvv_info " * Upgrading apt packages"
+ vvv_apt_update
dpkg --configure -a
- if ! apt-get -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew install --fix-missing --no-install-recommends --fix-broken ${packages[@]}; then
- vvv_info " * Installing apt-get packages returned a failure code, cleaning up apt caches then exiting"
+ if ! apt-get -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew upgrade --fix-missing --no-install-recommends --fix-broken; then
+ vvv_error " * Upgrading apt packages returned a failure code, cleaning up apt caches then exiting"
apt-get clean -y
return 1
fi
+}
+export -f vvv_apt_packages_upgrade
+vvv_apt_cleanup() {
# Remove unnecessary packages
vvv_info " * Removing unnecessary apt packages..."
apt-get autoremove -y
@@ -445,6 +439,113 @@ vvv_package_install() {
# Clean up apt caches
vvv_info " * Cleaning apt caches..."
apt-get clean -y
+}
+
+# @description Installs a selection of packages via `apt`
+# @example
+# vvv_package_install wget curl etc
+vvv_package_install() {
+ declare -a initialPackages=($@)
+ declare -a packages
+
+ # Ensure packages are not installed before adding them
+ if [ ${#initialPackages[@]} -ne 0 ]; then
+ for package in "${initialPackages[@]}"; do
+ if ! vvv_is_apt_pkg_installed "${package}"; then
+ packages+=("${package}")
+ fi
+ done
+ fi
+
+ if [ ${#packages[@]} -eq 0 ]; then
+ vvv_info " * No apt packages to install"
+ return 0
+ fi
+
+ vvv_cleanup_dpkg_locks
+ vvv_apt_update
+
+ # Install required packages
+ vvv_info " * Installing apt-get packages..."
+
+ # To avoid issues on provisioning and failed apt installation
+ dpkg --configure -a
+ if ! apt-get -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew install --fix-missing --no-install-recommends --fix-broken ${packages[@]}; then
+ vvv_error " * Installing apt-get packages returned a failure code, cleaning up apt caches then exiting"
+ apt-get clean -y
+ return 1
+ fi
+
+ vvv_apt_cleanup
+
+ return 0
+}
+export -f vvv_package_install
+
+# @description checks if an apt package is installed, returns 0 if installed, 1 if not
+# @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)
+
+ if [[ $num -eq 1 ]]; then
+ # it is installed
+ return 0
+ elif [[ $num -gt 1 ]]; then
+ # there is more than one package matching $1
+ return 0
+ fi
+ return 1
+}
+
+# @description cleans up dpkg lock files to avoid provisioning issues
+# based on a fix from https://github.com/Varying-Vagrant-Vagrants/VVV/issues/2150
+vvv_cleanup_dpkg_locks() {
+ vvv_info " * Cleaning up dpkg lock file"
+ lockfiles=(/var/lib/dpkg/lock*)
+ if [ "${#lockfiles[@]}" ]; then
+ rm /var/lib/dpkg/lock*
+ fi
+}
+
+# @description removes a selection of packages via `apt`
+# @example
+# vvv_apt_package_remove wget curl etc
+vvv_apt_package_remove() {
+ declare -a initialPackages=($@)
+ declare -a packages
+
+ # Ensure packages are actually installed before removing them
+ if [ ${#initialPackages[@]} -ne 0 ]; then
+ for package in "${initialPackages[@]}"; do
+ if vvv_is_apt_pkg_installed "${package}"; then
+ packages+=("${package}")
+ fi
+ done
+ fi
+
+ if [ ${#packages[@]} -eq 0 ]; then
+ vvv_info " * No apt packages to remove"
+ return 0
+ fi
+
+ vvv_info " * Removing ${#packages[@]} apt packages: '${packages[@]}'."
+
+ vvv_cleanup_dpkg_locks
+
+ # Install required packages
+ vvv_info " * Removing apt-get packages..."
+
+ # To avoid issues on provisioning and failed apt installation
+ dpkg --configure -a
+ if ! apt-get -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew remove --fix-missing --no-install-recommends --fix-broken ${packages[@]}; then
+ vvv_error " * Removing apt-get packages returned a failure code, cleaning up apt caches then exiting"
+ apt-get clean -y
+ return 1
+ fi
+
+ vvv_apt_cleanup
return 0
}
+export -f vvv_apt_package_remove
diff --git a/provision/provision-site.sh b/provision/provision-site.sh
old mode 100644
new mode 100755
index 9d55f52e6..96dbe6e41
--- a/provision/provision-site.sh
+++ b/provision/provision-site.sh
@@ -88,6 +88,8 @@ function vvv_provision_site_nginx_config() {
local DEST_NGINX_FILE="vvv-auto-${DEST_NGINX_FILE}-$(md5sum <<< "${SITE_NGINX_FILE}" | cut -c1-32).conf"
VVV_HOSTS=$(get_hosts)
+ vvv_info " * VVV is adding an Nginx config from ${SITE_NGINX_FILE}"
+
# 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.
@@ -98,14 +100,14 @@ function vvv_provision_site_nginx_config() {
sed -i "s#{vvv_hosts}#${VVV_HOSTS}#" "/etc/nginx/custom-sites/${DEST_NGINX_FILE}"
if [ 'php' != "${NGINX_UPSTREAM}" ] && [ ! -f "/etc/nginx/upstreams/${NGINX_UPSTREAM}.conf" ]; then
- vvv_warn " * Upstream value '${NGINX_UPSTREAM}' doesn't match a valid upstream. Defaulting to 'php'.${CRESET}"
+ vvv_error " * Upstream value '${NGINX_UPSTREAM}' doesn't match a valid upstream. Defaulting to 'php'.${CRESET}"
NGINX_UPSTREAM='php'
fi
sed -i "s#{upstream}#${NGINX_UPSTREAM}#" "/etc/nginx/custom-sites/${DEST_NGINX_FILE}"
if /srv/config/homebin/is_utility_installed core tls-ca; then
- sed -i "s#{vvv_tls_cert}#ssl_certificate /srv/certificates/${SITE_NAME}/dev.crt;#" "/etc/nginx/custom-sites/${DEST_NGINX_FILE}"
- sed -i "s#{vvv_tls_key}#ssl_certificate_key /srv/certificates/${SITE_NAME}/dev.key;#" "/etc/nginx/custom-sites/${DEST_NGINX_FILE}"
+ sed -i "s#{vvv_tls_cert}#ssl_certificate \"/srv/certificates/${SITE_NAME}/dev.crt\";#" "/etc/nginx/custom-sites/${DEST_NGINX_FILE}"
+ sed -i "s#{vvv_tls_key}#ssl_certificate_key \"/srv/certificates/${SITE_NAME}/dev.key\";#" "/etc/nginx/custom-sites/${DEST_NGINX_FILE}"
else
sed -i "s#{vvv_tls_cert}#\# TLS cert not included as the core tls-ca is not installed#" "/etc/nginx/custom-sites/${DEST_NGINX_FILE}"
sed -i "s#{vvv_tls_key}#\# TLS key not included as the core tls-ca is not installed#" "/etc/nginx/custom-sites/${DEST_NGINX_FILE}"
@@ -182,22 +184,44 @@ function vvv_process_site_hosts() {
# @noargs
function vvv_provision_site_repo() {
if [[ false != "${REPO}" ]]; then
+ vvv_info " * Pulling down the ${BRANCH} branch of ${REPO}"
if [[ -d "${VM_DIR}" ]] && [[ ! -z "$(ls -A "${VM_DIR}")" ]]; then
if [[ -d "${VM_DIR}/.git" ]]; then
- echo " * Updating ${SITE} in ${VM_DIR}..."
+ echo " * Updating ${SITE} provisioner repo in ${VM_DIR} (${REPO}, ${BRANCH})"
+ echo " * Any local changes not present on the server will be discarded in favor of the remote branch"
cd "${VM_DIR}"
- noroot git reset "origin/${BRANCH}" --hard -q
- noroot git pull origin "${BRANCH}" -q
- noroot git checkout "${BRANCH}" -q
+ echo " * Checking that remote origin is ${REPO}"
+ CURRENTORIGIN=$(git remote get-url origin)
+ if [[ "${CURRENTORIGIN}" != "${REPO}" ]]; then
+ vvv_error " ! The site config said to use ${REPO}"
+ vvv_error " ! But the origin remote is actually ${CURRENTORIGIN}"
+ vvv_error " ! Remove the unknown origin remote and re-add it."
+ vvv_error ""
+ vvv_error " ! You can do this by running these commands inside the VM:"
+ vvv_error " "
+ vvv_error " cd ${VM_DIR}"
+ vvv_error " git remote remove origin"
+ vvv_error " git remote add origin ${REPO}"
+ vvv_error " exit"
+ vvv_error " "
+ vvv_error " ! You can get inside the VM using vagrant ssh"
+ vvv_error " "
+ SUCCESS=1
+ return 1
+ fi
+ echo " * Fetching origin ${BRANCH}"
+ noroot git fetch origin "${BRANCH}"
+ echo " * performing a hard reset on origin/${BRANCH}"
+ noroot git reset "origin/${BRANCH}" --hard
+ echo " * Updating provisioner repo complete"
else
vvv_error " ! Problem! A site folder for ${SITE} was found at ${VM_DIR} that doesn't use a site template, but a site template is defined in the config file. Either the config file is mistaken, or a previous attempt to provision has failed, VVV will not try to git clone the site template to avoid data destruction, either remove the folder, or fix the config/config.yml entry${CRESET}"
fi
else
# Clone or pull the site repository
- vvv_info " * Downloading ${SITE}, git cloning from ${REPO} into ${VM_DIR}"
- noroot git clone --recursive --branch "${BRANCH}" "${REPO}" "${VM_DIR}" -q
- if [ $? -eq 0 ]; then
- vvv_success " * ${SITE} Site Template clone successful"
+ vvv_info " * Downloading ${SITE} provisioner, git cloning from ${REPO} into ${VM_DIR}"
+ if noroot git clone --recursive --branch "${BRANCH}" "${REPO}" "${VM_DIR}"; then
+ vvv_success " * ${SITE} provisioner clone successful"
else
vvv_error " ! Git failed to clone the site template for ${SITE}. It tried to clone the ${BRANCH} of ${REPO} into ${VM_DIR}${CRESET}"
vvv_error " ! VVV won't be able to provision ${SITE} without the template. Check that you have permission to access the repo, and that the filesystem is writable${CRESET}"
@@ -220,10 +244,12 @@ function vvv_provision_site_repo() {
# @internal
function vvv_run_site_template_script() {
echo " * Found ${1} at ${2}/${1}"
- ( cd "${2}" && source "${1}" )
- if [ $? -eq 0 ]; then
+ cd "${2}"
+ if source "${1}"; then
+ vvv_info " * sourcing of ${1} reported success"
return 0
else
+ vvv_error " ! sourcing of ${1} reported failure with an error code of ${?}"
return 1
fi
}
@@ -245,8 +271,8 @@ function vvv_provision_site_script() {
vvv_run_site_template_script "vvv-init.sh" "${VM_DIR}"
SUCCESS=$?
else
- vvv_warn " * Warning: A site provisioner was not found at .vvv/vvv-init.conf provision/vvv-init.conf or vvv-init.conf, searching 3 folders down, please be patient..."
- local SITE_INIT_SCRIPTS=$(find "${VM_DIR}" -maxdepth 3 -name 'vvv-init.conf');
+ 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');
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
@@ -271,13 +297,20 @@ function vvv_provision_site_nginx() {
elif [[ -f "${VM_DIR}/vvv-nginx.conf" ]]; then
vvv_provision_site_nginx_config "${SITE}" "${VM_DIR}/vvv-nginx.conf"
else
- vvv_warn " * Warning: An nginx config was not found at .vvv/vvv-nginx.conf provision/vvv-nginx.conf or vvv-nginx.conf, searching 3 folders down, please be patient..."
+ vvv_warn " ! Warning: An nginx config was not found!! VVV needs an Nginx config for the site or it will not know how to serve it."
+ vvv_warn " * VVV searched for an Nginx config in these locations:"
+ vvv_warn " - ${VM_DIR}/.vvv/vvv-nginx.conf"
+ 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');
if [[ -z $NGINX_CONFIGS ]] ; then
vvv_error " ! Error: No nginx config was found, VVV will not know how to serve this site"
exit 1
else
+ vvv_warn " * VVV found Nginx config files in subfolders, move these files to the expected locations to avoid these warnings."
for SITE_CONFIG_FILE in $NGINX_CONFIGS; do
+ vvv_info
vvv_provision_site_nginx_config "${SITE}" "${SITE_CONFIG_FILE}"
done
fi
@@ -286,8 +319,8 @@ function vvv_provision_site_nginx() {
# @description Retrieves a config value for the given site as specified in `config.yml`
#
-# @arg $1 string
-# @arg $2 string
+# @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})
echo "${value}"
@@ -307,6 +340,68 @@ function vvv_clone_site_git_folder() {
noroot git clone --recurse-submodules -j2 "${repo}" "${VVV_PATH_TO_SITE}/${folder}"
}
+# @description Processes a folder sections composer option for a site as specified in `config.yml`
+#
+# @arg $1 string the folder name to process specified in `config.yml`
+function vvv_custom_folder_composer() {
+ local folder="${1}"
+ 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}" "")
+ if [[ "install" == "${key}" ]]; then
+ if [[ "True" == "${value}" ]]; then
+ vvv_info " * Running composer install in ${folder}"
+ noroot composer install
+ fi
+ elif [[ "update" == "${key}" ]]; then
+ if [[ "True" == "${value}" ]]; then
+ vvv_info " * Running composer update in ${folder}"
+ noroot composer update
+ fi
+ elif [[ "
+ project" == "${key}" ]]; then
+ vvv_info " * Running composer create-project ${value} in ${folder}"
+ noroot composer create-project "${value}" .
+ else
+ vvv_warn " * Unknown key in Composer section: ${key} for ${folder}"
+ fi
+ cd -
+ done
+ fi
+}
+
+
+# @description Processes a folder sections npm option for a site as specified in `config.yml`
+#
+# @arg $1 string the folder name to process specified in `config.yml`
+function vvv_custom_folder_npm() {
+ local folder="${1}"
+ 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}" "")
+ if [[ "install" == "${key}" ]]; then
+ if [[ "True" == "${value}" ]]; then
+ vvv_info " * Running npm install in ${folder}"
+ noroot npm install
+ fi
+ elif [[ "update" == "${key}" ]]; then
+ if [[ "True" == "${value}" ]]; then
+ vvv_info " * Running npm update in ${folder}"
+ noroot npm update
+ fi
+ elif [[ "run" == "${key}" ]]; then
+ vvv_info " * Running npm run ${value} in ${folder}"
+ noroot npm run "${value}"
+ else
+ vvv_warn " * Unknown key in NPM section: ${key} for ${folder}"
+ fi
+ cd -
+ done
+ fi
+}
+
# @description Processes a folder sections git option for a site as specified in `config.yml`
#
# @arg $1 string the folder name to process specified in `config.yml`
@@ -322,7 +417,7 @@ function vvv_custom_folder_git() {
if [ ! -d "${VVV_PATH_TO_SITE}/${folder}" ]; then
vvv_clone_site_git_folder "${repo}" "${folder}"
else
- if [[ $overwrite_on_clone = "True" ]]; then
+ if [[ $overwrite_on_clone == "True" ]]; then
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"
@@ -334,14 +429,14 @@ function vvv_custom_folder_git() {
fi
fi
- if [[ $hard_reset = "True" ]]; then
+ if [[ $hard_reset == "True" ]]; then
vvv_info " - resetting git checkout and discarding changes in ${folder}"
cd "${VVV_PATH_TO_SITE}/${folder}"
noroot git reset --hard -q
noroot git checkout -q
cd -
fi
- if [[ $pull = "True" ]]; then
+ if [[ $pull == "True" ]]; then
vvv_info " - runnning git pull in ${folder}"
cd "${VVV_PATH_TO_SITE}/${folder}"
noroot git pull -q
@@ -355,12 +450,20 @@ function vvv_custom_folder_git() {
# @noargs
function vvv_custom_folders() {
if folders=$(shyaml keys -y -q "sites.${SITE_ESCAPED}.folders" < "${VVV_CONFIG}"); then
- for folder in $folders
- do
+ for folder in $folders; do
if [[ $folder != '...' ]]; then
- local gitvcs=$(vvv_get_site_config_value "folders.${folder}.git" "False")
- if [[ $gitvcs != "False" ]]; then
- vvv_custom_folder_git "${folder}"
+ if keys=$(shyaml keys -y -q "sites.${SITE_ESCAPED}.folders.${folder}" < "${VVV_CONFIG}"); then
+ for key in $keys; do
+ if [[ "${key}" == "git" ]]; then
+ vvv_custom_folder_git "${folder}"
+ elif [[ "${key}" == "composer" ]]; then
+ vvv_custom_folder_composer "${folder}"
+ elif [[ "${key}" == "npm" ]]; then
+ vvv_custom_folder_npm "${folder}"
+ else
+ vvv_warn " * Unknown folders sub-parameter ${key} ignoring"
+ fi
+ done
fi
fi
done
@@ -377,16 +480,22 @@ fi
vvv_provision_site_repo
if [[ ! -d "${VM_DIR}" ]]; then
+ vvv_error " "
+ vvv_error " "
vvv_error " ! Error: The ${VM_DIR} folder does not exist, there is nothing to provision for the '${SITE}' site!"
+ vvv_error " ! It is not enough to declare a site, if you do not specify a provisioner repo/site template then you have to create the folder and fill it yourself."
+ vvv_error " ! At a very minimum, VVV needs an Nginx config so it knows how to serve the website"
+ vvv_error " "
+ vvv_error " "
exit 1
fi
vvv_process_site_hosts
-vvv_custom_folders
vvv_provision_site_script
+vvv_custom_folders
vvv_provision_site_nginx
-vvv_info " * Reloading Nginx config files"
+vvv_info " * Reloading Nginx"
service nginx reload
if [ "${SUCCESS}" -ne "0" ]; then
diff --git a/provision/provision-utility-source.sh b/provision/provision-utility-source.sh
old mode 100644
new mode 100755
diff --git a/provision/provision-utility.sh b/provision/provision-utility.sh
old mode 100644
new mode 100755
diff --git a/provision/provision.sh b/provision/provision.sh
index 83cb62e11..ce7953868 100755
--- a/provision/provision.sh
+++ b/provision/provision.sh
@@ -6,7 +6,7 @@
# source bash_aliases before anything else so that PATH is properly configured on
# this shell session
-. "/srv/config/bash_aliases"
+. "/srv/provision/core/env/homedir/.bash_aliases"
# cleanup
mkdir -p /srv/vvv
@@ -21,8 +21,15 @@ rm -f /srv/vvv/version
rm -f /srv/vvv/vvv-custom.yml
rm -f /srv/vvv/config.yml
-touch /srv/vvv/provisioned_at
-echo $(date "+%Y.%m.%d_%H-%M-%S") > /srv/vvv/provisioned_at
+if [ -x "$(command -v ntpdate)" ]; then
+ echo " * Syncing clocks"
+ sudo ntpdate -u ntp.ubuntu.com
+else
+ echo " - skipping ntpdate clock sync, not installed yet"
+fi
+
+touch /vagrant/provisioned_at
+echo $(date "+%Y.%m.%d_%H-%M-%S") > /vagrant/provisioned_at
# copy over version and config files
cp -f /home/vagrant/version /srv/vvv
@@ -40,14 +47,16 @@ sudo chown -R vagrant:vagrant /srv/vvv
export APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1
export VVV_PACKAGE_LIST=()
+export VVV_PACKAGE_REMOVAL_LIST=()
-. "/srv/provision/core/env.sh"
+. "/srv/provision/core/env/provision.sh"
. '/srv/provision/core/deprecated.sh'
. "/srv/provision/core/vvv/provision.sh"
. "/srv/provision/core/git/provision.sh"
. "/srv/provision/core/mariadb/provision.sh"
. "/srv/provision/core/postfix/provision.sh"
. "/srv/provision/core/nginx/provision.sh"
+. "/srv/provision/core/memcached/provision.sh"
. "/srv/provision/core/php/provision.sh"
. "/srv/provision/core/composer/provision.sh"
. "/srv/provision/core/nodejs/provision.sh"
@@ -66,6 +75,14 @@ vvv_hook before_packages
# Package and Tools Install
vvv_info " * Main packages check and install."
+vvv_info " * Checking for apt packages to remove."
+if ! vvv_apt_package_remove ${VVV_PACKAGE_REMOVAL_LIST[@]}; then
+ vvv_error " ! Main packages removal failed, halting provision"
+ exit 1
+fi
+vvv_info " * Upgrading apt packages."
+vvv_apt_packages_upgrade
+vvv_info " * Checking for apt packages to install."
if ! vvv_package_install ${VVV_PACKAGE_LIST[@]}; then
vvv_error " ! Main packages check and install failed, halting provision"
exit 1
diff --git a/provision/provisioners.sh b/provision/provisioners.sh
old mode 100644
new mode 100755
index 133eb1d9d..7da21a37b
--- a/provision/provisioners.sh
+++ b/provision/provisioners.sh
@@ -35,7 +35,7 @@ function provisioner_end() {
vvv_success " ✔ The '${VVV_PROVISIONER_RUNNING}' provisioner completed in ${elapsed} seconds."
rm -f "/srv/vvv/failed_provisioners/provisioner-${VVV_PROVISIONER_RUNNING}"
else
- vvv_error " ! The '${VVV_PROVISIONER_RUNNING}' provisioner ran into problems, check the full log for more details! It completed in ${elapsed} seconds."
+ vvv_error " ! The '${VVV_PROVISIONER_RUNNING}' provisioner ran into problems, the full log is available at '${VVV_CURRENT_LOG_FILE}'. It completed in ${elapsed} seconds."
fi
trap - EXIT
}
diff --git a/version b/version
index 40c341bdc..7c69a55db 100644
--- a/version
+++ b/version
@@ -1 +1 @@
-3.6.0
+3.7.0
diff --git a/www/default/phpinfo/index.php b/www/default/phpinfo/index.php
index 355145969..26ea69dc9 100644
--- a/www/default/phpinfo/index.php
+++ b/www/default/phpinfo/index.php
@@ -4,10 +4,10 @@
*/
?>
@@ -16,10 +16,3 @@
echo '