Kimai / Ghost / ManageMyDamnLife: Switch to MariaDB (#8712)

Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com>
This commit is contained in:
CanbiZ
2025-10-29 05:06:03 -07:00
committed by GitHub
parent 304de66ec1
commit b9404efc57
5 changed files with 36 additions and 82 deletions

View File

@@ -24,12 +24,9 @@ function update_script() {
check_container_storage
check_container_resources
if ! dpkg-query -W -f='${Status}' mariadb-server 2>/dev/null | grep -q "install ok installed"; then
setup_mysql
fi
NODE_VERSION="22" setup_nodejs
msg_info "Updating ${APP} LXC"
msg_info "Updating Ghost"
if command -v ghost &>/dev/null; then
current_version=$(ghost version | grep 'Ghost-CLI version' | awk '{print $3}')
latest_version=$(npm show ghost-cli version)

View File

@@ -23,32 +23,21 @@ function update_script() {
header_info
check_container_storage
check_container_resources
if ! command -v lsb_release; then
apt install -y lsb-release
fi
if [[ ! -d /opt/kimai ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
CURRENT_PHP=$(php -v 2>/dev/null | awk '/^PHP/{print $2}' | cut -d. -f1,2)
if [[ "$CURRENT_PHP" != "8.4" ]]; then
msg_info "Migrating PHP $CURRENT_PHP to 8.4"
$STD curl -fsSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb
$STD dpkg -i /tmp/debsuryorg-archive-keyring.deb
$STD sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
$STD apt-get update
$STD apt-get remove -y php"${CURRENT_PHP//./}"*
$STD apt-get install -y \
php8.4 composer \
php8.4-{gd,mysql,mbstring,bcmath,xml,curl,zip,intl,fpm} \
libapache2-mod-php8.4
PHP_VERSION="8.4" PHP_MODULE="gd,mysql,mbstring,bcmath,xml,curl,zip,intl,fpm" PHP_APACHE="YES" setup_php
msg_ok "Migrated PHP $CURRENT_PHP to 8.4"
fi
RELEASE=$(curl -fsSL https://api.github.com/repos/kimai/kimai/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
BACKUP_DIR="/opt/kimai_backup"
if check_for_gh_release "Kimai" "kimai/kimai"; then
BACKUP_DIR="/opt/kimai_backup"
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_info "Stopping Apache2"
systemctl stop apache2
msg_ok "Stopped Apache2"
@@ -60,15 +49,9 @@ function update_script() {
[ -f /opt/kimai/config/packages/local.yaml ] && cp /opt/kimai/config/packages/local.yaml "$BACKUP_DIR/"
msg_ok "Backup completed"
msg_info "Updating ${APP} to ${RELEASE}"
trap "echo Unable to download release file for version ${RELEASE}; try again later" ERR
set -e
curl -fsSL "https://github.com/kimai/kimai/archive/refs/tags/${RELEASE}.zip" -o $(basename "https://github.com/kimai/kimai/archive/refs/tags/${RELEASE}.zip")
$STD unzip "${RELEASE}".zip
set +e
trap - ERR
rm -rf /opt/kimai
mv kimai-"${RELEASE}" /opt/kimai
fetch_and_deploy_gh_release "Kimai" "kimai/kimai" "prebuild" "latest" "/opt/kimai" "kimai-release-*.zip"
msg_info "Updating Kimai"
[ -d "$BACKUP_DIR/var" ] && cp -r "$BACKUP_DIR/var" /opt/kimai/
[ -f "$BACKUP_DIR/.env" ] && cp "$BACKUP_DIR/.env" /opt/kimai/
[ -f "$BACKUP_DIR/local.yaml" ] && cp "$BACKUP_DIR/local.yaml" /opt/kimai/config/packages/
@@ -76,8 +59,7 @@ function update_script() {
cd /opt/kimai
$STD composer install --no-dev --optimize-autoloader
$STD bin/console kimai:update
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated ${APP} to ${RELEASE}"
msg_ok "Updated Kimai"
msg_info "Starting Apache2"
systemctl start apache2
@@ -90,14 +72,7 @@ function update_script() {
chown -R www-data:www-data /opt/*
chmod -R 777 /opt/*
msg_ok "Setup Permissions"
msg_info "Cleaning Up"
rm -rf "${RELEASE}".zip
rm -rf "$BACKUP_DIR"
msg_ok "Cleaned"
msg_ok "Updated Successfully"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"
msg_ok "Updated Successfully!"
fi
exit
}