From 69bc538752305c96b80711ef36c09ec2743f6465 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 27 Dec 2023 20:58:45 +0100 Subject: [PATCH 1/6] Burn the damn funky php fpm config panel --- config_panel.toml | 30 --------------- scripts/config | 95 ----------------------------------------------- scripts/install | 18 +-------- scripts/upgrade | 27 +------------- 4 files changed, 2 insertions(+), 168 deletions(-) delete mode 100644 config_panel.toml delete mode 100644 scripts/config diff --git a/config_panel.toml b/config_panel.toml deleted file mode 100644 index f8663f0..0000000 --- a/config_panel.toml +++ /dev/null @@ -1,30 +0,0 @@ -version = "1.0" - -[main] -name = "h5ai configuration" - - [main.php_fpm_config] - name = "PHP-FPM configuration" - - [main.php_fpm_config.fpm_footprint] - ask = "Memory footprint" - type = "select" - choices.low = "Low, <= 20Mb per pool" - choices.medium = "Medium, between 20Mb and 40Mb per pool" - choices.high = "High, > 40Mb per pool" - choices.specific = "Use specific value" - default = "low" - - [main.php_fpm_config.fpm_free_footprint] - visible = "fpm_footprint == 'specific'" - ask = "Memory footprint of the service?" - type = "number" - default = "0" - help = "Free field to specify exactly the footprint in Mb if you don't want to use one of the three previous values." - - [main.php_fpm_config.fpm_usage] - ask = "Expected usage" - type = "select" - choices = ["low", "medium", "high"] - default = "low" - help = "low: Personal usage, behind the SSO. No RAM footprint when not used, but the impact on the processor can be high if many users are using the service.
medium: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.
high: High usage, frequently visited website. High RAM footprint, but lower on processor usage and quickly responding." diff --git a/scripts/config b/scripts/config deleted file mode 100644 index 91c2de7..0000000 --- a/scripts/config +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash - -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -source _common.sh -source /usr/share/yunohost/helpers - -ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) -current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) - -#================================================= -# SPECIFIC GETTERS FOR TOML SHORT KEY -#================================================= - -get__fpm_footprint() { - # Free footprint value for php-fpm - # Check if current_fpm_footprint is an integer - if [ "$current_fpm_footprint" -eq "$current_fpm_footprint" ] 2> /dev/null - then - echo "specific" - else - echo "$current_fpm_footprint" - fi -} - -get__free_footprint() { - # Free footprint value for php-fpm - # Check if current_fpm_footprint is an integer - if [ "$current_fpm_footprint" -eq "$current_fpm_footprint" ] 2> /dev/null - then - # If current_fpm_footprint is an integer, that's a numeric value for the footprint - echo "$current_fpm_footprint" - else - echo "0" - fi -} - -#================================================= -# SPECIFIC SETTERS FOR TOML SHORT KEYS -#================================================= - -set__fpm_footprint() { - if [ "$fpm_footprint" != "specific" ] - then - ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_footprint" - fi -} - -set__fpm_free_footprint() { - if [ "$fpm_footprint" = "specific" ] - then - ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_free_footprint" - fi -} - -#================================================= -# GENERIC FINALIZATION -#================================================= - -ynh_app_config_validate() { - _ynh_app_config_validate - - if [ "${changed[fpm_usage]}" == "true" ] || [ "${changed[fpm_footprint]}" == "true" ] || [ "${changed[fpm_free_footprint]}" == "true" ]; then - # If fpm_footprint is set to 'specific', use $fpm_free_footprint value. - if [ "$fpm_footprint" = "specific" ] - then - fpm_footprint=$fpm_free_footprint - fi - - if [ "$fpm_footprint" == "0" ] - then - ynh_print_err --message="When selecting 'specific', you have to set a footprint value into the field below." - - exit 0 - fi - fi -} - -ynh_app_config_apply() { - _ynh_app_config_apply - - ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint -} - -ynh_app_config_run $1 diff --git a/scripts/install b/scripts/install index 0cd3b20..2b3cfa9 100644 --- a/scripts/install +++ b/scripts/install @@ -9,22 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST -#================================================= - -fpm_footprint="low" -fpm_free_footprint=0 -fpm_usage="low" - -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= - -ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint -ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint -ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -42,7 +26,7 @@ chown -R $app:www-data "$install_dir" ynh_script_progression --message="Adding system configurations related to $app..." --weight=3 # Create a dedicated PHP-FPM config -ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint +ynh_add_fpm_config # Create a dedicated NGINX config ynh_add_nginx_config diff --git a/scripts/upgrade b/scripts/upgrade index 64f61d4..b1d91dc 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -28,31 +28,6 @@ fi upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# STANDARD UPGRADE STEPS -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 - -# If fpm_footprint doesn't exist, create it -if [ -z "${fpm_footprint:-}" ]; then - fpm_footprint=low - ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint -fi - -# If fpm_free_footprint doesn't exist, create it -if [ -z "${fpm_free_footprint:-}" ]; then - fpm_free_footprint=0 - ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint -fi - -# If fpm_usage doesn't exist, create it -if [ -z "${fpm_usage:-}" ]; then - fpm_usage=low - ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage -fi - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -74,7 +49,7 @@ chown -R $app:www-data "$install_dir" ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=4 # Create a dedicated PHP-FPM config -ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint +ynh_add_fpm_config # Create a dedicated NGINX config ynh_add_nginx_config From 582e0b7cfadda4ed589f56db9ce625ee390b504f Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 27 Dec 2023 20:59:50 +0100 Subject: [PATCH 2/6] Super funky inconsistent tweak with install_dir during upgrade x_x --- scripts/upgrade | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index b1d91dc..7142fec 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,31 +1,8 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading settings..." --weight=1 - -if [[ "$path" != "/" ]] -then - # We use the path url name (e.g. /documents) instead of h5ai for convenience... - install_dir=/var/www/$path -else - install_dir=/var/www/$app -fi - -#================================================= -# CHECK VERSION -#================================================= - upgrade_type=$(ynh_check_app_version_changed) #================================================= From 29a8e56e0e40d1b8528ff4246468289217b75504 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Wed, 27 Dec 2023 20:00:03 +0000 Subject: [PATCH 3/6] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f04a3d7..08d4481 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Some of the optional features are: file sorting, different view modes, localizat * Official app website: * Official admin documentation: * Upstream app code repository: -* YunoHost documentation for this app: +* YunoHost Store: * Report a bug: ## Developer info diff --git a/README_fr.md b/README_fr.md index 9f994cb..9364e44 100644 --- a/README_fr.md +++ b/README_fr.md @@ -36,7 +36,7 @@ Parmi les fonctionnalités optionnelles, citons : le tri des fichiers, différen * Site officiel de l’app : * Documentation officielle de l’admin : * Dépôt de code officiel de l’app : -* Documentation YunoHost pour cette app : +* YunoHost Store: * Signaler un bug : ## Informations pour les développeurs From c348b1033c4419fd3b26c4dff51b602e8651cfbd Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 27 Dec 2023 21:25:44 +0100 Subject: [PATCH 4/6] More sensible permission stuff during upgrade + keep the config file --- scripts/upgrade | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 7142fec..68ca9c0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -11,19 +11,21 @@ upgrade_type=$(ynh_check_app_version_changed) if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Upgrading source files..." --weight=4 + ynh_script_progression --message="Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" + ynh_setup_source --dest_dir="$install_dir" --keep="_h5ai/private/conf/options.json" fi -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chmod o-rwx "$install_dir" +chown $app:www-data "$install_dir" +chown -R $app:www-data "$install_dir/_h5ai" +chown 700 "$install_dir/_h5ai/private" #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=4 +ynh_script_progression --message="Upgrading system configurations related to $app..." # Create a dedicated PHP-FPM config ynh_add_fpm_config From 45f8d3dc438b695e5d54e6e70fa152374e70fca7 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin <4533074+alexAubin@users.noreply.github.com> Date: Thu, 28 Dec 2023 01:06:57 +0100 Subject: [PATCH 5/6] Update upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 68ca9c0..0a9c686 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,7 +20,7 @@ fi chmod o-rwx "$install_dir" chown $app:www-data "$install_dir" chown -R $app:www-data "$install_dir/_h5ai" -chown 700 "$install_dir/_h5ai/private" +chown 700 "$install_dir/_h5ai/private/conf" #================================================= # REAPPLY SYSTEM CONFIGURATIONS From 54d6d1ebd06a3da596202d5a2527302f319cfab9 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin <4533074+alexAubin@users.noreply.github.com> Date: Thu, 28 Dec 2023 01:07:19 +0100 Subject: [PATCH 6/6] Update install --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 2b3cfa9..13f1654 100644 --- a/scripts/install +++ b/scripts/install @@ -19,6 +19,7 @@ ynh_setup_source --dest_dir="$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" +chown 700 "$install_dir/_h5ai/private/conf" #================================================= # SYSTEM CONFIGURATION