mirror of
https://github.com/YunoHost-Apps/omeka-s_ynh.git
synced 2024-09-03 19:56:05 +02:00
Merge pull request #21 from YunoHost-Apps/config-panel
upgrade config panel
This commit is contained in:
commit
01d2fde983
4 changed files with 33 additions and 17 deletions
|
@ -7,19 +7,24 @@ name = "Omega-s configuration"
|
||||||
name = "PHP-FPM configuration"
|
name = "PHP-FPM configuration"
|
||||||
|
|
||||||
[main.php_fpm_config.fpm_footprint]
|
[main.php_fpm_config.fpm_footprint]
|
||||||
ask = "Memory footprint of the service?"
|
ask = "Memory footprint"
|
||||||
choices = ["low", "medium", "high", "specific"]
|
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"
|
default = "low"
|
||||||
help = "low <= 20Mb per pool. medium between 20Mb and 40Mb per pool. high > 40Mb per pool.<br>Use specific to set a value with the following option."
|
|
||||||
|
|
||||||
[main.php_fpm_config.free_footprint]
|
[main.php_fpm_config.fpm_free_footprint]
|
||||||
|
visible = "fpm_footprint == 'specific'"
|
||||||
ask = "Memory footprint of the service?"
|
ask = "Memory footprint of the service?"
|
||||||
type = "number"
|
type = "number"
|
||||||
default = "0"
|
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."
|
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]
|
[main.php_fpm_config.fpm_usage]
|
||||||
ask = "Expected usage of the service?"
|
ask = "Expected usage"
|
||||||
|
type = "select"
|
||||||
choices = ["low", "medium", "high"]
|
choices = ["low", "medium", "high"]
|
||||||
default = "low"
|
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."
|
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."
|
||||||
|
|
|
@ -56,10 +56,10 @@ set__fpm_footprint() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
set__free_footprint() {
|
set__fpm_free_footprint() {
|
||||||
if [ "$fpm_footprint" == "specific" ]
|
if [ "$fpm_footprint" = "specific" ]
|
||||||
then
|
then
|
||||||
ynh_app_setting_set --app=$app --key=fpm_footprint --value="$free_footprint"
|
ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_free_footprint"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,11 +70,11 @@ set__free_footprint() {
|
||||||
ynh_app_config_validate() {
|
ynh_app_config_validate() {
|
||||||
_ynh_app_config_validate
|
_ynh_app_config_validate
|
||||||
|
|
||||||
if [ "${changed[fpm_usage]}" == "true" ] || [ "${changed[fpm_footprint]}" == "true" ] || [ "${changed[free_footprint]}" == "true" ]; then
|
if [ "${changed[fpm_usage]}" == "true" ] || [ "${changed[fpm_footprint]}" == "true" ] || [ "${changed[fpm_free_footprint]}" == "true" ]; then
|
||||||
# If fpm_footprint is set to 'specific', use $free_footprint value.
|
# If fpm_footprint is set to 'specific', use $fpm_free_footprint value.
|
||||||
if [ "$fpm_footprint" == "specific" ]
|
if [ "$fpm_footprint" = "specific" ]
|
||||||
then
|
then
|
||||||
fpm_footprint=$free_footprint
|
fpm_footprint=$fpm_free_footprint
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$fpm_footprint" == "0" ]
|
if [ "$fpm_footprint" == "0" ]
|
||||||
|
|
|
@ -27,6 +27,10 @@ phpversion=$YNH_PHP_VERSION
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
fpm_footprint="low"
|
||||||
|
fpm_free_footprint=0
|
||||||
|
fpm_usage="low"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -101,7 +105,7 @@ chown -R $app:www-data "$final_path"
|
||||||
ynh_script_progression --message="Configuring PHP-FPM..." --weight=5
|
ynh_script_progression --message="Configuring PHP-FPM..." --weight=5
|
||||||
|
|
||||||
# Create a dedicated PHP-FPM config
|
# Create a dedicated PHP-FPM config
|
||||||
ynh_add_fpm_config --usage=low --footprint=low
|
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -25,6 +25,7 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
|
||||||
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
|
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
|
||||||
|
fpm_free_footprint=$(ynh_app_setting_get --app=$app --key=fpm_free_footprint)
|
||||||
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
|
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -54,14 +55,20 @@ ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||||
|
|
||||||
# If fpm_footprint doesn't exist, create it
|
# If fpm_footprint doesn't exist, create it
|
||||||
if [ -z "$fpm_footprint" ]; then
|
if [ -z "$fpm_footprint" ]; then
|
||||||
fpm_footprint=low
|
fpm_footprint=low
|
||||||
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
|
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
|
fi
|
||||||
|
|
||||||
# If fpm_usage doesn't exist, create it
|
# If fpm_usage doesn't exist, create it
|
||||||
if [ -z "$fpm_usage" ]; then
|
if [ -z "$fpm_usage" ]; then
|
||||||
fpm_usage=low
|
fpm_usage=low
|
||||||
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
|
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue