From 45d39afabb8b2ce8a376c5ef2e9a74befd78c838 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Sat, 31 Aug 2024 01:04:37 +0200 Subject: [PATCH] [autopatch] Automatic patch attempt for helpers 2.1 --- conf/cron | 16 ++++++++-------- conf/extra_php-fpm.conf | 5 ----- conf/nginx.conf | 2 +- manifest.toml | 4 +++- scripts/_common.sh | 18 +----------------- scripts/backup | 19 ++++++++----------- scripts/change_url | 6 +++--- scripts/install | 23 +++++++++++++---------- scripts/remove | 10 +++++----- scripts/restore | 31 +++++++++++++++---------------- scripts/upgrade | 21 ++++++++++++--------- 11 files changed, 69 insertions(+), 86 deletions(-) delete mode 100755 conf/extra_php-fpm.conf diff --git a/conf/cron b/conf/cron index 47c49e9..bacbab0 100644 --- a/conf/cron +++ b/conf/cron @@ -1,8 +1,8 @@ -0,5,10,15,20,25,30,35,40,45,50,55 * * * * __APP__ /usr/bin/php__PHPVERSION__ __INSTALL_DIR__/console mautic:segments:update > /dev/null 2>&1 -3,8,12,17,22,27.32.37,42,47,52,57 * * * * __APP__ /usr/bin/php__PHPVERSION__ __INSTALL_DIR__/console mautic:campaigns:update > /dev/null 2>&1 -1,6,11,16,21,26,31,36,41,46,51,56 * * * * __APP__ /usr/bin/php__PHPVERSION__ __INSTALL_DIR__/console mautic:campaigns:trigger > /dev/null 2>&1 -*/10 * * * * __APP__ /usr/bin/php__PHPVERSION__ __INSTALL_DIR__/console mautic:broadcasts:send > /dev/null 2>&1 -0,15,30,45 * * * * __APP__ /usr/bin/php__PHPVERSION__ __INSTALL_DIR__/console mautic:emails:send > /dev/null 2>&1 -15 * * * * __APP__ /usr/bin/php__PHPVERSION__ __INSTALL_DIR__/console mautic:webhooks:process > /dev/null 2>&1 -0 0 1 * * __APP__ /usr/bin/php__PHPVERSION__ __INSTALL_DIR__/console mautic:maintenance:cleanup –-days-old=90 –no-interaction > /dev/null 2>&1 -0 4 * * * __APP__ /usr/bin/php__PHPVERSION__ __INSTALL_DIR__/console mautic:iplookup:download > /dev/null 2>&1 +0,5,10,15,20,25,30,35,40,45,50,55 * * * * __APP__ /usr/bin/php__PHP_VERSION__ __INSTALL_DIR__/console mautic:segments:update > /dev/null 2>&1 +3,8,12,17,22,27.32.37,42,47,52,57 * * * * __APP__ /usr/bin/php__PHP_VERSION__ __INSTALL_DIR__/console mautic:campaigns:update > /dev/null 2>&1 +1,6,11,16,21,26,31,36,41,46,51,56 * * * * __APP__ /usr/bin/php__PHP_VERSION__ __INSTALL_DIR__/console mautic:campaigns:trigger > /dev/null 2>&1 +*/10 * * * * __APP__ /usr/bin/php__PHP_VERSION__ __INSTALL_DIR__/console mautic:broadcasts:send > /dev/null 2>&1 +0,15,30,45 * * * * __APP__ /usr/bin/php__PHP_VERSION__ __INSTALL_DIR__/console mautic:emails:send > /dev/null 2>&1 +15 * * * * __APP__ /usr/bin/php__PHP_VERSION__ __INSTALL_DIR__/console mautic:webhooks:process > /dev/null 2>&1 +0 0 1 * * __APP__ /usr/bin/php__PHP_VERSION__ __INSTALL_DIR__/console mautic:maintenance:cleanup –-days-old=90 –no-interaction > /dev/null 2>&1 +0 4 * * * __APP__ /usr/bin/php__PHP_VERSION__ __INSTALL_DIR__/console mautic:iplookup:download > /dev/null 2>&1 diff --git a/conf/extra_php-fpm.conf b/conf/extra_php-fpm.conf deleted file mode 100755 index 484d3a5..0000000 --- a/conf/extra_php-fpm.conf +++ /dev/null @@ -1,5 +0,0 @@ -; Additional php.ini defines, specific to this pool of workers. - -php_admin_value[upload_max_filesize] = 100M -php_admin_value[post_max_size] = 100M -php_admin_value[memory_limit] = 512M diff --git a/conf/nginx.conf b/conf/nginx.conf index f55453f..5f73282 100755 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -15,7 +15,7 @@ location __PATH__/ { location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__APP__.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param REMOTE_USER $remote_user; diff --git a/manifest.toml b/manifest.toml index 062e19b..1e5d557 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,8 @@ admindoc = "https://docs.mautic.org/en" code = "https://github.com/mautic/mautic" [integration] -yunohost = ">= 11.2" +yunohost = ">= 11.2.18" +helpers_version = "2.1" architectures = "all" multi_instance = true @@ -50,6 +51,7 @@ ram.runtime = "50M" allow_email = true [resources.install_dir] + group = "www-data:r-x" [resources.permissions] main.url = "/" diff --git a/scripts/_common.sh b/scripts/_common.sh index e3f872c..42b7e62 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,23 +1,7 @@ #!/bin/bash #================================================= -# COMMON VARIABLES +# COMMON VARIABLES AND CUSTOM HELPERS #================================================= timezone="$(cat /etc/timezone)" - -#================================================= -# PERSONAL HELPERS -#================================================= - -#================================================= -# EXPERIMENTAL HELPERS -#================================================= - -#================================================= -# FUTURE OFFICIAL HELPERS -#================================================= - -#================================================= -# EXPERIMENTAL HELPERS -#================================================= diff --git a/scripts/backup b/scripts/backup index 00f48dc..e89e981 100755 --- a/scripts/backup +++ b/scripts/backup @@ -7,36 +7,33 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# DECLARE DATA AND CONF FILES TO BACKUP -#================================================= -ynh_print_info --message="Declaring files to be backed up..." +ynh_print_info "Declaring files to be backed up..." #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$install_dir" +ynh_backup "$install_dir" #================================================= # SYSTEM CONFIGURATION #================================================= -ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf" -ynh_backup --src_path="/etc/cron.d/$app" +ynh_backup "/etc/cron.d/$app" #================================================= # BACKUP THE MYSQL DATABASE #================================================= -ynh_print_info --message="Backing up the MySQL database..." +ynh_print_info "Backing up the MySQL database..." -ynh_mysql_dump_db --database="$db_name" > db.sql +ynh_mysql_dump_db > db.sql #================================================= # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index f982d21..493eead 100755 --- a/scripts/change_url +++ b/scripts/change_url @@ -10,12 +10,12 @@ source /usr/share/yunohost/helpers #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --weight=5 +ynh_script_progression "Updating NGINX web server configuration..." -ynh_change_url_nginx_config +ynh_config_change_url_nginx #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --last +ynh_script_progression "Change of URL completed for $app" diff --git a/scripts/install b/scripts/install index bfb90b7..fc675aa 100755 --- a/scripts/install +++ b/scripts/install @@ -7,17 +7,20 @@ source _common.sh source /usr/share/yunohost/helpers +ynh_app_setting_set --key=php_upload_max_filesize --value=100M + +ynh_app_setting_set --key=php_memory_limit --value=512M + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --weight=2 +ynh_script_progression "Setting up source files..." # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" -chmod -R o-rwx "$install_dir" -chown -R "$app:www-data" "$install_dir" - +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:www-data" "$install_dir" chmod -R g+w "$install_dir/app/config/" chmod -R g+w "$install_dir/media/files/" chmod -R g+w "$install_dir/media/images/" @@ -26,19 +29,19 @@ chmod -R g+w "$install_dir/translations/" #================================================= # SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 +ynh_script_progression "Adding system configurations related to $app..." # Create a dedicated PHP-FPM config -ynh_add_fpm_config +ynh_config_add_phpfpm # Create a dedicated NGINX config -ynh_add_nginx_config +ynh_config_add_nginx -ynh_add_config --template="cron" --destination="/etc/cron.d/$app" -chmod 644 "/etc/cron.d/$app" +ynh_config_add --template="cron" --destination="/etc/cron.d/$app" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 644 "/etc/cron.d/$app" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression "Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index 3a4f117..3ab911c 100755 --- a/scripts/remove +++ b/scripts/remove @@ -10,19 +10,19 @@ source /usr/share/yunohost/helpers #================================================= # REMOVE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 +ynh_script_progression "Removing system configurations related to $app..." # Remove the dedicated NGINX config -ynh_remove_nginx_config +ynh_config_remove_nginx # Remove the dedicated PHP-FPM config -ynh_remove_fpm_config +ynh_config_remove_phpfpm # Remove a cron file -ynh_secure_remove --file="/etc/cron.d/$app" +ynh_safe_rm "/etc/cron.d/$app" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --last +ynh_script_progression "Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index 35b2589..df3dcb6 100755 --- a/scripts/restore +++ b/scripts/restore @@ -11,13 +11,12 @@ source /usr/share/yunohost/helpers #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." --weight=2 +ynh_script_progression "Restoring the app main directory..." -ynh_restore_file --origin_path="$install_dir" - -chmod -R o-rwx "$install_dir" -chown -R "$app:www-data" "$install_dir" +ynh_restore "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:www-data" "$install_dir" chmod -R g+w "$install_dir/app/config/" chmod -R g+w "$install_dir/media/files/" chmod -R g+w "$install_dir/media/images/" @@ -26,32 +25,32 @@ chmod -R g+w "$install_dir/translations/" #================================================= # RESTORE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Restoring the MySQL database..." --weight=2 +ynh_script_progression "Restoring the MySQL database..." -ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql +ynh_mysql_db_shell < ./db.sql #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 +ynh_script_progression "Restoring system configurations related to $app..." -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf" -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_restore_file --origin_path="/etc/cron.d/$app" -chmod 644 "/etc/cron.d/$app" +ynh_restore "/etc/cron.d/$app" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 644 "/etc/cron.d/$app" #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1 +ynh_script_progression "Reloading NGINX web server and PHP-FPM..." -ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload -ynh_systemd_action --service_name=nginx --action=reload +ynh_systemctl --service="php$php_version-fpm" --action=reload +ynh_systemctl --service=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last +ynh_script_progression "Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index 47ad454..7a72f3d 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -7,17 +7,20 @@ source _common.sh source /usr/share/yunohost/helpers +ynh_app_setting_set_default --key=php_upload_max_filesize --value=100M + +ynh_app_setting_set_default --key=php_memory_limit --value=512M + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Upgrading source files..." --weight=1 +ynh_script_progression "Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="config/local.php media/files media/images translations" - -chmod -R o-rwx "$install_dir" -chown -R "$app:www-data" "$install_dir" +ynh_setup_source --dest_dir="$install_dir" --full_replace --keep="config/local.php media/files media/images translations" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:www-data" "$install_dir" chmod -R g+w "$install_dir/app/config/" chmod -R g+w "$install_dir/media/files/" chmod -R g+w "$install_dir/media/images/" @@ -26,16 +29,16 @@ chmod -R g+w "$install_dir/translations/" #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 +ynh_script_progression "Upgrading system configurations related to $app..." # Create a dedicated PHP-FPM config -ynh_add_fpm_config +ynh_config_add_phpfpm # Create a dedicated NGINX config -ynh_add_nginx_config +ynh_config_add_nginx #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression "Upgrade of $app completed"