diff --git a/config_panel.toml b/config_panel.toml index a22d2cb1..df913bb0 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -47,7 +47,6 @@ name.fr = "Configuration de Nextcloud" help.en = "Mechanism allowing more instantaneous notifications and reduce server load." help.fr = "Mécanisme qui permet d'avoir des notifications plus rapides et de réduire la charge du serveur." - [main.php_fpm_config] name.en = "PHP-FPM configuration" name.fr = "Configuration de PHP-FPM" diff --git a/hooks/post_user_create b/hooks/post_user_create index c6717efc..123de578 100644 --- a/hooks/post_user_create +++ b/hooks/post_user_create @@ -3,4 +3,4 @@ user="$1" app="$(basename $0 | cut -d- -f 2-)" # Extract the app name from the script name, which is supposed to be something like "50-app_id" -setfacl --modify g:$app:rwx /home/$user +setfacl --recursive --modify g:$app:rwX,d:g:$app:rwX /home/$user diff --git a/manifest.toml b/manifest.toml index fa7717ce..331dea33 100644 --- a/manifest.toml +++ b/manifest.toml @@ -70,6 +70,12 @@ ram.runtime = "512M" help.en = "Notify Push is a mechanism allowing more instantaneous notifications and reduce server load. (However, it is still a bit new)" help.fr = "Notify Push est un mécanisme qui permet d'avoir des notifications plus rapides et de réduire la charge du serveur. (Cependant, cette fonctionnalité reste relativement nouvelle)" + [install.enable_notify_push] + ask.en = "Configure the High Performance Backend?" + ask.fr = "Configurer le Backend Hautes Performances ?" + type = "boolean" + default = false + [resources] [resources.sources] diff --git a/scripts/backup b/scripts/backup index 96d5808b..24e87490 100755 --- a/scripts/backup +++ b/scripts/backup @@ -22,7 +22,14 @@ ynh_backup --src_path="$install_dir" ynh_backup --src_path="$data_dir" --is_big #================================================= -# SYSTEM CONFIGURATION +# BACKUP THE NGINX CONFIGURATION +#================================================= + +ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.d" + +#================================================= +# BACKUP THE PHP-FPM CONFIGURATION #================================================= ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" diff --git a/scripts/change_url b/scripts/change_url index 15eaee94..87e5343e 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -79,6 +79,7 @@ then ynh_add_systemd_config --service="${app}-notify-push" count=0 + # cron can sometimes fail when the database is not fully initialized, hence it's retried several times, see https://github.com/YunoHost-Apps/nextcloud_ynh/pull/720 while ! ynh_exec_as "$app" php${phpversion} --define apc.enable_cli=1 $install_dir/cron.php && [[ $count -lt 30 ]] do diff --git a/scripts/config b/scripts/config index d9ae635b..1bd2f269 100644 --- a/scripts/config +++ b/scripts/config @@ -127,6 +127,9 @@ set__enable_notify_push() { fi exec_occ config:app:set notify_push base_endpoint --value https://$domain${path_url%/}/push + mkdir -p /var/run/$app/ + chown $app: /var/run/$app/ + case $YNH_ARCH in amd64) arch="x86_64";; arm64) arch="aarch64";; @@ -139,6 +142,7 @@ set__enable_notify_push() { ynh_add_systemd_config --service="${app}-notify-push" count=0 + # cron can sometimes fail when the database is not fully initialized, hence it's retried several times, see https://github.com/YunoHost-Apps/nextcloud_ynh/pull/720 while ! ynh_exec_as "$app" php${phpversion} --define apc.enable_cli=1 $install_dir/cron.php && [[ $count -lt 30 ]] do diff --git a/scripts/install b/scripts/install index 26020d18..9ac95822 100755 --- a/scripts/install +++ b/scripts/install @@ -155,7 +155,7 @@ then create_external_storage "/home/\$user" "Home" # Iterate over users to extend their home folder permissions for u in $(ynh_user_list); do - setfacl --modify g:$app:rwx "/home/$u" || true + setfacl --recursive --modify g:$app:rwX,d:g:$app:rwX "/home/$u" || true done fi @@ -212,6 +212,9 @@ then exec_occ app:install notify_push exec_occ config:app:set notify_push base_endpoint --value https://$domain${path_url%/}/push + mkdir -p /var/run/$app/ + chown $app: /var/run/$app/ + case $YNH_ARCH in amd64) arch="x86_64";; arm64) arch="aarch64";; @@ -297,6 +300,7 @@ ynh_add_fail2ban_config --logpath="/var/log/$app/nextcloud.log" --failregex="^.* if [ $enable_notify_push -eq 1 ] then count=0 + # cron can sometimes fail when the database is not fully initialized, hence it's retried several times, see https://github.com/YunoHost-Apps/nextcloud_ynh/pull/720 while ! ynh_exec_as "$app" php${phpversion} --define apc.enable_cli=1 $install_dir/cron.php && [[ $count -lt 30 ]] do diff --git a/scripts/remove b/scripts/remove index 20a29598..1bca175d 100755 --- a/scripts/remove +++ b/scripts/remove @@ -26,6 +26,7 @@ ynh_remove_systemd_config --service="${app}-notify-push" systemctl disable --now --quiet ${app}-notify-push-watcher.path ynh_secure_remove --file="/etc/systemd/system/${app}-notify-push-watcher.path" ynh_remove_systemd_config --service="${app}-notify-push-watcher" +ynh_secure_remove --file="/var/run/$app" # Remove a cron file # TODO: Ensure that cron job is not running (How !?) @@ -35,7 +36,7 @@ ynh_secure_remove --file="/etc/cron.d/$app" for path in /home/*; do # Clean ACL in every directories in /home, except those which start with 'yunohost.' [[ ! $path == /home/yunohost.* ]] \ - && setfacl --remove g:$app -- "$path" 2>&1 + && setfacl --recursive --remove g:$app,d:g:$app -- "$path" 2>&1 done #================================================= diff --git a/scripts/restore b/scripts/restore index 90c74d5a..695e4180 100755 --- a/scripts/restore +++ b/scripts/restore @@ -93,8 +93,7 @@ chmod 750 $install_dir # Iterate over users to extend their home folder permissions - for the external # storage plugin usage - and create relevant Nextcloud directories for u in $(ynh_user_list); do - mkdir -p "$data_dir/$u" - setfacl --modify g:$app:rwx "/home/$u" || true + setfacl --recursive --modify g:$app:rwX,d:g:$app:rwX "/home/$u" || true done #================================================= @@ -130,6 +129,9 @@ ynh_systemd_action --action=restart --service_name=fail2ban if [ $enable_notify_push -eq 1 ] then + mkdir -p /var/run/$app/ + chown $app: /var/run/$app/ + ynh_restore_file --origin_path="/etc/systemd/system/${app}-notify-push.service" ynh_restore_file --origin_path="/etc/systemd/system/${app}-notify-push-watcher.service" ynh_restore_file --origin_path="/etc/systemd/system/${app}-notify-push-watcher.path" diff --git a/scripts/upgrade b/scripts/upgrade index ab9b0309..3dfa70f3 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -311,7 +311,7 @@ then || create_external_storage "/home/\$user" "Home" # Iterate over users to extend their home folder permissions for u in $(ynh_user_list); do - setfacl --modify g:$app:rwx "/home/$u" || true + setfacl --recursive --modify g:$app:rwX,d:g:$app:rwX "/home/$u" || true done fi @@ -397,6 +397,9 @@ then fi exec_occ config:app:set notify_push base_endpoint --value https://$domain${path_url%/}/push + mkdir -p /var/run/$app/ + chown $app: /var/run/$app/ + case $YNH_ARCH in amd64) arch="x86_64";; arm64) arch="aarch64";; diff --git a/tests.toml b/tests.toml index edbf2ab4..6e25f4c5 100644 --- a/tests.toml +++ b/tests.toml @@ -43,3 +43,10 @@ test_format = 1.0 args.enable_notify_push = "1" test_upgrade_from.e9f82ab7.name = "Upgrade from 28.0.6" test_upgrade_from.e9f82ab7.args.system_addressbook_exposed = "yes" + +[notify_push_test] + + args.enable_notify_push = "1" + test_upgrade_from.e9f82ab7.name = "Upgrade from 28.0.6" + test_upgrade_from.e9f82ab7.args.system_addressbook_exposed = "yes" +