From dd9691e21f40b33011fd75d85bd10dc66848156a Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Fri, 30 Sep 2022 09:11:27 +0700 Subject: [PATCH 01/27] Attempt to fix git safe dir issue - wildcard --- provision/core/git/provision.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/provision/core/git/provision.sh b/provision/core/git/provision.sh index f8576c575..d51d76b93 100644 --- a/provision/core/git/provision.sh +++ b/provision/core/git/provision.sh @@ -54,5 +54,17 @@ 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 + git_maybe_wildcard_safe_directory +} + +# @noargs +function git_maybe_wildcard_safe_directory(){ + ( + set -f # noglob / avoid wildcard expansion + cmd=$(set -f;git config --get-all safe.directory) + safe_directories=($cmd) + wildcard_symbol="*" + [[ " ${safe_directories[*]} " =~ " ${wildcard_symbol} " ]] && echo "* already added in git safe.directory" || echo "adding * wildcard to git safe directory" && git config --global --add safe.directory * + ) } vvv_add_hook after_packages git_after_packages From 312aed8328429022df64f9430ccb13f6192534b0 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Fri, 30 Sep 2022 10:23:43 +0700 Subject: [PATCH 02/27] Fix git safe.directory script --- provision/core/git/provision.sh | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/provision/core/git/provision.sh b/provision/core/git/provision.sh index d51d76b93..1062e9b8c 100644 --- a/provision/core/git/provision.sh +++ b/provision/core/git/provision.sh @@ -47,6 +47,20 @@ function git_register_apt_keys() { } vvv_add_hook register_apt_keys git_register_apt_keys +# @noargs +function git_maybe_wildcard_safe_directory() { + # Extensions unable to clone without this + # Notably on Mac Silicon + Docker. Probably related to arm64 thing rather than global issue + # TODO: verify the issue on other setup, conditionally execute if it's not global + vvv_info "* Attempt to add * wildcard to vagrant git safe.directory" + ( + set -f # noglob / avoid wildcard expansion + local safe_directories=($(noroot git config --get-all safe.directory)) + local wildcard_symbol="*" + [[ " ${safe_directories[*]} " =~ " ${wildcard_symbol} " ]] && echo "* already added in git safe.directory" || ( echo "adding * wildcard to git safe directory" && noroot git config --global --add safe.directory * ) + ) +} + # @noargs function git_after_packages() { # if this setting isn't set, git will exit and provisioning will fail @@ -54,17 +68,8 @@ 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 + git_maybe_wildcard_safe_directory } -# @noargs -function git_maybe_wildcard_safe_directory(){ - ( - set -f # noglob / avoid wildcard expansion - cmd=$(set -f;git config --get-all safe.directory) - safe_directories=($cmd) - wildcard_symbol="*" - [[ " ${safe_directories[*]} " =~ " ${wildcard_symbol} " ]] && echo "* already added in git safe.directory" || echo "adding * wildcard to git safe directory" && git config --global --add safe.directory * - ) -} vvv_add_hook after_packages git_after_packages From 3a9de055f66fea170c5223ca3ec0c989771c8121 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 20 Oct 2024 02:36:25 +0700 Subject: [PATCH 03/27] Update mariadb repo to OVH for ubuntu focal - Add OVH url in hosts_to_test ( keep the mariadb.gb.ssimn.org ) --- provision/core/mariadb/sources-ubuntu-focal.list | 6 +++--- provision/provision-helpers.sh | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/provision/core/mariadb/sources-ubuntu-focal.list b/provision/core/mariadb/sources-ubuntu-focal.list index a8bf3ac60..aaf4c2246 100644 --- a/provision/core/mariadb/sources-ubuntu-focal.list +++ b/provision/core/mariadb/sources-ubuntu-focal.list @@ -1,6 +1,6 @@ -# MariaDB 10.11 repository list - created 2024-08-27 19:47 UTC +# MariaDB 10.11 repository list - created 2024-10-19 19:33 UTC # https://mariadb.org/download/ # deb.mariadb.org is a dynamic mirror if your preferred mirror goes offline. See https://mariadb.org/mirrorbits/ for details. # deb [signed-by=/etc/apt/keyrings/mariadb-keyring.pgp] https://deb.mariadb.org/10.11/ubuntu focal main -deb [signed-by=/etc/apt/keyrings/mariadb-keyring.pgp] https://mariadb.gb.ssimn.org/repo/10.11/ubuntu focal main -# deb-src [signed-by=/etc/apt/keyrings/mariadb-keyring.pgp] https://mariadb.gb.ssimn.org/repo/10.11/ubuntu focal main +deb [signed-by=/etc/apt/keyrings/mariadb-keyring.pgp] http://mariadb.mirrors.ovh.net/MariaDB/repo/10.11/ubuntu focal main +# deb-src [signed-by=/etc/apt/keyrings/mariadb-keyring.pgp] http://mariadb.mirrors.ovh.net/MariaDB/repo/10.11/ubuntu focal main diff --git a/provision/provision-helpers.sh b/provision/provision-helpers.sh index a7e0166f6..5a6e7beeb 100755 --- a/provision/provision-helpers.sh +++ b/provision/provision-helpers.sh @@ -103,6 +103,7 @@ function network_check() { "https://getcomposer.org" # composer is used for lots of sites and provisioners "https://packagist.org" # Composer Packages "https://mariadb.gb.ssimn.org" # MariaDB mirror + "http://mariadb.mirrors.ovh.net" # MariaDB mirror[ovh] "http://ports.ubuntu.com/" "https://nginx.org/packages/mainline/" ) From 4c38733b660ef3cefd1b7438fc2296e7f1cf2945 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 20 Oct 2024 03:00:35 +0700 Subject: [PATCH 04/27] Use `mysql` as service name in docker --- config/homebin/vagrant_provision | 14 ++++++-- provision/core/mariadb/provision.sh | 54 +++++++++++++++++++++-------- 2 files changed, 50 insertions(+), 18 deletions(-) diff --git a/config/homebin/vagrant_provision b/config/homebin/vagrant_provision index aab0cde51..eea64f62f 100755 --- a/config/homebin/vagrant_provision +++ b/config/homebin/vagrant_provision @@ -29,10 +29,18 @@ else fi vvv_info " * Restarting MariaDB service" -if sudo service mariadb status > /dev/null; then - sudo service mariadb restart +if [ ! -f /.dockerenv ]; then + if sudo service mariadb status > /dev/null; then + sudo service mariadb restart + else + sudo service mariadb start + fi else - sudo service mariadb start + if sudo service mysql status > /dev/null; then + sudo service mysql restart + else + sudo service mysql start + fi fi if [ ! -f /.dockerenv ]; then diff --git a/provision/core/mariadb/provision.sh b/provision/core/mariadb/provision.sh index bb6a83ef1..7eb46dd0f 100644 --- a/provision/core/mariadb/provision.sh +++ b/provision/core/mariadb/provision.sh @@ -125,8 +125,13 @@ function mysql_setup() { vvv_info " * Copied /srv/provision/core/mariadb/config/debian.cnf to /etc/mysql/debian.cnf" # Due to systemd dependencies, in docker, mysql service is not auto started + # also docker isn't systemd based, so thee service name is different: see: https://mariadb.com/kb/en/systemd/ vs https://mariadb.com/kb/en/sysvinit/ vvv_info " * Ensuring MariaDB service is started" - service mariadb status > /dev/null || service mariadb start + if [ ! -f /.dockerenv ]; then + service mariadb status > /dev/null || service mariadb start + else + service mysql status > /dev/null || service mysql start + fi if [ ! -f /.dockerenv ]; then check_mysql_root_password @@ -135,21 +140,40 @@ function mysql_setup() { # MySQL gives us an error if we restart a non running service, which # happens after a `vagrant halt`. Check to see if it's running before # deciding whether to start or restart. - if service mariadb status > /dev/null; then - vvv_info " * Restarting the mariadb service" - if ! service mariadb restart; then - vvv_error " * Restarting the MariaDB failed! Fetching service status." - service mariadb status - exit 1 - fi + if [ ! -f /.dockerenv ]; then + if service mariadb status > /dev/null; then + vvv_info " * Restarting the mariadb service" + if ! service mariadb restart; then + vvv_error " * Restarting the MariaDB failed! Fetching service status." + service mariadb status + exit 1 + fi + else + vvv_info " * Restarting mariadb service" + service mariadb start + if ! service mariadb start; then + vvv_error " * Starting MariaDB failed! Fetching service status." + service mariadb status + exit 1 + fi + fi else - vvv_info " * Restarting mariadb service" - service mariadb start - if ! service mariadb start; then - vvv_error " * Starting MariaDB failed! Fetching service status." - service mariadb status - exit 1 - fi + if service mysql status > /dev/null; then + vvv_info " * Restarting the mariadb service" + if ! service mysql restart; then + vvv_error " * Restarting the MariaDB failed! Fetching service status." + service mysql status + exit 1 + fi + else + vvv_info " * Restarting mariadb service" + service mysql start + if ! service mysql start; then + vvv_error " * Starting MariaDB failed! Fetching service status." + service mysql status + exit 1 + fi + fi fi # IMPORT SQL From bbcf60dad6d70f1bcde8e887503222f8236f7938 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 20 Oct 2024 03:12:08 +0700 Subject: [PATCH 05/27] Use `mysql` as service name in docker -- vagrant_up --- config/homebin/vagrant_up | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/config/homebin/vagrant_up b/config/homebin/vagrant_up index 3056d9d23..1b7cb3bbe 100755 --- a/config/homebin/vagrant_up +++ b/config/homebin/vagrant_up @@ -37,9 +37,16 @@ if ! sudo service nginx status > /dev/null; then sudo service nginx start fi -if ! sudo service mariadb status > /dev/null; then - vvv_info " * Starting MariaDB service" - sudo service mariadb start + +vvv_info " * Starting MariaDB service" +if [ ! -f /.dockerenv ]; then + if ! sudo service mariadb status > /dev/null; then + sudo service mariadb start + fi +else + if ! sudo service mysql status > /dev/null; then + sudo service mysql start + fi fi vvv_info " * Checking PHP-FPM Services" From 30b8230619533eb25f67003f160835f3ce9899f5 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 20 Oct 2024 04:01:52 +0700 Subject: [PATCH 06/27] Attempt to dynamically get mysql service name --- config/homebin/vagrant_provision | 16 +++------ config/homebin/vagrant_up | 11 +++--- provision/core/mariadb/provision.sh | 54 +++++++++-------------------- provision/provision-helpers.sh | 9 +++++ 4 files changed, 34 insertions(+), 56 deletions(-) diff --git a/config/homebin/vagrant_provision b/config/homebin/vagrant_provision index eea64f62f..dec7ee60a 100755 --- a/config/homebin/vagrant_provision +++ b/config/homebin/vagrant_provision @@ -16,6 +16,8 @@ source /srv/provision/provision-helpers.sh vvv_success " ▷ Post provision script" +mysql_service_name=$(vvv_get_mysql_service_name) + if [[ -f /srv/config/homebin/vagrant_provision_custom ]]; then vvv_info " * Custom vagrant provision script found, executing vagrant_provision_custom" /srv/config/homebin/vagrant_provision_custom @@ -29,19 +31,11 @@ else fi vvv_info " * Restarting MariaDB service" -if [ ! -f /.dockerenv ]; then - if sudo service mariadb status > /dev/null; then - sudo service mariadb restart - else - sudo service mariadb start - fi -else - if sudo service mysql status > /dev/null; then - sudo service mysql restart +if sudo service "${mysql_service_name[@]}" status > /dev/null; then + sudo service "${mysql_service_name[@]}" restart else - sudo service mysql start + sudo service "${mysql_service_name[@]}" start fi -fi if [ ! -f /.dockerenv ]; then if [ -x "$(command -v ntpdate)" ]; then diff --git a/config/homebin/vagrant_up b/config/homebin/vagrant_up index 1b7cb3bbe..1ef5952d8 100755 --- a/config/homebin/vagrant_up +++ b/config/homebin/vagrant_up @@ -22,6 +22,8 @@ TEARS="${CYAN}░${RED}" EYE="${CYAN}█${RED}" URL="\033[4;38;5;3m" +mysql_service_name=$(vvv_get_mysql_service_name) + if [[ -f /srv/config/homebin/vagrant_up_custom ]]; then vvv_info " * Custom vagrant up script found, executing vagrant_up_custom" /srv/config/homebin/vagrant_up_custom @@ -39,13 +41,8 @@ fi vvv_info " * Starting MariaDB service" -if [ ! -f /.dockerenv ]; then - if ! sudo service mariadb status > /dev/null; then - sudo service mariadb start - fi -else - if ! sudo service mysql status > /dev/null; then - sudo service mysql start + if ! sudo service "${mysql_service_name[@]}" status > /dev/null; then + sudo service "${mysql_service_name[@]}" start fi fi diff --git a/provision/core/mariadb/provision.sh b/provision/core/mariadb/provision.sh index 7eb46dd0f..e9db306fd 100644 --- a/provision/core/mariadb/provision.sh +++ b/provision/core/mariadb/provision.sh @@ -126,12 +126,9 @@ function mysql_setup() { # Due to systemd dependencies, in docker, mysql service is not auto started # also docker isn't systemd based, so thee service name is different: see: https://mariadb.com/kb/en/systemd/ vs https://mariadb.com/kb/en/sysvinit/ + mysql_service_name=$(vvv_get_mysql_service_name) vvv_info " * Ensuring MariaDB service is started" - if [ ! -f /.dockerenv ]; then - service mariadb status > /dev/null || service mariadb start - else - service mysql status > /dev/null || service mysql start - fi + service "${mysql_service_name[@]}" status > /dev/null || service "${mysql_service_name[@]}" start if [ ! -f /.dockerenv ]; then check_mysql_root_password @@ -140,40 +137,21 @@ function mysql_setup() { # MySQL gives us an error if we restart a non running service, which # happens after a `vagrant halt`. Check to see if it's running before # deciding whether to start or restart. - if [ ! -f /.dockerenv ]; then - if service mariadb status > /dev/null; then - vvv_info " * Restarting the mariadb service" - if ! service mariadb restart; then - vvv_error " * Restarting the MariaDB failed! Fetching service status." - service mariadb status - exit 1 - fi - else - vvv_info " * Restarting mariadb service" - service mariadb start - if ! service mariadb start; then - vvv_error " * Starting MariaDB failed! Fetching service status." - service mariadb status - exit 1 - fi - fi + if service "${mysql_service_name[@]}" status > /dev/null; then + vvv_info " * Restarting the mariadb service" + if ! service "${mysql_service_name[@]}" restart; then + vvv_error " * Restarting the MariaDB failed! Fetching service status." + service "${mysql_service_name[@]}" status + exit 1 + fi else - if service mysql status > /dev/null; then - vvv_info " * Restarting the mariadb service" - if ! service mysql restart; then - vvv_error " * Restarting the MariaDB failed! Fetching service status." - service mysql status - exit 1 - fi - else - vvv_info " * Restarting mariadb service" - service mysql start - if ! service mysql start; then - vvv_error " * Starting MariaDB failed! Fetching service status." - service mysql status - exit 1 - fi - fi + vvv_info " * Restarting mariadb service" + service "${mysql_service_name[@]}" start + if ! service "${mysql_service_name[@]}" start; then + vvv_error " * Starting MariaDB failed! Fetching service status." + service "${mysql_service_name[@]}" status + exit 1 + fi fi # IMPORT SQL diff --git a/provision/provision-helpers.sh b/provision/provision-helpers.sh index 5a6e7beeb..de5d0b421 100755 --- a/provision/provision-helpers.sh +++ b/provision/provision-helpers.sh @@ -732,3 +732,12 @@ function vvv_search_replace_in_file() { fi } export -f vvv_search_replace_in_file + +# @description Uses service +function vvv_get_mysql_service_name() { + if [ ! -f /etc/init.d/mariadb ]; then + echo "mariadb" + fi + echo "mysql" +} +export -f vvv_get_mysql_service_name From c798cef6f6fb153a722d5022d70947fed45384b7 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 20 Oct 2024 04:04:28 +0700 Subject: [PATCH 07/27] Fix inverted `vvv_get_mysql_service_name` --- provision/provision-helpers.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/provision/provision-helpers.sh b/provision/provision-helpers.sh index de5d0b421..3bc994a84 100755 --- a/provision/provision-helpers.sh +++ b/provision/provision-helpers.sh @@ -733,11 +733,12 @@ function vvv_search_replace_in_file() { } export -f vvv_search_replace_in_file -# @description Uses service +# @description Identify the service name for the MySQL service via /etc/init.d/ contents +# TODO: test on virtualbox function vvv_get_mysql_service_name() { if [ ! -f /etc/init.d/mariadb ]; then - echo "mariadb" + echo "mysql" fi - echo "mysql" + echo "mariadb" } export -f vvv_get_mysql_service_name From 87ba465ada84f66d17f5dea7b3a76506d323c8da Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 20 Oct 2024 04:12:12 +0700 Subject: [PATCH 08/27] Fix syntax issue - Better messages --- config/homebin/vagrant_up | 5 ++--- provision/core/mariadb/provision.sh | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/config/homebin/vagrant_up b/config/homebin/vagrant_up index 1ef5952d8..df7d7678f 100755 --- a/config/homebin/vagrant_up +++ b/config/homebin/vagrant_up @@ -41,9 +41,8 @@ fi vvv_info " * Starting MariaDB service" - if ! sudo service "${mysql_service_name[@]}" status > /dev/null; then - sudo service "${mysql_service_name[@]}" start - fi +if ! sudo service "${mysql_service_name[@]}" status > /dev/null; then + sudo service "${mysql_service_name[@]}" start fi vvv_info " * Checking PHP-FPM Services" diff --git a/provision/core/mariadb/provision.sh b/provision/core/mariadb/provision.sh index e9db306fd..80624055a 100644 --- a/provision/core/mariadb/provision.sh +++ b/provision/core/mariadb/provision.sh @@ -145,7 +145,7 @@ function mysql_setup() { exit 1 fi else - vvv_info " * Restarting mariadb service" + vvv_info " * Starting mariadb service" service "${mysql_service_name[@]}" start if ! service "${mysql_service_name[@]}" start; then vvv_error " * Starting MariaDB failed! Fetching service status." From fb4195630dab9a33c8d5f44ff04d280ae4403278 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 20 Oct 2024 04:15:21 +0700 Subject: [PATCH 09/27] More messages fix --- config/homebin/vagrant_up | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/homebin/vagrant_up b/config/homebin/vagrant_up index df7d7678f..c1cef9114 100755 --- a/config/homebin/vagrant_up +++ b/config/homebin/vagrant_up @@ -31,7 +31,7 @@ if [[ -f /srv/config/homebin/vagrant_up_custom ]]; then fi # /etc/host doesn't survive restart on docker -vvv_info " * Updatin Guest VM /etc/hosts" +vvv_info " * Updating Guest VM /etc/hosts" vvv_update_guest_hosts if ! sudo service nginx status > /dev/null; then From 80275edcfba667d03e319c88a57447e897d0665a Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 20 Oct 2024 05:11:32 +0700 Subject: [PATCH 10/27] Attempt to add more Ubuntu noble repo list --- provision/core/git/sources-ubuntu-noble.list | 3 +++ provision/core/mariadb/sources-ubuntu-noble.list | 4 ++-- provision/core/nginx/sources-ubuntu-noble.list | 3 +++ provision/core/node-ppa/sources-ubuntu-noble.list | 3 +++ provision/core/php/sources-ubuntu-noble.list | 3 +++ 5 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 provision/core/git/sources-ubuntu-noble.list create mode 100644 provision/core/nginx/sources-ubuntu-noble.list create mode 100644 provision/core/node-ppa/sources-ubuntu-noble.list create mode 100644 provision/core/php/sources-ubuntu-noble.list diff --git a/provision/core/git/sources-ubuntu-noble.list b/provision/core/git/sources-ubuntu-noble.list new file mode 100644 index 000000000..e843c2a2a --- /dev/null +++ b/provision/core/git/sources-ubuntu-noble.list @@ -0,0 +1,3 @@ +# git lfs (large file storage plugin for git) +deb https://packagecloud.io/github/git-lfs/ubuntu/ noble main +deb-src https://packagecloud.io/github/git-lfs/ubuntu/ noble main diff --git a/provision/core/mariadb/sources-ubuntu-noble.list b/provision/core/mariadb/sources-ubuntu-noble.list index ae026623b..80cee575e 100644 --- a/provision/core/mariadb/sources-ubuntu-noble.list +++ b/provision/core/mariadb/sources-ubuntu-noble.list @@ -2,5 +2,5 @@ # https://mariadb.org/download/ # deb.mariadb.org is a dynamic mirror if your preferred mirror goes offline. See https://mariadb.org/mirrorbits/ for details. # deb [signed-by=/etc/apt/keyrings/mariadb-keyring.pgp] https://deb.mariadb.org/10.11/ubuntu noble main -deb [signed-by=/etc/apt/keyrings/mariadb-keyring.pgp] https://mariadb.gb.ssimn.org/repo/10.11/ubuntu noble main -# deb-src [signed-by=/etc/apt/keyrings/mariadb-keyring.pgp] https://mariadb.gb.ssimn.org/repo/10.11/ubuntu noble main +deb [signed-by=/etc/apt/keyrings/mariadb-keyring.pgp] http://mariadb.mirrors.ovh.net/MariaDB/repo/10.11/ubuntu noble main +# deb-src [signed-by=/etc/apt/keyrings/mariadb-keyring.pgp] http://mariadb.mirrors.ovh.net/MariaDB/repo/10.11/ubuntu noble main diff --git a/provision/core/nginx/sources-ubuntu-noble.list b/provision/core/nginx/sources-ubuntu-noble.list new file mode 100644 index 000000000..fe30be8cf --- /dev/null +++ b/provision/core/nginx/sources-ubuntu-noble.list @@ -0,0 +1,3 @@ +# Provides Nginx mainline +deb https://nginx.org/packages/mainline/ubuntu/ noble nginx +deb-src https://nginx.org/packages/mainline/ubuntu/ noble nginx diff --git a/provision/core/node-ppa/sources-ubuntu-noble.list b/provision/core/node-ppa/sources-ubuntu-noble.list new file mode 100644 index 000000000..4584b4fe0 --- /dev/null +++ b/provision/core/node-ppa/sources-ubuntu-noble.list @@ -0,0 +1,3 @@ +# Provides Node.js +deb http://deb.nodesource.com/node_14.x noble main +deb-src http://deb.nodesource.com/node_14.x noble main diff --git a/provision/core/php/sources-ubuntu-noble.list b/provision/core/php/sources-ubuntu-noble.list new file mode 100644 index 000000000..579627921 --- /dev/null +++ b/provision/core/php/sources-ubuntu-noble.list @@ -0,0 +1,3 @@ +# Provides PHP +deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu noble main +deb-src https://ppa.launchpadcontent.net/ondrej/php/ubuntu noble main From 8d9dd896c26ec298be79423ba01857951618396f Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 20 Oct 2024 05:24:43 +0700 Subject: [PATCH 11/27] Dummy vvv sources list for noble --- provision/core/vvv/sources-ubuntu-noble.list | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 provision/core/vvv/sources-ubuntu-noble.list diff --git a/provision/core/vvv/sources-ubuntu-noble.list b/provision/core/vvv/sources-ubuntu-noble.list new file mode 100644 index 000000000..93133ed1e --- /dev/null +++ b/provision/core/vvv/sources-ubuntu-noble.list @@ -0,0 +1,3 @@ +# VVV mirror packages +# deb https://ppa.launchpadcontent.net/varying-vagrant-vagrants/php/ubuntu noble main +# deb-src https://ppa.launchpadcontent.net/varying-vagrant-vagrants/php/ubuntu noble main From 237b44721e3f8b27c075749044e87d9247015e3d Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 20 Oct 2024 05:54:04 +0700 Subject: [PATCH 12/27] Attempt to solve shyaml pip install --- provision/core/vvv/provision.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/provision/core/vvv/provision.sh b/provision/core/vvv/provision.sh index b362a41b9..67be9fbed 100644 --- a/provision/core/vvv/provision.sh +++ b/provision/core/vvv/provision.sh @@ -96,8 +96,21 @@ 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 pip3 install wheel - sudo pip3 install shyaml + + local OSVERSION_NUMBER=$(lsb_release lsb_release -sr) + + # Ubuntu 24 making it hard to install pip packages, throwing externally-managed-environment error + # https://stackoverflow.com/a/75722775 + if dpkg --compare-versions "${OSVERSION_NUMBER[@]}" gte "24.04" + then + # to make it available globally this is the last workaround, hopefully it doesn't break the system + # TODO: try to find a better alternative way to install + sudo pip3 install wheel --break-system-packages + sudo pip3 install shyaml --break-system-packages + else + sudo pip3 install wheel + sudo pip3 install shyaml + fi fi } export -f shyaml_setup From 3dc87693c9fec4f198983834e2be9b4ff49f1fc8 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 20 Oct 2024 06:49:20 +0700 Subject: [PATCH 13/27] Fix dpkg version compare relation arg --- provision/core/vvv/provision.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/provision/core/vvv/provision.sh b/provision/core/vvv/provision.sh index 67be9fbed..f152f3d3c 100644 --- a/provision/core/vvv/provision.sh +++ b/provision/core/vvv/provision.sh @@ -101,7 +101,7 @@ function shyaml_setup() { # Ubuntu 24 making it hard to install pip packages, throwing externally-managed-environment error # https://stackoverflow.com/a/75722775 - if dpkg --compare-versions "${OSVERSION_NUMBER[@]}" gte "24.04" + if dpkg --compare-versions "${OSVERSION_NUMBER[@]}" ge "24.04" then # to make it available globally this is the last workaround, hopefully it doesn't break the system # TODO: try to find a better alternative way to install From c7055051520097575ce44ec6c46cf174b5e898c5 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 20 Oct 2024 07:14:54 +0700 Subject: [PATCH 14/27] Allow custom PHP CLI version --- config/default-config.yml | 3 +++ config/homebin/vvv_restore_php_default | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/config/default-config.yml b/config/default-config.yml index 8eb09085c..971ed8ad0 100644 --- a/config/default-config.yml +++ b/config/default-config.yml @@ -146,6 +146,9 @@ general: # GitHub token to use from composer #github_token: xxxxxx + # Set the default version of PHP CLI + # php_cli_version: 8.2 + # Settings for the vagrant plugins supported by VVV vagrant-plugins: disksize: 10GB # requires the disk size vagrant plugin diff --git a/config/homebin/vvv_restore_php_default b/config/homebin/vvv_restore_php_default index 15aca92bd..452395462 100755 --- a/config/homebin/vvv_restore_php_default +++ b/config/homebin/vvv_restore_php_default @@ -1,6 +1,12 @@ #!/usr/bin/env bash -DEFAULTPHP="8.2" +# Load config.yml +VVV_CONFIG=/srv/config/default-config.yml +if [[ -f /srv/config/config.yml ]]; then + VVV_CONFIG=/srv/config/config.yml +fi + +DEFAULTPHP=$(cat ${VVV_CONFIG} | shyaml -q get-value general.php_cli_version "8.2") php_version=$(readlink -f /usr/bin/php) if [[ $php_version != *"${DEFAULTPHP}"* ]]; then echo " * Restoring the default PHP CLI version ( ${DEFAULTPHP} )" From e85f98ad8a5944d5822e6a50959e4227e07c06f4 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 20 Oct 2024 07:15:24 +0700 Subject: [PATCH 15/27] Use ubuntu 24.04 as default image for docker provider --- Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 977eddee1..770d23436 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -480,7 +480,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Docker use image. config.vm.provider :docker do |d, override| - d.image = 'pentatonicfunk/vagrant-ubuntu-base-images:20.04' + d.image = 'pentatonicfunk/vagrant-ubuntu-base-images:24.04' d.has_ssh = true d.ports = [ "80:80" ] # HTTP d.ports += [ "443:443" ] # HTTPS From c72778f7c86e991045d3aa72a7296dff26d73d69 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Sun, 20 Oct 2024 09:39:28 +0700 Subject: [PATCH 16/27] Revert git safe dir setup --- provision/core/git/provision.sh | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/provision/core/git/provision.sh b/provision/core/git/provision.sh index 1062e9b8c..8bf7f08f4 100644 --- a/provision/core/git/provision.sh +++ b/provision/core/git/provision.sh @@ -47,20 +47,6 @@ function git_register_apt_keys() { } vvv_add_hook register_apt_keys git_register_apt_keys -# @noargs -function git_maybe_wildcard_safe_directory() { - # Extensions unable to clone without this - # Notably on Mac Silicon + Docker. Probably related to arm64 thing rather than global issue - # TODO: verify the issue on other setup, conditionally execute if it's not global - vvv_info "* Attempt to add * wildcard to vagrant git safe.directory" - ( - set -f # noglob / avoid wildcard expansion - local safe_directories=($(noroot git config --get-all safe.directory)) - local wildcard_symbol="*" - [[ " ${safe_directories[*]} " =~ " ${wildcard_symbol} " ]] && echo "* already added in git safe.directory" || ( echo "adding * wildcard to git safe directory" && noroot git config --global --add safe.directory * ) - ) -} - # @noargs function git_after_packages() { # if this setting isn't set, git will exit and provisioning will fail @@ -68,8 +54,12 @@ 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 - git_maybe_wildcard_safe_directory + git config --global --add safe.directory '*' + noroot git config --global --add safe.directory '*' } - vvv_add_hook after_packages git_after_packages From 33db168b78436fae3c393194f5dbce72786fcdfb Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Mon, 21 Oct 2024 12:43:45 +0700 Subject: [PATCH 17/27] Fix comments copy in provision/core/mariadb/provision.sh Co-authored-by: Tom J Nowell --- provision/core/mariadb/provision.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/provision/core/mariadb/provision.sh b/provision/core/mariadb/provision.sh index 80624055a..d0c8d8667 100644 --- a/provision/core/mariadb/provision.sh +++ b/provision/core/mariadb/provision.sh @@ -125,7 +125,7 @@ function mysql_setup() { vvv_info " * Copied /srv/provision/core/mariadb/config/debian.cnf to /etc/mysql/debian.cnf" # Due to systemd dependencies, in docker, mysql service is not auto started - # also docker isn't systemd based, so thee service name is different: see: https://mariadb.com/kb/en/systemd/ vs https://mariadb.com/kb/en/sysvinit/ + # also docker isn't systemd based, so the service name is different: see: https://mariadb.com/kb/en/systemd/ vs https://mariadb.com/kb/en/sysvinit/ mysql_service_name=$(vvv_get_mysql_service_name) vvv_info " * Ensuring MariaDB service is started" service "${mysql_service_name[@]}" status > /dev/null || service "${mysql_service_name[@]}" start From 227a983d3ad178a343d92e5016e58481d770307c Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Tue, 29 Oct 2024 17:59:20 +0000 Subject: [PATCH 18/27] Update Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6d302e78..3b308462a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ permalink: /docs/en-US/changelog/ * Provisioner/Hook timings now show milliseconds ( #2735 ) * Added a `skip_site_provisioner_update` option to prevent site provisioners being overwritten by updates ( #2733 ) * Only start services that aren't running in post-up scripts ( #2732 ) +* Upgraded Ubuntu from 20.04 to 24.04 for docker provider ( #2739 ) ### Bug Fixes From 2367444db84af3bcd9333e7bcb49c08b406a520c Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Tue, 29 Oct 2024 17:59:46 +0000 Subject: [PATCH 19/27] Revert "Allow custom PHP CLI version" This reverts commit c7055051520097575ce44ec6c46cf174b5e898c5. --- config/default-config.yml | 3 --- config/homebin/vvv_restore_php_default | 8 +------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/config/default-config.yml b/config/default-config.yml index 971ed8ad0..8eb09085c 100644 --- a/config/default-config.yml +++ b/config/default-config.yml @@ -146,9 +146,6 @@ general: # GitHub token to use from composer #github_token: xxxxxx - # Set the default version of PHP CLI - # php_cli_version: 8.2 - # Settings for the vagrant plugins supported by VVV vagrant-plugins: disksize: 10GB # requires the disk size vagrant plugin diff --git a/config/homebin/vvv_restore_php_default b/config/homebin/vvv_restore_php_default index 452395462..15aca92bd 100755 --- a/config/homebin/vvv_restore_php_default +++ b/config/homebin/vvv_restore_php_default @@ -1,12 +1,6 @@ #!/usr/bin/env bash -# Load config.yml -VVV_CONFIG=/srv/config/default-config.yml -if [[ -f /srv/config/config.yml ]]; then - VVV_CONFIG=/srv/config/config.yml -fi - -DEFAULTPHP=$(cat ${VVV_CONFIG} | shyaml -q get-value general.php_cli_version "8.2") +DEFAULTPHP="8.2" php_version=$(readlink -f /usr/bin/php) if [[ $php_version != *"${DEFAULTPHP}"* ]]; then echo " * Restoring the default PHP CLI version ( ${DEFAULTPHP} )" From 6809d6161ed3aa670867562a4a761199962ffb16 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Tue, 29 Oct 2024 18:00:49 +0000 Subject: [PATCH 20/27] Revert "Fix syntax issue" This reverts commit 87ba465ada84f66d17f5dea7b3a76506d323c8da. --- config/homebin/vagrant_up | 5 +++-- provision/core/mariadb/provision.sh | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config/homebin/vagrant_up b/config/homebin/vagrant_up index c1cef9114..90daf5e46 100755 --- a/config/homebin/vagrant_up +++ b/config/homebin/vagrant_up @@ -41,8 +41,9 @@ fi vvv_info " * Starting MariaDB service" -if ! sudo service "${mysql_service_name[@]}" status > /dev/null; then - sudo service "${mysql_service_name[@]}" start + if ! sudo service "${mysql_service_name[@]}" status > /dev/null; then + sudo service "${mysql_service_name[@]}" start + fi fi vvv_info " * Checking PHP-FPM Services" diff --git a/provision/core/mariadb/provision.sh b/provision/core/mariadb/provision.sh index 80624055a..e9db306fd 100644 --- a/provision/core/mariadb/provision.sh +++ b/provision/core/mariadb/provision.sh @@ -145,7 +145,7 @@ function mysql_setup() { exit 1 fi else - vvv_info " * Starting mariadb service" + vvv_info " * Restarting mariadb service" service "${mysql_service_name[@]}" start if ! service "${mysql_service_name[@]}" start; then vvv_error " * Starting MariaDB failed! Fetching service status." From 2d42d492cf92c442bd25a05b016079b07dcd6862 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Tue, 29 Oct 2024 18:00:53 +0000 Subject: [PATCH 21/27] Revert "Fix inverted `vvv_get_mysql_service_name`" This reverts commit c798cef6f6fb153a722d5022d70947fed45384b7. --- provision/provision-helpers.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/provision/provision-helpers.sh b/provision/provision-helpers.sh index 3bc994a84..de5d0b421 100755 --- a/provision/provision-helpers.sh +++ b/provision/provision-helpers.sh @@ -733,12 +733,11 @@ function vvv_search_replace_in_file() { } export -f vvv_search_replace_in_file -# @description Identify the service name for the MySQL service via /etc/init.d/ contents -# TODO: test on virtualbox +# @description Uses service function vvv_get_mysql_service_name() { if [ ! -f /etc/init.d/mariadb ]; then - echo "mysql" + echo "mariadb" fi - echo "mariadb" + echo "mysql" } export -f vvv_get_mysql_service_name From 754ac1545a53d2bd4d89bfce652f64addd58e3ca Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Tue, 29 Oct 2024 18:00:59 +0000 Subject: [PATCH 22/27] Revert "Attempt to dynamically get mysql service name" This reverts commit 30b8230619533eb25f67003f160835f3ce9899f5. --- config/homebin/vagrant_provision | 16 ++++++--- config/homebin/vagrant_up | 11 +++--- provision/core/mariadb/provision.sh | 54 ++++++++++++++++++++--------- provision/provision-helpers.sh | 9 ----- 4 files changed, 56 insertions(+), 34 deletions(-) diff --git a/config/homebin/vagrant_provision b/config/homebin/vagrant_provision index dec7ee60a..eea64f62f 100755 --- a/config/homebin/vagrant_provision +++ b/config/homebin/vagrant_provision @@ -16,8 +16,6 @@ source /srv/provision/provision-helpers.sh vvv_success " ▷ Post provision script" -mysql_service_name=$(vvv_get_mysql_service_name) - if [[ -f /srv/config/homebin/vagrant_provision_custom ]]; then vvv_info " * Custom vagrant provision script found, executing vagrant_provision_custom" /srv/config/homebin/vagrant_provision_custom @@ -31,11 +29,19 @@ else fi vvv_info " * Restarting MariaDB service" -if sudo service "${mysql_service_name[@]}" status > /dev/null; then - sudo service "${mysql_service_name[@]}" restart +if [ ! -f /.dockerenv ]; then + if sudo service mariadb status > /dev/null; then + sudo service mariadb restart + else + sudo service mariadb start + fi +else + if sudo service mysql status > /dev/null; then + sudo service mysql restart else - sudo service "${mysql_service_name[@]}" start + sudo service mysql start fi +fi if [ ! -f /.dockerenv ]; then if [ -x "$(command -v ntpdate)" ]; then diff --git a/config/homebin/vagrant_up b/config/homebin/vagrant_up index 90daf5e46..901ecc7c9 100755 --- a/config/homebin/vagrant_up +++ b/config/homebin/vagrant_up @@ -22,8 +22,6 @@ TEARS="${CYAN}░${RED}" EYE="${CYAN}█${RED}" URL="\033[4;38;5;3m" -mysql_service_name=$(vvv_get_mysql_service_name) - if [[ -f /srv/config/homebin/vagrant_up_custom ]]; then vvv_info " * Custom vagrant up script found, executing vagrant_up_custom" /srv/config/homebin/vagrant_up_custom @@ -41,8 +39,13 @@ fi vvv_info " * Starting MariaDB service" - if ! sudo service "${mysql_service_name[@]}" status > /dev/null; then - sudo service "${mysql_service_name[@]}" start +if [ ! -f /.dockerenv ]; then + if ! sudo service mariadb status > /dev/null; then + sudo service mariadb start + fi +else + if ! sudo service mysql status > /dev/null; then + sudo service mysql start fi fi diff --git a/provision/core/mariadb/provision.sh b/provision/core/mariadb/provision.sh index e9db306fd..7eb46dd0f 100644 --- a/provision/core/mariadb/provision.sh +++ b/provision/core/mariadb/provision.sh @@ -126,9 +126,12 @@ function mysql_setup() { # Due to systemd dependencies, in docker, mysql service is not auto started # also docker isn't systemd based, so thee service name is different: see: https://mariadb.com/kb/en/systemd/ vs https://mariadb.com/kb/en/sysvinit/ - mysql_service_name=$(vvv_get_mysql_service_name) vvv_info " * Ensuring MariaDB service is started" - service "${mysql_service_name[@]}" status > /dev/null || service "${mysql_service_name[@]}" start + if [ ! -f /.dockerenv ]; then + service mariadb status > /dev/null || service mariadb start + else + service mysql status > /dev/null || service mysql start + fi if [ ! -f /.dockerenv ]; then check_mysql_root_password @@ -137,21 +140,40 @@ function mysql_setup() { # MySQL gives us an error if we restart a non running service, which # happens after a `vagrant halt`. Check to see if it's running before # deciding whether to start or restart. - if service "${mysql_service_name[@]}" status > /dev/null; then - vvv_info " * Restarting the mariadb service" - if ! service "${mysql_service_name[@]}" restart; then - vvv_error " * Restarting the MariaDB failed! Fetching service status." - service "${mysql_service_name[@]}" status - exit 1 - fi + if [ ! -f /.dockerenv ]; then + if service mariadb status > /dev/null; then + vvv_info " * Restarting the mariadb service" + if ! service mariadb restart; then + vvv_error " * Restarting the MariaDB failed! Fetching service status." + service mariadb status + exit 1 + fi + else + vvv_info " * Restarting mariadb service" + service mariadb start + if ! service mariadb start; then + vvv_error " * Starting MariaDB failed! Fetching service status." + service mariadb status + exit 1 + fi + fi else - vvv_info " * Restarting mariadb service" - service "${mysql_service_name[@]}" start - if ! service "${mysql_service_name[@]}" start; then - vvv_error " * Starting MariaDB failed! Fetching service status." - service "${mysql_service_name[@]}" status - exit 1 - fi + if service mysql status > /dev/null; then + vvv_info " * Restarting the mariadb service" + if ! service mysql restart; then + vvv_error " * Restarting the MariaDB failed! Fetching service status." + service mysql status + exit 1 + fi + else + vvv_info " * Restarting mariadb service" + service mysql start + if ! service mysql start; then + vvv_error " * Starting MariaDB failed! Fetching service status." + service mysql status + exit 1 + fi + fi fi # IMPORT SQL diff --git a/provision/provision-helpers.sh b/provision/provision-helpers.sh index de5d0b421..5a6e7beeb 100755 --- a/provision/provision-helpers.sh +++ b/provision/provision-helpers.sh @@ -732,12 +732,3 @@ function vvv_search_replace_in_file() { fi } export -f vvv_search_replace_in_file - -# @description Uses service -function vvv_get_mysql_service_name() { - if [ ! -f /etc/init.d/mariadb ]; then - echo "mariadb" - fi - echo "mysql" -} -export -f vvv_get_mysql_service_name From c544d5a817d6eb879d84bbfad4de3b20e7b5debf Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Tue, 29 Oct 2024 18:01:03 +0000 Subject: [PATCH 23/27] Revert "Use `mysql` as service name in docker -- vagrant_up" This reverts commit bbcf60dad6d70f1bcde8e887503222f8236f7938. --- config/homebin/vagrant_up | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/config/homebin/vagrant_up b/config/homebin/vagrant_up index 901ecc7c9..606291dee 100755 --- a/config/homebin/vagrant_up +++ b/config/homebin/vagrant_up @@ -37,16 +37,9 @@ if ! sudo service nginx status > /dev/null; then sudo service nginx start fi - -vvv_info " * Starting MariaDB service" -if [ ! -f /.dockerenv ]; then - if ! sudo service mariadb status > /dev/null; then - sudo service mariadb start - fi -else - if ! sudo service mysql status > /dev/null; then - sudo service mysql start - fi +if ! sudo service mariadb status > /dev/null; then + vvv_info " * Starting MariaDB service" + sudo service mariadb start fi vvv_info " * Checking PHP-FPM Services" From 196887e81ff76702c435390dbda0363e430a7bfb Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Tue, 29 Oct 2024 18:01:09 +0000 Subject: [PATCH 24/27] Revert "Use `mysql` as service name in docker" This reverts commit 4c38733b660ef3cefd1b7438fc2296e7f1cf2945. --- config/homebin/vagrant_provision | 14 ++------ provision/core/mariadb/provision.sh | 54 ++++++++--------------------- 2 files changed, 18 insertions(+), 50 deletions(-) diff --git a/config/homebin/vagrant_provision b/config/homebin/vagrant_provision index eea64f62f..aab0cde51 100755 --- a/config/homebin/vagrant_provision +++ b/config/homebin/vagrant_provision @@ -29,18 +29,10 @@ else fi vvv_info " * Restarting MariaDB service" -if [ ! -f /.dockerenv ]; then - if sudo service mariadb status > /dev/null; then - sudo service mariadb restart - else - sudo service mariadb start - fi +if sudo service mariadb status > /dev/null; then + sudo service mariadb restart else - if sudo service mysql status > /dev/null; then - sudo service mysql restart - else - sudo service mysql start - fi + sudo service mariadb start fi if [ ! -f /.dockerenv ]; then diff --git a/provision/core/mariadb/provision.sh b/provision/core/mariadb/provision.sh index 7eb46dd0f..bb6a83ef1 100644 --- a/provision/core/mariadb/provision.sh +++ b/provision/core/mariadb/provision.sh @@ -125,13 +125,8 @@ function mysql_setup() { vvv_info " * Copied /srv/provision/core/mariadb/config/debian.cnf to /etc/mysql/debian.cnf" # Due to systemd dependencies, in docker, mysql service is not auto started - # also docker isn't systemd based, so thee service name is different: see: https://mariadb.com/kb/en/systemd/ vs https://mariadb.com/kb/en/sysvinit/ vvv_info " * Ensuring MariaDB service is started" - if [ ! -f /.dockerenv ]; then - service mariadb status > /dev/null || service mariadb start - else - service mysql status > /dev/null || service mysql start - fi + service mariadb status > /dev/null || service mariadb start if [ ! -f /.dockerenv ]; then check_mysql_root_password @@ -140,40 +135,21 @@ function mysql_setup() { # MySQL gives us an error if we restart a non running service, which # happens after a `vagrant halt`. Check to see if it's running before # deciding whether to start or restart. - if [ ! -f /.dockerenv ]; then - if service mariadb status > /dev/null; then - vvv_info " * Restarting the mariadb service" - if ! service mariadb restart; then - vvv_error " * Restarting the MariaDB failed! Fetching service status." - service mariadb status - exit 1 - fi - else - vvv_info " * Restarting mariadb service" - service mariadb start - if ! service mariadb start; then - vvv_error " * Starting MariaDB failed! Fetching service status." - service mariadb status - exit 1 - fi - fi + if service mariadb status > /dev/null; then + vvv_info " * Restarting the mariadb service" + if ! service mariadb restart; then + vvv_error " * Restarting the MariaDB failed! Fetching service status." + service mariadb status + exit 1 + fi else - if service mysql status > /dev/null; then - vvv_info " * Restarting the mariadb service" - if ! service mysql restart; then - vvv_error " * Restarting the MariaDB failed! Fetching service status." - service mysql status - exit 1 - fi - else - vvv_info " * Restarting mariadb service" - service mysql start - if ! service mysql start; then - vvv_error " * Starting MariaDB failed! Fetching service status." - service mysql status - exit 1 - fi - fi + vvv_info " * Restarting mariadb service" + service mariadb start + if ! service mariadb start; then + vvv_error " * Starting MariaDB failed! Fetching service status." + service mariadb status + exit 1 + fi fi # IMPORT SQL From 3e6aec59c79237969e9b1387e38bea3f90c97576 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Tue, 29 Oct 2024 18:37:53 +0000 Subject: [PATCH 25/27] Minor script adjustment https://github.com/Varying-Vagrant-Vagrants/VVV/pull/2739#discussion_r1807869662 --- provision/core/vvv/provision.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/provision/core/vvv/provision.sh b/provision/core/vvv/provision.sh index f152f3d3c..054c96f35 100644 --- a/provision/core/vvv/provision.sh +++ b/provision/core/vvv/provision.sh @@ -97,7 +97,8 @@ function shyaml_setup() { if [ ! -f /usr/local/bin/shyaml ]; then vvv_info " * Installing Shyaml for bash provisioning.." - local OSVERSION_NUMBER=$(lsb_release lsb_release -sr) + local OSVERSION_NUMBER + OSVERSION_NUMBER=$(lsb_release lsb_release -sr) # Ubuntu 24 making it hard to install pip packages, throwing externally-managed-environment error # https://stackoverflow.com/a/75722775 From a6b4f7f8e434eca9c8aa0fc1e358d7cf1de9a5dc Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Tue, 29 Oct 2024 19:25:04 +0000 Subject: [PATCH 26/27] Revert "Minor script adjustment https://github.com/Varying-Vagrant-Vagrants/VVV/pull/2739#discussion_r1807869662" This reverts commit 3e6aec59c79237969e9b1387e38bea3f90c97576. --- provision/core/vvv/provision.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/provision/core/vvv/provision.sh b/provision/core/vvv/provision.sh index 054c96f35..f152f3d3c 100644 --- a/provision/core/vvv/provision.sh +++ b/provision/core/vvv/provision.sh @@ -97,8 +97,7 @@ function shyaml_setup() { if [ ! -f /usr/local/bin/shyaml ]; then vvv_info " * Installing Shyaml for bash provisioning.." - local OSVERSION_NUMBER - OSVERSION_NUMBER=$(lsb_release lsb_release -sr) + local OSVERSION_NUMBER=$(lsb_release lsb_release -sr) # Ubuntu 24 making it hard to install pip packages, throwing externally-managed-environment error # https://stackoverflow.com/a/75722775 From 88418dd60bcee562ee5027564abe933b500ac571 Mon Sep 17 00:00:00 2001 From: Hendrawan Kuncoro Date: Fri, 15 Nov 2024 15:19:33 +0000 Subject: [PATCH 27/27] Improve OS version number check on `shyaml_setup` --- provision/core/vvv/provision.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/provision/core/vvv/provision.sh b/provision/core/vvv/provision.sh index f152f3d3c..9d3022344 100644 --- a/provision/core/vvv/provision.sh +++ b/provision/core/vvv/provision.sh @@ -97,7 +97,8 @@ function shyaml_setup() { if [ ! -f /usr/local/bin/shyaml ]; then vvv_info " * Installing Shyaml for bash provisioning.." - local OSVERSION_NUMBER=$(lsb_release lsb_release -sr) + local OSVERSION_NUMBER + OSVERSION_NUMBER=$(lsb_release -sr) # Ubuntu 24 making it hard to install pip packages, throwing externally-managed-environment error # https://stackoverflow.com/a/75722775