diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index b88615515..28faf9a10 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -6,20 +6,21 @@ body: - type: dropdown id: version attributes: - label: Are you using the latest stable or develop branch version of VVV? - description: Newer versions of VVV may have fixed your problem already. + label: "Are you using the latest stable or develop branch version of VVV?" + description: "Newer versions of VVV may have fixed your problem already. The `master` branch is unsupported." multiple: false options: - 'Yes (develop)' - 'Yes (stable)' - 'No' + - 'No (unsupported master branch)' - "Don't know" validations: required: true - type: dropdown id: new_or_existng attributes: - label: Is it a new VVV or an existing VVV that used to work? + label: Is it a new VVV, or an existing VVV that used to work? multiple: false options: - 'Existing, worked but now broken' @@ -27,11 +28,23 @@ body: - "Don't know" validations: required: true + - type: dropdown + id: customfiles + attributes: + label: "Did you use a CustomFile?" + description: "Some people add a `CustomFile` to make unsupported vagrant modifications. If you did this you must share what you changed in the issue." + multiple: false + options: + - 'No (default)' + - 'Yes' + - "Don't know" + validations: + required: true - type: textarea attributes: label: Whats the problem? description: | - Be as descriptive as possible!!! + Be as descriptive as possible!!! Include the output log, including lines above and below it. Most of the waiting time is us waiting for issue reporters to share the full log. validations: required: true - type: textarea @@ -43,10 +56,10 @@ body: required: false - type: textarea attributes: - label: VVV Status screen + label: "What is the output of `vagrant status`" render: shell description: | - Run `vagrant status` and copy paste the result here + Run `vagrant status` and copy paste the result here, this has a lot of important debug data, if you do not include it we will still ask for it regardless. placeholder: | __ __ __ __ \ V\ V\ V / v1.2.3 Path:"/Users/janedoe/vvv-local" @@ -64,7 +77,7 @@ body: multiple: false options: - 'Apple MacOS (Intel)' - - 'Apple MacOS (Arm/Apple Silicon)' + - 'Apple MacOS (Arm64/Apple Silicon)' - 'Microsoft Windows' - 'Linux' - 'Other' @@ -76,7 +89,9 @@ body: label: Which provider are you using? multiple: false options: - - 'VirtualBox' + - 'VirtualBox 7' + - 'VirtualBox 6' + - 'VirtualBox 5' - 'Parallels (Intel)' - 'Parallels (Apple Silicon/Arm)' - 'Hyper-V' diff --git a/CHANGELOG.md b/CHANGELOG.md index fafc96405..e35581224 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,22 @@ permalink: /docs/en-US/changelog/ # Changelog +## 3.11.0 ( 2023 March 14th ) + +### Enhancements + +* Added a fallback Nginx config for sites that don't specify a site provisioner ( #2279 ) +* Sites that do not have a provisioner set will have a logs folder created for Nginx logs,and a public_html folder with Nginx rules for WordPress or other PHP applications. The user is responsible for creating a database and installing/placing a site. +* Simplified PHPCS installation bin dir setting ( #2648 ) +* Virtualbox users running `sudo vagrant` commands now get a warning +* Fixed setting of git rebase config for the vagrant nonroot user ( #2658 ) +* Added composer bin directory to path ( #2588 ) + +### Bug Fixes + +* Fixed faulty Vagrant plugin check. +* A fix for setting the PHP version parameter ( #2644 ) + ## 3.10.1 ( 2022 September 10th ) ### Enhancements @@ -14,6 +30,7 @@ permalink: /docs/en-US/changelog/ * VVV will now attempt to test Nginx configs on installation and recover ( #2604 ) * Switched to new launchpad PPA domains with HTTPS ( #2586 ) * Improved the verboseness of the DB import scripts ( #2621 ) +* PHP version parameter for provisioner and Nginx ( #2583 ) ### Bug Fixes diff --git a/Vagrantfile b/Vagrantfile index 3b7fbf1a2..c86ff5bc9 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -8,6 +8,7 @@ VAGRANTFILE_API_VERSION = "2" Vagrant.require_version '>= 2.2.4' require 'yaml' require 'fileutils' +require 'pathname' def sudo_warnings red = "\033[38;5;9m" # 124m" @@ -329,6 +330,18 @@ ENV['LC_ALL'] = 'en_US.UTF-8' Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # VirtualBox config.vm.provider :virtualbox do |v| + unless Vagrant::Util::Platform.windows? + if Process.uid == 0 + machine_id_file=Pathname.new(".vagrant/machines/default/virtualbox/id") + unless machine_id_file.exist?() + puts "#{red} ⚠ DANGER VAGRANT IS RUNNING AS ROOT/SUDO, DO NOT USE SUDO ⚠#{creset}" + puts " ! VVV has detected that the VM has not been created yet, and is running as root/sudo." + puts " ! Do not use sudo with VVV, do not run VVV as a root user. Aborting." + abort( "Aborting Vagrant command to prevent a critical mistake, do not use sudo/root with VVV." ) + end + end + end + v.customize ['modifyvm', :id, '--uartmode1', 'file', File.join(vagrant_dir, 'log/ubuntu-cloudimg-console.log')] v.customize ['modifyvm', :id, '--memory', vvv_config['vm_config']['memory']] v.customize ['modifyvm', :id, '--cpus', vvv_config['vm_config']['cores']] @@ -398,13 +411,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # This is disabled, we had several contributors who ran into issues. # See: https://github.com/Varying-Vagrant-Vagrants/VVV/issues/1551 config.ssh.insert_key = false - - # Default Ubuntu Box - # - # This box is provided by Bento boxes via vagrantcloud.com and is a nicely sized - # box containing the Ubuntu 20.04 Focal 64 bit release. Once this box is downloaded - # to your host computer, it is cached for future use under the specified box name. - config.vm.box = 'bento/ubuntu-20.04' config.vm.box_check_update = false # The Parallels Provider uses a different naming scheme. @@ -432,6 +438,11 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Virtualbox. config.vm.provider :virtualbox do |_v, override| + # Default Ubuntu Box + # + # This box is provided by Bento boxes via vagrantcloud.com and is a nicely sized + # box containing the Ubuntu 20.04 Focal 64 bit release. Once this box is downloaded + # to your host computer, it is cached for future use under the specified box name. override.vm.box = 'bento/ubuntu-20.04' # If we're at a contributor day, switch the base box to the prebuilt one @@ -853,29 +864,29 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # located in the www/ directory and in config/config.yml. # - if Vagrant.has_plugin?('vagrant-goodhosts') + if config.vagrant.plugins.include? 'vagrant-goodhosts' config.goodhosts.aliases = vvv_config['hosts'] config.goodhosts.remove_on_suspend = true - elsif Vagrant.has_plugin?('vagrant-hostsmanager') + + # goodhosts already disables clean by default, but lets enforce this at both ends + config.goodhosts.disable_clean = true + elsif config.vagrant.plugins.include? 'vagrant-hostsmanager' config.hostmanager.aliases = vvv_config['hosts'] config.hostmanager.enabled = true config.hostmanager.manage_host = true config.hostmanager.manage_guest = true config.hostmanager.ignore_private_ip = false config.hostmanager.include_offline = true - elsif Vagrant.has_plugin?('vagrant-hostsupdater') + elsif config.vagrant.plugins.include? 'vagrant-hostsupdater' # Pass the found host names to the hostsupdater plugin so it can perform magic. config.hostsupdater.aliases = vvv_config['hosts'] config.hostsupdater.remove_on_suspend = true - else - show_check = true if %w[up halt resume suspend status provision reload].include? ARGV[0] - if show_check - puts "" - puts " X ! There is no hosts file vagrant plugin installed!" - puts " X You need the vagrant-goodhosts plugin (or HostManager/ HostsUpdater ) for domains to work in the browser" - puts " X Run 'vagrant plugin install --local' to fix this." - puts "" - end + elsif %w[up halt resume suspend status provision reload].include? ARGV[0] + puts "" + puts " X ! There is no hosts file vagrant plugin installed!" + puts " X You need the vagrant-goodhosts plugin (or HostManager/ HostsUpdater ) for domains to work in the browser" + puts " X Run 'vagrant plugin install --local' to fix this." + puts "" end # Vagrant Triggers diff --git a/config/default-config.yml b/config/default-config.yml index 644faf988..f8f0f3505 100644 --- a/config/default-config.yml +++ b/config/default-config.yml @@ -36,6 +36,7 @@ sites: skip_provisioning: false description: "A standard WP install, useful for building plugins, testing things, etc" repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template.git + php: 7.4 # change the PHP version to use for the provision and nginx custom: # locale: it_IT delete_default_plugins: true diff --git a/config/homebin/switch_php_debugmod b/config/homebin/switch_php_debugmod index ccd9233f9..0999a4844 100755 --- a/config/homebin/switch_php_debugmod +++ b/config/homebin/switch_php_debugmod @@ -50,7 +50,7 @@ enable_phpmod() { } is_module_enabled_fpm() { - if [ -f "/var/lib/php/modules/${1}/fpm/enabled_by_admin/${2}" ]; then + if [ -f "/var/lib/php/modules/${1}/fpm/enabled_by_admin/${2}" ] || [ -f "/var/lib/php/modules/${1}/fpm/enabled_by_maint/${2}" ]; then return 0 fi return 1 diff --git a/config/homebin/vvv_restore_php_default b/config/homebin/vvv_restore_php_default index 2e1506e29..ae88fc1e0 100755 --- a/config/homebin/vvv_restore_php_default +++ b/config/homebin/vvv_restore_php_default @@ -1,10 +1,13 @@ #!/bin/bash DEFAULTPHP="7.4" -echo " * Restoring the default PHP CLI version ( ${DEFAULTPHP} )" -update-alternatives --set php "/usr/bin/php${DEFAULTPHP}" -update-alternatives --set phar "/usr/bin/phar${DEFAULTPHP}" -update-alternatives --set phar.phar "/usr/bin/phar.phar${DEFAULTPHP}" -update-alternatives --set phpize "/usr/bin/phpize${DEFAULTPHP}" -update-alternatives --set php-config "/usr/bin/php-config${DEFAULTPHP}" -echo " * Restoration complete" +php_version=$(readlink -f /usr/bin/php) +if [[ $php_version != *"${DEFAULTPHP}"* ]]; then + echo " * Restoring the default PHP CLI version ( ${DEFAULTPHP} )" + update-alternatives --set php "/usr/bin/php${DEFAULTPHP}" + update-alternatives --set phar "/usr/bin/phar${DEFAULTPHP}" + update-alternatives --set phar.phar "/usr/bin/phar.phar${DEFAULTPHP}" + update-alternatives --set phpize "/usr/bin/phpize${DEFAULTPHP}" + update-alternatives --set php-config "/usr/bin/php-config${DEFAULTPHP}" + echo " * Restoration complete" +fi diff --git a/provision/core/deprecated.sh b/provision/core/deprecated.sh index f3f16293e..7e5c94589 100644 --- a/provision/core/deprecated.sh +++ b/provision/core/deprecated.sh @@ -4,7 +4,6 @@ # @description Check if we're on Ubuntu 14 and abort provisioning # @noargs function deprecated_distro() { - local command_exist if ! command -v lsb_release &> /dev/null; then return 0 fi diff --git a/provision/core/env/homedir/.bash_aliases b/provision/core/env/homedir/.bash_aliases index 3393c1949..171672391 100644 --- a/provision/core/env/homedir/.bash_aliases +++ b/provision/core/env/homedir/.bash_aliases @@ -39,6 +39,12 @@ if [ -d "$HOME/.gem/bin" ] ; then fi fi +if [ -d "$HOME/.config/composer/vendor/bin" ] ; then + if [[ $PATH != *"${HOME}/.config/composer/vendor/bin"* ]]; then + export PATH="$PATH:${HOME}/.config/composer/vendor/bin" + fi +fi + # Vagrant scripts if [[ $PATH != *"/srv/config/homebin"* ]]; then export PATH="$PATH:/srv/config/homebin" diff --git a/provision/core/env/homedir/.bash_profile b/provision/core/env/homedir/.bash_profile index 8d67323c2..49c6fc610 100644 --- a/provision/core/env/homedir/.bash_profile +++ b/provision/core/env/homedir/.bash_profile @@ -1,3 +1,4 @@ +#!/usr/bin/env bash # bash_profile # # Symlinked to the vagrant user's home directory. This loads @@ -29,8 +30,8 @@ PS1="${debian_chroot:+($debian_chroot)}${red}\u${green}@${blue}\h${white}:${yell # setup bash prompt if [ -n "$BASH_VERSION" ]; then # include .bash_prompt if it exists - if [ -f "$HOME/.bash_prompt" ]; then - . "$HOME/.bash_prompt" + if [ -f "${HOME}/.bash_prompt" ]; then + . "${HOME}/.bash_prompt" fi fi diff --git a/provision/core/git/provision.sh b/provision/core/git/provision.sh index f8576c575..fcc99e37d 100644 --- a/provision/core/git/provision.sh +++ b/provision/core/git/provision.sh @@ -54,5 +54,9 @@ function git_after_packages() { vvv_info " * Git hasn't been told how to merge branches, setting pull.rebase false for the merge strategy" git config --global pull.rebase false fi + if ! noroot git config --global pull.rebase; then + vvv_info " * Git hasn't been told how to merge branches, setting pull.rebase false for the merge strategy" + noroot git config --global pull.rebase false + fi } vvv_add_hook after_packages git_after_packages diff --git a/provision/core/nginx/config/site-fallback.conf b/provision/core/nginx/config/site-fallback.conf new file mode 100644 index 000000000..bd7e79621 --- /dev/null +++ b/provision/core/nginx/config/site-fallback.conf @@ -0,0 +1,23 @@ +server { + listen 80; + listen 443 ssl http2; + server_name {vvv_hosts}; + root "{vvv_path_to_site}/public_html"; + + # Nginx logs + error_log "{vvv_path_to_site}/log/nginx-error.log"; + access_log "{vvv_path_to_site}/log/nginx-access.log"; + + # Enable server push if SSL/HTTP2 is being used for link preload headers + http2_push_preload on; + + {vvv_tls_cert} + {vvv_tls_key} + + # Nginx rules for WordPress, rewrite rules, permalinks, etc + include /etc/nginx/nginx-wp-common.conf; + + location ~* \.(css|eot|gif|ico|jpeg|jpg|js|png|svg|tiff|tiff|ttf|webp|woff|woff2)$ { + expires 100d; + } +} diff --git a/provision/core/phpcs/composer.json b/provision/core/phpcs/composer.json index 9b19eb76b..b5a018169 100644 --- a/provision/core/phpcs/composer.json +++ b/provision/core/phpcs/composer.json @@ -15,11 +15,12 @@ "dealerdirect/phpcodesniffer-composer-installer": "^0.7.2", "automattic/vipwpcs": "^2.3.3", "phpcompatibility/php-compatibility": "^9.3.5", - "phpcompatibility/phpcompatibility-wp": "^2.1.3" + "phpcompatibility/phpcompatibility-wp": "^2.1.4" }, "config": { "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true - } + }, + "bin-dir": "bin/" } } diff --git a/provision/core/phpcs/provision.sh b/provision/core/phpcs/provision.sh index 5ddb0a730..ea7244149 100644 --- a/provision/core/phpcs/provision.sh +++ b/provision/core/phpcs/provision.sh @@ -19,7 +19,7 @@ function php_codesniff_setup() { noroot mkdir -p /srv/www/phpcs noroot cp -f "/srv/provision/core/phpcs/composer.json" "/srv/www/phpcs/composer.json" cd /srv/www/phpcs - COMPOSER_BIN_DIR="bin" noroot composer update --no-ansi --no-progress + noroot composer update --no-ansi --no-progress --no-dev vvv_info " * [PHPCS]: Setting WordPress-Core as the default PHPCodesniffer standard" diff --git a/provision/provision-helpers.sh b/provision/provision-helpers.sh index 57d5bcf0a..3e5fad11b 100755 --- a/provision/provision-helpers.sh +++ b/provision/provision-helpers.sh @@ -114,16 +114,16 @@ function network_check() { if (( ${#failed_hosts[@]} )); then vvv_error "#################################################################" vvv_error " " - vvv_error "! Network Problem:" + vvv_error "! Warning! Network Problems:" vvv_error " " - vvv_error "VVV tried to check several domains it needs to provision but ${#failed_hosts[@]} of ${#hosts_to_test[@]} failed:" + vvv_error "VVV tried to check several domains it needs for provisioning but ${#failed_hosts[@]} of ${#hosts_to_test[@]} failed:" vvv_error " " for url in "${hosts_to_test[@]}"; do echo -e "${CRESET} [${RED}x${CRESET}] ${url}${RED}|" done vvv_error " " vvv_error "Make sure you have a working internet connection, that you " - vvv_error "restarted after installing VirtualBox and Vagrant, and that " + vvv_error "restarted after installing VirtualBox/Parallels/Vagrant, and that " vvv_error "they aren't blocked by a firewall or security software." vvv_error "If you can load the address in your browser, then VVV should" vvv_error "be able to connect." @@ -136,19 +136,19 @@ function network_check() { vvv_error "provisioning involves downloading things, a full provision may " vvv_error "ruin the wifi for everybody else :(" vvv_error " " - if ! command -v ifconfig &> /dev/null; then + if command -v ifconfig &> /dev/null; then vvv_error "Network ifconfig output:" vvv_error " " ifconfig vvv_error " " fi - vvv_error "Aborting provision. " vvv_error "Try provisioning again once network connectivity is restored." - vvv_error "If that doesn't work, and you're sure you have a strong " + vvv_error "If that doesn't work, and you're sure you have no VPNs and a strong " vvv_error "internet connection, open an issue on GitHub, and include the " vvv_error "output above so that the problem can be debugged" vvv_error " " - vvv_error "vagrant reload --provision" + vvv_error "vagrant halt" + vvv_error "vagrant up --provision" vvv_error " " vvv_error "https://github.com/Varying-Vagrant-Vagrants/VVV/issues" vvv_error " " diff --git a/provision/provision-site.sh b/provision/provision-site.sh old mode 100755 new mode 100644 index 778bd0d03..0fde26da2 --- a/provision/provision-site.sh +++ b/provision/provision-site.sh @@ -23,13 +23,66 @@ NGINX_UPSTREAM=$6 VVV_PATH_TO_SITE=${VM_DIR} # used in site templates VVV_SITE_NAME=${SITE} VVV_HOSTS="" +SUCCESS=0 -SUCCESS=1 +DEFAULTPHP="7.4" VVV_CONFIG=/vagrant/config.yml . "/srv/provision/provisioners.sh" +# @description Retrieves a config value for the given site as specified in `config.yml` +# +# @arg $1 string the config value to fetch +# @arg $2 string the default value +function vvv_get_site_config_value() { + local value=$(shyaml -q get-value "sites.${SITE_ESCAPED}.${1}" "${2}" < ${VVV_CONFIG}) + echo "${value}" +} + +function vvv_get_site_php_version() { + SITE_PHP=$(vvv_get_site_config_value 'php' "${DEFAULTPHP}") + + # remove whitespace + SITE_PHP=$(echo -n "${SITE_PHP}" | xargs | tr -d '\n' | tr -d '\r') + + # Handle when php:8 instead of 8.0 or if it's parsed as a number + if [[ "${#SITE_PHP}" -eq "1" ]]; then + SITE_PHP="${SITE_PHP}.0" + fi + + echo -n "${SITE_PHP}" +} + +vvv_validate_site_php_version() { + SITE_PHP=$(vvv_get_site_php_version) + if [[ "${#SITE_PHP}" > "3" ]]; then + vvv_warn " ! Warning: PHP version defined is using a wrong format: '${SITE_PHP}' with length '${length}'" + vvv_warn " If you are trying to use a more specific version of PHP such as 7.4.1 or 7.4.0 you" + vvv_warn " need to be less specific and use 7.4" + fi + + if [[ ! -e "/usr/bin/php${SITE_PHP}" ]]; then + vvv_warn " ! Warning: Chosen PHP version doesn't exist in this environment: '${SITE_PHP}' looking for '/usr/bin/php${SITE_PHP}'" + fi +} + +# @description sets a sites PHP version as the global version, or to the VVV default if none is specified +# +# @internal +# @noargs +function vvv_apply_site_php_cli_version() { + vvv_validate_site_php_version + SITE_PHP=$(vvv_get_site_php_version) + + echo " * Setting the default PHP CLI version ( ${SITE_PHP} ) for this site" + update-alternatives --set php "/usr/bin/php${SITE_PHP}" &> /dev/null + update-alternatives --set phar "/usr/bin/phar${SITE_PHP}" &> /dev/null + update-alternatives --set phar.phar "/usr/bin/phar.phar${SITE_PHP}" &> /dev/null + update-alternatives --set phpize "/usr/bin/phpize${SITE_PHP}" &> /dev/null + update-alternatives --set php-config "/usr/bin/php-config${SITE_PHP}" &> /dev/null +} + # @description Takes 2 values, a key to fetch a value for, and an optional default value # # @example @@ -84,6 +137,12 @@ function get_primary_host() { function vvv_provision_site_nginx_config() { local SITE_NAME=$1 local SITE_NGINX_FILE=$2 + + local DEST_NGINX_FILE=${SITE_NGINX_FILE//\/srv\/www\//} + DEST_NGINX_FILE=${DEST_NGINX_FILE//\//\-} + DEST_NGINX_FILE=${DEST_NGINX_FILE/%-vvv-nginx.conf/} + DEST_NGINX_FILE="vvv-auto-${DEST_NGINX_FILE}-$(md5sum <<< "${SITE_NGINX_FILE}" | cut -c1-32).conf" + VVV_HOSTS=$(get_hosts) local TMPFILE=$(mktemp /tmp/vvv-site-XXXXX) cat "${SITE_NGINX_FILE}" >> "${TMPFILE}" @@ -99,10 +158,19 @@ function vvv_provision_site_nginx_config() { sed -i "s#{vvv_site_name}#${SITE_NAME}#" "${TMPFILE}" sed -i "s#{vvv_hosts}#${VVV_HOSTS}#" "${TMPFILE}" + # if php: is configured, set the upstream to match + SITE_PHP=$(vvv_get_site_php_version) + if [ "${DEFAULTPHP}" != "${SITE_PHP}" ]; then + NGINX_UPSTREAM="php${SITE_PHP}" + NGINX_UPSTREAM=$(echo "$NGINX_UPSTREAM" | tr --delete .) + fi + + # check if the nginx upstream value has been set and is valid if [ 'php' != "${NGINX_UPSTREAM}" ] && [ ! -f "/etc/nginx/upstreams/${NGINX_UPSTREAM}.conf" ]; then 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}#" "${TMPFILE}" if [ -f "/srv/certificates/${SITE_NAME}/dev.crt" ]; then @@ -121,8 +189,10 @@ function vvv_provision_site_nginx_config() { # "/etc/nginx/custom-sites/${DEST_NGINX_FILE}" local DEST_NGINX_FILE=${SITE_NGINX_FILE//\/srv\/www\//} local DEST_NGINX_FILE=${DEST_NGINX_FILE//\//\-} + local DEST_NGINX_FILE=${DEST_NGINX_FILE//-srv-provision-core-nginx-config-/\-} local DEST_NGINX_FILE=${DEST_NGINX_FILE//-provision/} # remove the provision folder name local DEST_NGINX_FILE=${DEST_NGINX_FILE//-.vvv/} # remove the .vvv folder name + #local DEST_NGINX_FILE=${DEST_NGINX_FILE//\-\-/\-} local DEST_NGINX_FILE=${DEST_NGINX_FILE/%-vvv-nginx.conf/} local DEST_NGINX_FILE="vvv-${DEST_NGINX_FILE}-$(md5sum <<< "${SITE_NGINX_FILE}" | cut -c1-8).conf" @@ -130,6 +200,7 @@ function vvv_provision_site_nginx_config() { vvv_warn " ! This sites nginx config had problems, it may not load. Look at the above errors to diagnose the problem" vvv_info " ! VVV will now continue with provisioning so that other sites have an opportunity to run" fi + vvv_success " * Installed ${DEST_NGINX_FILE}" rm -f "${TMPFILE}" } @@ -311,34 +382,25 @@ 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!! 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 " * VVV searched and did not find 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 + vvv_warn " * VVV did not found an Nginx config file, it will use a fallback config file." + noroot mkdir -p "${VM_DIR}/log" + vvv_provision_site_nginx_config "${SITE}" "/srv/provision/core/nginx/config/site-fallback.conf" 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 fi } -# @description Retrieves a config value for the given site as specified in `config.yml` -# -# @arg $1 string the config value to fetch -# @arg $2 string the default value -function vvv_get_site_config_value() { - local value=$(shyaml -q get-value "sites.${SITE_ESCAPED}.${1}" "${2}" < ${VVV_CONFIG}) - echo "${value}" -} # @description Clones a git repository into a sites sub-folder # @@ -484,6 +546,8 @@ function vvv_custom_folders() { } # ------------------------------- +source /srv/config/homebin/vvv_restore_php_default +vvv_apply_site_php_cli_version if [[ true == "${SKIP_PROVISIONING}" ]]; then vvv_warn " * Skipping provisioning of ${SITE}" @@ -521,4 +585,6 @@ if [ "${SUCCESS}" -ne "0" ]; then exit 1 fi +/srv/config/homebin/vvv_restore_php_default + provisioner_success diff --git a/provision/provisioners.sh b/provision/provisioners.sh index 4a7f1f7aa..657f8762d 100755 --- a/provision/provisioners.sh +++ b/provision/provisioners.sh @@ -37,6 +37,7 @@ function provisioner_end() { else 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 + /srv/config/homebin/vvv_restore_php_default trap - EXIT } diff --git a/version b/version index a8819280c..902b2c90c 100644 --- a/version +++ b/version @@ -1 +1 @@ -3.10.1 \ No newline at end of file +3.11 \ No newline at end of file