mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-11-06 19:32:49 +00:00
Kimai / Ghost / ManageMyDamnLife: Switch to MariaDB (#8712)
Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com>
This commit is contained in:
@@ -20,22 +20,22 @@ $STD apt-get install -y \
|
||||
libjemalloc2
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
setup_mysql
|
||||
setup_mariadb
|
||||
|
||||
msg_info "Configuring Database"
|
||||
DB_NAME=ghost
|
||||
DB_USER=ghostuser
|
||||
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
|
||||
$STD mysql -u root -e "CREATE DATABASE $DB_NAME;"
|
||||
$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';"
|
||||
$STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
|
||||
$STD mariadb -u root -e "CREATE DATABASE $DB_NAME;"
|
||||
$STD mariadb -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';"
|
||||
$STD mariadb -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
|
||||
{
|
||||
echo "Ghost-Credentials"
|
||||
echo "Ghost Database User: $DB_USER"
|
||||
echo "Ghost Database Password: $DB_PASS"
|
||||
echo "Ghost Database Name: $DB_NAME"
|
||||
} >>~/ghost.creds
|
||||
msg_ok "Configured MySQL"
|
||||
msg_ok "Configured MariaDB"
|
||||
|
||||
NODE_VERSION="22" setup_nodejs
|
||||
|
||||
@@ -60,4 +60,5 @@ customize
|
||||
msg_info "Cleaning up"
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
$STD apt-get -y clean
|
||||
msg_ok "Cleaned"
|
||||
|
||||
@@ -18,36 +18,21 @@ $STD apt-get install -y \
|
||||
apt-transport-https \
|
||||
apache2 \
|
||||
git \
|
||||
expect \
|
||||
composer \
|
||||
lsb-release
|
||||
expect
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
setup_mysql
|
||||
|
||||
msg_info "Adding PHP8.4 Repository"
|
||||
$STD curl -sSLo /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
|
||||
msg_ok "Added PHP8.4 Repository"
|
||||
|
||||
msg_info "Installing PHP"
|
||||
$STD apt-get remove -y php8.2*
|
||||
$STD apt-get install -y \
|
||||
php8.4 \
|
||||
php8.4-{gd,mysql,mbstring,bcmath,xml,curl,zip,intl} \
|
||||
libapache2-mod-php8.4
|
||||
msg_ok "Installed PHP"
|
||||
setup_mariadb
|
||||
PHP_VERSION="8.4" PHP_MODULE="gd,mysql,mbstring,bcmath,xml,curl,zip,intl" PHP_APACHE="YES" setup_php
|
||||
setup_composer
|
||||
|
||||
msg_info "Setting up database"
|
||||
DB_NAME=kimai_db
|
||||
DB_USER=kimai
|
||||
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
|
||||
MYSQL_VERSION=$(mysql --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
|
||||
$STD mysql -u root -e "CREATE DATABASE $DB_NAME;"
|
||||
$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';"
|
||||
$STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
|
||||
MYSQL_VERSION=$(mariadb --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
|
||||
$STD mariadb -u root -e "CREATE DATABASE $DB_NAME;"
|
||||
$STD mariadb -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';"
|
||||
$STD mariadb -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
|
||||
{
|
||||
echo "Kimai-Credentials"
|
||||
echo "Kimai Database User: $DB_USER"
|
||||
@@ -56,11 +41,9 @@ $STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH
|
||||
} >>~/kimai.creds
|
||||
msg_ok "Set up database"
|
||||
|
||||
msg_info "Installing Kimai (Patience)"
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/kimai/kimai/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||
curl -fsSL "https://github.com/kimai/kimai/archive/refs/tags/${RELEASE}.zip" -o "${RELEASE}".zip
|
||||
$STD unzip "${RELEASE}".zip
|
||||
mv kimai-"${RELEASE}" /opt/kimai
|
||||
fetch_and_deploy_gh_release "Kimai" "kimai/kimai" "prebuild" "latest" "/opt/kimai" "kimai-release-*.zip"
|
||||
|
||||
msg_info "Installing Kimai"
|
||||
cd /opt/kimai
|
||||
echo "export COMPOSER_ALLOW_SUPERUSER=1" >>~/.bashrc
|
||||
source ~/.bashrc
|
||||
@@ -92,8 +75,6 @@ admin_lte:
|
||||
options:
|
||||
default_avatar: build/apple-touch-icon.png
|
||||
EOF
|
||||
|
||||
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
|
||||
msg_ok "Installed Kimai"
|
||||
|
||||
msg_info "Creating Service"
|
||||
@@ -130,7 +111,7 @@ motd_ssh
|
||||
customize
|
||||
|
||||
msg_info "Cleaning up"
|
||||
rm -rf "${RELEASE}".zip
|
||||
$STD apt-get -y autoremove
|
||||
$STD apt-get -y autoclean
|
||||
$STD apt -y autoremove
|
||||
$STD apt -y autoclean
|
||||
$STD apt -y clean
|
||||
msg_ok "Cleaned"
|
||||
|
||||
@@ -14,19 +14,19 @@ network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing dependencies"
|
||||
$STD apt install --no-install-recommends -y build-essential
|
||||
$STD apt install -y build-essential
|
||||
msg_ok "Installed dependencies"
|
||||
|
||||
NODE_VERSION="22" setup_nodejs
|
||||
MYSQL_VERSION="8.0" setup_mysql
|
||||
setup_mariadb
|
||||
|
||||
msg_info "Setting up Database"
|
||||
DB_NAME="mmdl"
|
||||
DB_USER="mmdl"
|
||||
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
|
||||
$STD mysql -u root -e "CREATE DATABASE $DB_NAME;"
|
||||
$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED by '$DB_PASS';"
|
||||
$STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
|
||||
$STD mariadb -u root -e "CREATE DATABASE $DB_NAME;"
|
||||
$STD mariadb -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED by '$DB_PASS';"
|
||||
$STD mariadb -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
|
||||
{
|
||||
echo "Manage My Damn Life Credentials"
|
||||
echo "Database User: $DB_USER"
|
||||
@@ -59,7 +59,7 @@ msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/mmdl.service
|
||||
[Unit]
|
||||
Description=${APPLICATION} Service
|
||||
After=network.target mysql.service
|
||||
After=network.target mariadb.service
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/opt/mmdl
|
||||
|
||||
Reference in New Issue
Block a user