From 339d8455a59a748d274fb60814524eb28aa72e04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 11 Dec 2023 22:59:50 +0100 Subject: [PATCH] fpm footprint --- conf/extra_php-fpm.conf | 4 ++ config_panel.toml | 35 ++++++++++++++ scripts/install | 10 +++- scripts/upgrade | 102 ++++------------------------------------ 4 files changed, 58 insertions(+), 93 deletions(-) create mode 100644 conf/extra_php-fpm.conf diff --git a/conf/extra_php-fpm.conf b/conf/extra_php-fpm.conf new file mode 100644 index 0000000..017da9e --- /dev/null +++ b/conf/extra_php-fpm.conf @@ -0,0 +1,4 @@ +; Additional php.ini defines, specific to this pool of workers. + +php_admin_value[upload_max_filesize] = 256M +php_admin_value[post_max_size] = 256M diff --git a/config_panel.toml b/config_panel.toml index ab6b17b..9fb7338 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -11,6 +11,41 @@ name = "Dotclear2 configuration" type = "user" bind = "super_user:__INSTALL_DIR__/inc/class.auth.ldap.php" + [main.php_fpm_config] + name = "PHP-FPM configuration" + + [main.php_fpm_config.phpversion] + ask = "PHP version" + type = "select" + choices = ["none", "7.4", "8.0", "8.1", "8.2"] + default = "none" + + [main.php_fpm_config.fpm_footprint] + visible = "phpversion != 'none'" + ask = "Memory footprint of the service?" + 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' && phpversion != 'none'" + 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] + visible = "phpversion != 'none'" + ask = "Expected usage of the service?" + 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." + + [ynh_users] name = "Yunohost users" help = "These permissions apply to the first connection of the user, the super user can change them in dotclear." diff --git a/scripts/install b/scripts/install index ddf6130..ee5be15 100755 --- a/scripts/install +++ b/scripts/install @@ -34,7 +34,15 @@ setfacl -m d:u:www-data:rwx "$install_dir/"{cache,public} #=================================================รง ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 -ynh_add_fpm_config +fpm_footprint="low" +fpm_free_footprint=0 +fpm_usage="low" + +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 + +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion ynh_add_nginx_config diff --git a/scripts/upgrade b/scripts/upgrade index 0282415..2b436b4 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,34 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? db_user=$db_name -#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -#REMOVEME? password=$(ynh_app_setting_get --app=$app --key=password) -#REMOVEME? master_key=$(ynh_app_setting_get --app=$app --key=master_key) - -#REMOVEME? blog_admin=$(ynh_app_setting_get --app=$app --key=blog_admin) -#REMOVEME? blog_contentadmin=$(ynh_app_setting_get --app=$app --key=blog_contentadmin) -#REMOVEME? blog_usage=$(ynh_app_setting_get --app=$app --key=blog_usage) -#REMOVEME? blog_publish=$(ynh_app_setting_get --app=$app --key=blog_publish) -#REMOVEME? blog_delete=$(ynh_app_setting_get --app=$app --key=blog_delete) -#REMOVEME? blog_categories=$(ynh_app_setting_get --app=$app --key=blog_categories) -#REMOVEME? blog_media_admin=$(ynh_app_setting_get --app=$app --key=blog_media_admin) -#REMOVEME? blog_media=$(ynh_app_setting_get --app=$app --key=blog_media) -#REMOVEME? blog_pages=$(ynh_app_setting_get --app=$app --key=blog_pages) -#REMOVEME? blog_blogroll=$(ynh_app_setting_get --app=$app --key=blog_blogroll) - #================================================= # CHECK VERSION #================================================= @@ -44,20 +16,6 @@ ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=4 - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - # Restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -65,48 +23,16 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." -# If db_name doesn't exist, create it -if [ -z "$db_name" ]; then - db_name=$(ynh_sanitize_dbid --db_name=$app) -#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name -fi - -# If install_dir doesn't exist, create it -if [ -z "$install_dir" ]; then -#REMOVEME? install_dir=/var/www/$app -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir -fi - -#REMOVEME? if [ -n "$(ynh_app_setting_get --app=$app --key=is_public)" ]; then - ynh_app_setting_delete --app=$app --key=protected_uris - - # Removing skipped/unprotected_uris under certain conditions, remove the visitors group added during the migration process of 3.7 - # Remove unprotected_uris. If the app was public, add visitors again to the main permission - if ynh_permission_has_user --permission=main --user=visitors - then - ynh_app_setting_delete --app=$app --key=unprotected_uris -#REMOVEME? ynh_permission_update --permission "main" --add "visitors" - else - ynh_app_setting_delete --app=$app --key=unprotected_uris - fi - ynh_app_setting_delete --app=$app --key=is_public -fi - -#REMOVEME? if ! ynh_permission_exists --permission="admin"; then - # Create the required permissions -#REMOVEME? ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin -fi - if [ -z "$blog_admin" ] || - [ -z "$blog_contentadmin" ] || - [ -z "$blog_usage" ] || - [ -z "$blog_publish" ] || - [ -z "$blog_delete" ] || - [ -z "$blog_categories" ] || - [ -z "$blog_media_admin" ] || - [ -z "$blog_media" ] || - [ -z "$blog_pages" ] || - [ -z "$blog_blogroll" ]; then +[ -z "$blog_contentadmin" ] || +[ -z "$blog_usage" ] || +[ -z "$blog_publish" ] || +[ -z "$blog_delete" ] || +[ -z "$blog_categories" ] || +[ -z "$blog_media_admin" ] || +[ -z "$blog_media" ] || +[ -z "$blog_pages" ] || +[ -z "$blog_blogroll" ]; then blog_admin="false" blog_contentadmin="false" blog_usage="true" @@ -129,14 +55,6 @@ if [ -z "$blog_admin" ] || ynh_app_setting_set --app=$app --key=blog_blogroll --value=$blog_blogroll fi -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." - -# Create a dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir=$install_dir - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -177,7 +95,7 @@ ynh_add_nginx_config ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 # Create a dedicated PHP-FPM config -ynh_add_fpm_config +ynh_add_fpm_config --usage=low --footprint=low #================================================= # SPECIFIC UPGRADE