Browse Source

update

testing
Gabriel Cossette 5 years ago
parent
commit
6f0bdaf821
  1. 16
      config_panel.toml
  2. 4
      manifest.json
  3. 15
      scripts/config
  4. 2
      scripts/install

16
config_panel.toml

@ -40,11 +40,11 @@ name = "Wordpress configuration"
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]
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.free_footprint]
# 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.usage]
ask = "Expected usage of the service?"
@ -57,3 +57,9 @@ name = "Wordpress configuration"
type = "number"
default = "0"
help = "Do not change this value unless you are sure about what you are doing!<br>pm.max_children is automatically defined by this formula: $max_ram / 2 / $footprint<br>You can force that value, and ignore the formula by changing the value here.<br>To reset to the default value, set to 0."
[main.php_fpm_config.version]
ask = "PHP version?"
choices = ["7.0" , "7.1", "7.2", "7.3", "7.4", "8.0"]
default = "7.3"
help = "PHP version"

4
manifest.json

@ -134,7 +134,7 @@
"en": "Choose the PHP version",
"fr": "Choissisez la version de PHP"
},
"choices": ["7.0" , "7.1", "7.2", "7.3", "7.4"],
"choices": ["7.0" , "7.1", "7.2", "7.3", "7.4", "8.0"],
"default": "7.3"
},
{
@ -144,7 +144,7 @@
"en": "Do not enter anything",
"fr": "Ne rien entrer ici"
},
"default": true
"default": false
}
]
}

15
scripts/config

@ -17,6 +17,7 @@ app=$YNH_APP_INSTANCE_NAME
fpm_config_dir=$(ynh_app_setting_get --app=$app --key=fpm_config_dir)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
#=================================================
# LOAD VALUES
@ -67,6 +68,10 @@ if [ -z "$old_php_forced_max_children" ]; then
fi
php_forced_max_children="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FORCE_MAX_CHILDREN:-$old_php_forced_max_children}"
# Version for php
old_phpversion="$(ynh_app_setting_get --app=$app --key=phpversion)"
YNH_PHP_VERSION="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_VERSION:-$old_phpversion}"
#=================================================
# SHOW_CONFIG FUNCTION FOR 'SHOW' COMMAND
#=================================================
@ -84,6 +89,7 @@ show_config() {
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"
ynh_return "YNH_CONFIG_MAIN_PHP_FPM_CONFIG_VERSION=$YNH_PHP_VERSION"
}
#=================================================
@ -116,7 +122,8 @@ apply_config() {
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" ]
[ "$php_forced_max_children" != "$old_php_forced_max_children" ] || \
[ "$YNH_PHP_VERSION" != "$old_phpversion" ]
then
# If fpm_footprint is set to 'specific', use $free_footprint value.
if [ "$fpm_footprint" = "specific" ]
@ -138,7 +145,11 @@ apply_config() {
if [ "$fpm_footprint" != "0" ]
then
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
ynh_add_fpm_config --phpversion=$YNH_PHP_VERSION --usage=$fpm_usage --footprint=$fpm_footprint
old_phpversion=$(sed 's/[\*\.]/\\&/g' <<<"$old_phpversion")
YNH_PHP_VERSION=$(sed 's/[\*\.]/\\&/g' <<<"$YNH_PHP_VERSION")
sed -i "s/php$old_phpversion-fpm-$app\.sock/php$YNH_PHP_VERSION-fpm-$app\.sock/g" /etc/nginx/conf.d/$domain.d/$app.conf
ynh_systemd_action --service_name=nginx --action=reload
else
ynh_print_err --message="When selecting 'specific', you have to set a footprint value into the field below."
fi

2
scripts/install

@ -30,6 +30,7 @@ multisite=$YNH_APP_ARG_MULTISITE
is_public=$YNH_APP_ARG_IS_PUBLIC
repo=$YNH_APP_ARG_REPO
cache=$YNH_APP_ARG_CACHE
phpversion=$YNH_APP_ARG_PHPVERSION
switch=$YNH_APP_ARG_SWITCH
app=$YNH_APP_INSTANCE_NAME
@ -73,6 +74,7 @@ ynh_app_setting_set --app=$app --key=language --value=$language
ynh_app_setting_set --app=$app --key=multisite --value=$multisite
ynh_app_setting_set --app=$app --key=repo --value=$repo
ynh_app_setting_set --app=$app --key=cache --value=$cache
ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion
ynh_app_setting_set --app=$app --key=overwrite_nginx --value=1
ynh_app_setting_set --app=$app --key=overwrite_phpfpm --value=1

Loading…
Cancel
Save