Skip to content

Commit

Permalink
mysql
Browse files Browse the repository at this point in the history
MySQL 8.4 support added.
  • Loading branch information
QROkes committed Jul 29, 2024
1 parent 463e54a commit 10a2e27
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 8 deletions.
17 changes: 15 additions & 2 deletions lib/general
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ readonly php_supported=(7.4 8.0 8.1 8.2 8.3) # https://www.php.net/supported-ver
readonly php_default="8.3"
readonly mariadb_supported=(10.11 11.4) # https://mariadb.com/kb/en/mariadb-server-release-dates/
readonly mariadb_default="11.4"
readonly mysql_supported=(8.0)
readonly mysql_default="8.0"
readonly mysql_supported=(8.0 8.4) # https://endoflife.date/mysql
readonly mysql_default="8.4"
readonly tools_port_default="22222"

# Additional Tools
Expand Down Expand Up @@ -1672,6 +1672,19 @@ check_var() {
}


cpu_arch() {
local arch=$(lscpu | grep "Vendor ID:" | cut -d ":" -f 2 -s | sed 's/^[ \t]*//')

if [[ -n $(echo $arch | grep -oi "ARM") ]]; then
echo "ARM"
elif [[ -n $(echo $arch | grep -oi "Intel") ]]; then
echo "Intel"
else
echo "Unknown"
fi
}


config_fastcgi_cache() {
# This function is used alone by webinoly command.
# For a particular site you can use it as follows:
Expand Down
9 changes: 7 additions & 2 deletions lib/install
Original file line number Diff line number Diff line change
Expand Up @@ -584,9 +584,9 @@ host = localhost
if [[ $(conf_read mysql-reinstall) == "true" && $(conf_read db-engine) != "mysql" ]]; then
echo "${blu}${dim}Seems like you are reinstalling MySQL/MariaDB... Upgrading your old tables!${end}"
$MYSQL_UPGRADE_COMMAND --user=admin --force --silent
conf_delete mysql-reinstall
fi

conf_delete mysql-reinstall
conf_write mysql-optim true
echo "${gre}MySQL/MariaDB has been successfully Optimized by Webinoly! ${end}"
api-events_update im6
Expand Down Expand Up @@ -1088,7 +1088,12 @@ stack_builder() {
if [[ $(conf_read db-engine) == "mysql" ]]; then
[[ -f /usr/share/keyrings/mysql-archive-keyring.gpg && ( ! -s /usr/share/keyrings/mysql-archive-keyring.gpg || -z $(cat -v /usr/share/keyrings/mysql-archive-keyring.gpg | grep -m 1 '[^[:space:]]')) ]] && sudo rm -rf /usr/share/keyrings/mysql-archive-keyring.gpg # Prevent issues!
[[ ! -f /usr/share/keyrings/mysql-archive-keyring.gpg ]] && wget -nv -O- 'https://repo.mysql.com/RPM-GPG-KEY-mysql-2023' | sudo gpg --dearmor -o /usr/share/keyrings/mysql-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/mysql-archive-keyring.gpg] http://repo.mysql.com/apt/ubuntu $(lsb_release -cs) mysql-8.0" | sudo tee /etc/apt/sources.list.d/mysql.list

# Stupid things that are only needed for MySQL.
# Be aware that they like to change names and syntax unexpectedly at anytime.
[[ $(conf_read mysql-ver) == "8.0" ]] && local mysql_repo_name="mysql-$(conf_read mysql-ver)" || local mysql_repo_name="mysql-$(conf_read mysql-ver)-lts"

echo "deb [signed-by=/usr/share/keyrings/mysql-archive-keyring.gpg] http://repo.mysql.com/apt/ubuntu $(lsb_release -cs) ${mysql_repo_name}" | sudo tee /etc/apt/sources.list.d/mysql.list
chmod 644 /usr/share/keyrings/mysql-archive-keyring.gpg

# https://mariadb.org/download/?t=repo-config
Expand Down
5 changes: 3 additions & 2 deletions lib/verify
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,8 @@ if [[ $(conf_read mysql) == "true" || $(conf_read mysql-client) == "true" ]]; th
fi

if [[ $(conf_read mysql) == "true" ]]; then
local ver_mysql_ver=$($MYSQL_COMMAND --version | grep -Eo "[0-9\.]+\-" | cut -f 2 -d' ' | cut -f 1-2 -d'.')
#local ver_mysql_ver=$($MYSQL_COMMAND --version | grep -Eo "[0-9\.]+\-" | cut -f 2 -d' ' | cut -f 1-2 -d'.')
local ver_mysql_ver=$($MYSQL_COMMAND --version | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+" | cut -f 1-2 -d'.')
if [[ $(conf_read db-engine) == "mysql" ]]; then
if [[ -n $($MYSQL_COMMAND --version | grep -Fio "MariaDb") ]]; then
echo "- [ERROR] MySQL DB Engine in Configuration File is corrupted!"
Expand Down Expand Up @@ -803,7 +804,7 @@ if [[ -z $critical_mode ]]; then
fi

# MySQL and MariaDB can be mixed, don't worry!
if ! [[ $ver_mysql_ver =~ ^(8.0|10.0|10.1|10.2|10.3|10.4|10.5|10.6|10.11|11.4)$ ]]; then
if ! [[ $ver_mysql_ver =~ ^(8.0|8.4|10.0|10.1|10.2|10.3|10.4|10.5|10.6|10.11|11.4)$ ]]; then
echo "${dim}- [WARNING] Unknown MySQL/MariaDB version!${end}${red}"
local ver_four_war="1"
elif [[ $ver_mysql_ver =~ ^(10.0|10.1|10.2|10.3|10.4)$ ]]; then
Expand Down
4 changes: 2 additions & 2 deletions templates/general/conf
Original file line number Diff line number Diff line change
Expand Up @@ -467,10 +467,10 @@


# MySQL/MariaDB Version
# Values: https://mariadb.com/kb/en/mariadb-server-release-dates/ (at least latest three stable)
# Values: https://mariadb.com/kb/en/mariadb-server-release-dates/ (LTS)
# Values: https://endoflife.date/mysql (LTS)
# Default: <latest-stable>
# Note: (set before installing, server-reset not needed)
# Note: In case of MySQL, 8.0 is the only supported version.
# Note: NEVER change this value here when MySQL (MariaDB) package is already installed, use the proper command instead.
# Same as: sudo stack -mysql-ver=10.6 (<-This is the proper command to change the MarianDB version even when is already installed)
###########################
Expand Down
10 changes: 10 additions & 0 deletions usr/stack
Original file line number Diff line number Diff line change
Expand Up @@ -650,10 +650,20 @@ elif [[ -n $php ]]; then
[[ $answer = [Yy] || $php == "nginx" ]] && stack_builder nginx php false $build || stack_builder false php false $build

elif [[ -n $mysql ]]; then
if [[ $(conf_read db-engine) == "mysql" && $(cpu_arch) == "ARM" ]]; then
echo "${red}[ERROR] ARM processors are not supported by MySQL!${end}"
exit 1
fi

[[ $(conf_read php) != "true" || $(conf_read nginx) != "true" ]] && build=light
[[ $mysql == "client" ]] && stack_builder false false mysql-client || stack_builder false false mysql $build

elif [[ -n $lemp ]]; then
if [[ $(conf_read db-engine) == "mysql" && $(cpu_arch) == "ARM" ]]; then
echo "${red}[ERROR] ARM processors are not supported by MySQL!${end}"
exit 1
fi

api-events_update st1
stack_builder nginx php mysql $build

Expand Down

0 comments on commit 10a2e27

Please sign in to comment.