From 91ce09982c798866a9d5748b229997f7e8e32967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slavi=C5=A1a=20Are=C5=BEina?= <58952836+tremor021@users.noreply.github.com> Date: Mon, 5 Jan 2026 21:54:52 +0100 Subject: [PATCH] Refactor (#10552) --- ct/monica.sh | 7 ++++++- install/monica-install.sh | 18 ++---------------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/ct/monica.sh b/ct/monica.sh index d4fb98a53..68325b354 100644 --- a/ct/monica.sh +++ b/ct/monica.sh @@ -27,10 +27,15 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi - setup_mariadb + setup_mariadb NODE_VERSION="22" NODE_MODULE="yarn@latest" setup_nodejs + # Fix for previous versions not having cronjob + if ! grep -Fq 'php /opt/monica/artisan schedule:run' /etc/crontab; then + echo '* * * * * root php /opt/monica/artisan schedule:run >> /dev/null 2>&1' >>/etc/crontab + fi + if check_for_gh_release "monica" "monicahq/monica"; then msg_info "Stopping Service" systemctl stop apache2 diff --git a/install/monica-install.sh b/install/monica-install.sh index 4503036db..c5ef5d293 100644 --- a/install/monica-install.sh +++ b/install/monica-install.sh @@ -16,23 +16,8 @@ update_os PHP_VERSION="8.2" PHP_APACHE="YES" PHP_MODULE="dom,gmp,iconv,mysqli,pdo-mysql,redis,tokenizer" setup_php setup_composer setup_mariadb +MARIADB_DB_NAME="monica" MARIADB_DB_USER="monica" setup_mariadb_db NODE_VERSION="22" NODE_MODULE="yarn@latest" setup_nodejs - -msg_info "Setting up MariaDB" -DB_NAME=monica -DB_USER=monica -DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) -$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 "monica-Credentials" - echo "monica Database User: $DB_USER" - echo "monica Database Password: $DB_PASS" - echo "monica Database Name: $DB_NAME" -} >>~/monica.creds -msg_ok "Set up MariaDB" - fetch_and_deploy_gh_release "monica" "monicahq/monica" "prebuild" "latest" "/opt/monica" "monica-v*.tar.bz2" msg_info "Configuring monica" @@ -51,6 +36,7 @@ $STD php artisan key:generate $STD php artisan setup:production --email=admin@helper-scripts.com --password=helper-scripts.com --force chown -R www-data:www-data /opt/monica chmod -R 775 /opt/monica/storage +echo "* * * * * root php /opt/monica/artisan schedule:run >> /dev/null 2>&1" >>/etc/crontab msg_ok "Configured monica" msg_info "Creating Service"