1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/dotclear2_ynh.git synced 2024-09-03 18:26:29 +02:00

fpm footprint

This commit is contained in:
Salamandar 2023-12-11 22:59:50 +01:00
parent d57913dda9
commit 339d8455a5
4 changed files with 58 additions and 93 deletions

4
conf/extra_php-fpm.conf Normal file
View file

@ -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

View file

@ -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.<br>medium: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.<br>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."

View file

@ -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

View file

@ -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,38 +23,6 @@ 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" ] ||
@ -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