Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Docker Image to Ubuntu 24.04 ( Noble ) #2739

Open
wants to merge 39 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
5b3aa20
Merge branch 'develop' into stable
tomjn Sep 10, 2022
dd9691e
Attempt to fix git safe dir issue
pentatonicfunk Sep 30, 2022
312aed8
Fix git safe.directory script
pentatonicfunk Sep 30, 2022
d28080c
Merge pull request #2652 from Varying-Vagrant-Vagrants/develop
tomjn Mar 14, 2023
3b367ce
Merge pull request #2669 from Varying-Vagrant-Vagrants/develop
tomjn May 9, 2023
aee9a69
Merge pull request #2684 from Varying-Vagrant-Vagrants/develop
tomjn Aug 3, 2023
f3ef893
Merge branch 'develop' into stable
tomjn Jun 16, 2024
e0dad5d
Merge pull request #2720 from Varying-Vagrant-Vagrants/develop
tomjn Jul 19, 2024
12be863
Merge remote-tracking branch 'upstream/stable' into docker-provider-beta
pentatonicfunk Oct 19, 2024
cfd11ad
Merge remote-tracking branch 'upstream/develop' into docker-provider-…
pentatonicfunk Oct 19, 2024
3a9de05
Update mariadb repo to OVH for ubuntu focal
pentatonicfunk Oct 19, 2024
4c38733
Use `mysql` as service name in docker
pentatonicfunk Oct 19, 2024
bbcf60d
Use `mysql` as service name in docker -- vagrant_up
pentatonicfunk Oct 19, 2024
30b8230
Attempt to dynamically get mysql service name
pentatonicfunk Oct 19, 2024
c798cef
Fix inverted `vvv_get_mysql_service_name`
pentatonicfunk Oct 19, 2024
87ba465
Fix syntax issue
pentatonicfunk Oct 19, 2024
fb41956
More messages fix
pentatonicfunk Oct 19, 2024
80275ed
Attempt to add more Ubuntu noble repo list
pentatonicfunk Oct 19, 2024
8d9dd89
Dummy vvv sources list for noble
pentatonicfunk Oct 19, 2024
237b447
Attempt to solve shyaml pip install
pentatonicfunk Oct 19, 2024
3dc8769
Fix dpkg version compare relation arg
pentatonicfunk Oct 19, 2024
c705505
Allow custom PHP CLI version
pentatonicfunk Oct 20, 2024
e85f98a
Use ubuntu 24.04 as default image for docker provider
pentatonicfunk Oct 20, 2024
c72778f
Revert git safe dir setup
pentatonicfunk Oct 20, 2024
33db168
Fix comments copy in provision/core/mariadb/provision.sh
pentatonicfunk Oct 21, 2024
227a983
Update Changelog
pentatonicfunk Oct 29, 2024
2367444
Revert "Allow custom PHP CLI version"
pentatonicfunk Oct 29, 2024
6809d61
Revert "Fix syntax issue"
pentatonicfunk Oct 29, 2024
2d42d49
Revert "Fix inverted `vvv_get_mysql_service_name`"
pentatonicfunk Oct 29, 2024
754ac15
Revert "Attempt to dynamically get mysql service name"
pentatonicfunk Oct 29, 2024
c544d5a
Revert "Use `mysql` as service name in docker -- vagrant_up"
pentatonicfunk Oct 29, 2024
196887e
Revert "Use `mysql` as service name in docker"
pentatonicfunk Oct 29, 2024
d224835
Merge remote-tracking branch 'upstream/develop' into docker-provider-…
pentatonicfunk Oct 29, 2024
060f8a0
Merge remote-tracking branch 'origin/docker-provider-beta' into docke…
pentatonicfunk Oct 29, 2024
3e6aec5
Minor script adjustment https://github.com/Varying-Vagrant-Vagrants/V…
pentatonicfunk Oct 29, 2024
ebf8675
Merge remote-tracking branch 'origin/docker-provider-beta' into docke…
pentatonicfunk Oct 29, 2024
a6b4f7f
Revert "Minor script adjustment https://github.com/Varying-Vagrant-Va…
pentatonicfunk Oct 29, 2024
0094cb0
Merge remote-tracking branch 'origin/docker-provider-beta' into docke…
pentatonicfunk Oct 29, 2024
88418dd
Improve OS version number check on `shyaml_setup`
pentatonicfunk Nov 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this trigger a VM rebuild for exsting Ubuntu 22 instances that upgrade?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good question, i dont know. it would be vagrant territory, no ? the decision whether docker container need rebuild or not would be based on what vagrant flow will be issued. in any case better to test it, i'll try to test

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

main concerns is if vagrant would kick up a fuss about mismatching images or if it would discard the container ( and the database + data ) to create a new 24 container

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so i tested this, this is how i tested it

use upstream/develop branch

  • Vagrantfile still using 20.04 image
  • do vagrant up --provision
  • verify ubuntu version via vagarant ssh
vagrant@vvv:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.6 LTS
Release:        20.04
Codename:       focal
  • create new post in one.wordpress.test to verify DB okay
image

switch to origin/docker-provider

  • Vagrantfile now 24.4
  • do vagrant halt to stop docker
  • do vagrant reload --provision to trigger reprovision
  • verify ubuntu version via vagarant ssh, expecting the Ubuntu should stay in 20.04
Last login: Fri Nov 15 15:33:51 2024 from 172.17.0.1
vagrant@vvv:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.6 LTS
Release:        20.04
Codename:       focal
  • verify whether DB not discarded ( post still exists )
image

i think this is what we expected, right ?

  • no complains on provisioner
  • container not discarded
  • DB not discarded

i think what we can do is, add somewhere in docs ( if we haven't), if user wants to upgrade their OS is by doing

  • db_backup
  • vagrant destroy
  • vagrant up --provision --> this step will trigger 24.04
  • db_restore

d.has_ssh = true
d.ports = [ "80:80" ] # HTTP
d.ports += [ "443:443" ] # HTTPS
Expand Down
3 changes: 3 additions & 0 deletions config/default-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
pentatonicfunk marked this conversation as resolved.
Show resolved Hide resolved

# Settings for the vagrant plugins supported by VVV
vagrant-plugins:
disksize: 10GB # requires the disk size vagrant plugin
12 changes: 7 additions & 5 deletions config/homebin/vagrant_provision
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -29,11 +31,11 @@ else
fi

vvv_info " * Restarting MariaDB service"
if sudo service mariadb status > /dev/null; then
sudo service mariadb restart
else
sudo service mariadb start
fi
if sudo service "${mysql_service_name[@]}" status > /dev/null; then
sudo service "${mysql_service_name[@]}" restart
else
sudo service "${mysql_service_name[@]}" start
fi
pentatonicfunk marked this conversation as resolved.
Show resolved Hide resolved

if [ ! -f /.dockerenv ]; then
if [ -x "$(command -v ntpdate)" ]; then
Expand Down
11 changes: 7 additions & 4 deletions config/homebin/vagrant_up
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,27 @@ 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
vvv_info " * Custom vagrant up script finished"
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
vvv_info " * Starting Nginx service"
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 ! sudo service "${mysql_service_name[@]}" status > /dev/null; then
sudo service "${mysql_service_name[@]}" start
fi

vvv_info " * Checking PHP-FPM Services"
Expand Down
8 changes: 7 additions & 1 deletion config/homebin/vvv_restore_php_default
Original file line number Diff line number Diff line change
@@ -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} )"
Expand Down
3 changes: 3 additions & 0 deletions provision/core/git/sources-ubuntu-noble.list
Original file line number Diff line number Diff line change
@@ -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
18 changes: 10 additions & 8 deletions provision/core/mariadb/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,10 @@ 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/
pentatonicfunk marked this conversation as resolved.
Show resolved Hide resolved
mysql_service_name=$(vvv_get_mysql_service_name)
vvv_info " * Ensuring MariaDB service is started"
service mariadb status > /dev/null || service mariadb start
service "${mysql_service_name[@]}" status > /dev/null || service "${mysql_service_name[@]}" start

if [ ! -f /.dockerenv ]; then
check_mysql_root_password
Expand All @@ -135,19 +137,19 @@ 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
if service "${mysql_service_name[@]}" status > /dev/null; then
vvv_info " * Restarting the mariadb service"
if ! service mariadb restart; then
if ! service "${mysql_service_name[@]}" restart; then
vvv_error " * Restarting the MariaDB failed! Fetching service status."
service mariadb status
service "${mysql_service_name[@]}" status
exit 1
fi
else
vvv_info " * Restarting mariadb service"
service mariadb start
if ! service mariadb start; then
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."
service mariadb status
service "${mysql_service_name[@]}" status
exit 1
fi
fi
Expand Down
6 changes: 3 additions & 3 deletions provision/core/mariadb/sources-ubuntu-focal.list
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions provision/core/mariadb/sources-ubuntu-noble.list
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions provision/core/nginx/sources-ubuntu-noble.list
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions provision/core/node-ppa/sources-ubuntu-noble.list
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions provision/core/php/sources-ubuntu-noble.list
Original file line number Diff line number Diff line change
@@ -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
17 changes: 15 additions & 2 deletions provision/core/vvv/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shellcheck will probably flag this and a few other things, it should be something like this:

Suggested change
local OSVERSION_NUMBER=$(lsb_release lsb_release -sr)
local OSVERSION_NUMBER
OSVERSION_NUMBER=$(lsb_release lsb_release -sr)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adjusted

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huh, this adjustments causing error for some reason

lsb_release: error: No arguments are permitted

https://github.com/Varying-Vagrant-Vagrants/VVV/actions/runs/11580749924/job/32239965581?pr=2739

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted it to the original changes. the checks / linting seems to be fine: https://github.com/Varying-Vagrant-Vagrants/VVV/actions/runs/11581054132/job/32240928199?pr=2739
and we already doing these kind of local syntax previously: https://github.com/Varying-Vagrant-Vagrants/VVV/blob/develop/provision/core/vvv/provision.sh#L62-L64

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah I think the problem is a mistake on my part, lsb_release vs lsb_release lsb_release

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adjusted, and seems to be ran okay: https://github.com/Varying-Vagrant-Vagrants/VVV/actions/runs/11858839047/job/33050382482?pr=2739
let me know if it needs further adjustments


# 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[@]}" 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there somewhere I can read up on why this happens or where the fix came from? Would be good to have it in the comments, I've created a separate PR for shyaml fixes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Expand Down
3 changes: 3 additions & 0 deletions provision/core/vvv/sources-ubuntu-noble.list
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions provision/provision-helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
)
Expand Down Expand Up @@ -731,3 +732,13 @@ function vvv_search_replace_in_file() {
fi
}
export -f vvv_search_replace_in_file

# @description Identify the service name for the MySQL service via /etc/init.d/ contents
pentatonicfunk marked this conversation as resolved.
Show resolved Hide resolved
# TODO: test on virtualbox
function vvv_get_mysql_service_name() {
if [ ! -f /etc/init.d/mariadb ]; then
echo "mysql"
fi
echo "mariadb"
}
export -f vvv_get_mysql_service_name