diff --git a/check_process b/check_process index ae40e3b..533da94 100644 --- a/check_process +++ b/check_process @@ -6,6 +6,17 @@ language="fr_FR" multisite=0 is_public=1 (PUBLIC|public=1|private=0) + ; Actions + is_public=0|1 + ; Config_panel + main.is_public.is_public=0|1 + main.overwrite_files.overwrite_nginx=0|1 + main.overwrite_files.overwrite_phpfpm=0|1 + main.global_config.email_type=0|1 + main.php_fpm_config.footprint=low|medium|high + main.php_fpm_config.free_footprint=20 + main.php_fpm_config.usage=low|medium|high + main.php_fpm_config.force_max_children=20|0 ; Checks pkg_linter=1 setup_sub_dir=1 @@ -19,6 +30,8 @@ multi_instance=1 port_already_use=0 change_url=1 + actions=1 + config_panel=1 ;; Test avec multisite ; Manifest domain="domain.tld" (DOMAIN) diff --git a/config_panel.toml b/config_panel.toml index 8d62e79..c96a294 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -60,3 +60,9 @@ name = "Wordpress configuration" 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." + + [main.php_fpm_config.force_max_children] + ask = "Force the value of pm.max_children ?" + type = "number" + default = "0" + help = "Do not change this value unless you're sure about what you're doing !
pm.max_children is automatically defined by this formula: $max_ram / 2 / $footprint
You can force that value, and ignore the formula by changing the value here.
To reset to the default value, set to 0." diff --git a/scripts/actions/public_private b/scripts/actions/public_private index 0bb8f36..6615ab9 100755 --- a/scripts/actions/public_private +++ b/scripts/actions/public_private @@ -8,6 +8,13 @@ source /usr/share/yunohost/helpers +#================================================= +# MANAGE SCRIPT FAILURE +#================================================= + +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + #================================================= # RETRIEVE ARGUMENTS #================================================= diff --git a/scripts/config b/scripts/config index af78344..ef235d6 100644 --- a/scripts/config +++ b/scripts/config @@ -16,6 +16,8 @@ source _ynh_add_fpm_config app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID} +fpm_config_dir=$(ynh_app_setting_get --app=$app --key=fpm_config_dir) + #================================================= # LOAD VALUES #================================================= @@ -61,6 +63,14 @@ free_footprint="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FREE_FOOTPRINT:-$old_free_footp old_fpm_usage="$(ynh_app_setting_get --app=$app --key=fpm_usage)" fpm_usage="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_USAGE:-$old_fpm_usage}" +# php_forced_max_children for php-fpm +old_php_forced_max_children="$(ynh_app_setting_get --app=$app --key=php_forced_max_children)" +# If php_forced_max_children isn't into settings.yml, get the current value from the fpm config +if [ -z "$old_php_forced_max_children" ]; then + old_php_forced_max_children="$(grep "^pm.max_children" "$fpm_config_dir/pool.d/$app.conf" | awk '{print $3}')" +fi +php_forced_max_children="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FORCE_MAX_CHILDREN:-$old_php_forced_max_children}" + #================================================= # SHOW_CONFIG FUNCTION FOR 'SHOW' COMMAND #================================================= @@ -79,6 +89,7 @@ show_config() { ynh_return "YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FOOTPRINT=$fpm_footprint" ynh_return "YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FREE_FOOTPRINT=$free_footprint" ynh_return "YNH_CONFIG_MAIN_PHP_FPM_CONFIG_USAGE=$fpm_usage" + ynh_return "YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FORCE_MAX_CHILDREN=$php_forced_max_children" } #================================================= @@ -88,11 +99,14 @@ show_config() { apply_config() { # Change public accessibility - if [ "$is_public" = "1" ] + if [ "$is_public" != "$old_is_public" ] then - yunohost app action run $app public_private --args is_public=1 - else - yunohost app action run $app public_private --args is_public=0 + if [ "$is_public" = "1" ] + then + yunohost app action run $app public_private --args is_public=1 + else + yunohost app action run $app public_private --args is_public=0 + fi fi #================================================= @@ -116,7 +130,10 @@ apply_config() { # RECONFIGURE PHP-FPM #================================================= - if [ "$fpm_usage" != "$old_fpm_usage" ] || [ "$fpm_footprint" != "$old_fpm_footprint" ] || [ "$free_footprint" != "$old_free_footprint" ] + if [ "$fpm_usage" != "$old_fpm_usage" ] || \ + [ "$fpm_footprint" != "$old_fpm_footprint" ] || \ + [ "$free_footprint" != "$old_free_footprint" ] || \ + [ "$php_forced_max_children" != "$old_php_forced_max_children" ] then # If fpm_footprint is set to 'specific', use $free_footprint value. if [ "$fpm_footprint" = "specific" ] @@ -124,6 +141,18 @@ apply_config() { fpm_footprint=$free_footprint fi + if [ "$php_forced_max_children" != "$old_php_forced_max_children" ] + then + # Set php_forced_max_children + if [ $php_forced_max_children -ne 0 ] + then + ynh_app_setting_set --app=$app --key=php_forced_max_children --value="$php_forced_max_children" + else + # If the value is set to 0, remove the setting + ynh_app_setting_delete --app=$app --key=php_forced_max_children + fi + fi + if [ "$fpm_footprint" != "0" ] then ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint