From 7208b741efee465a72d43ac9c471ef65139ea59a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 29 Sep 2022 23:08:15 +0200 Subject: [PATCH] Upgrade config panel (#158) * fix pgp home path in a muti-install context * Update manifest.json * config panel * fix * Update install * Update upgrade --- conf/enigma.config.inc.php | 2 +- config_panel.toml | 17 +++++++++++------ manifest.json | 2 +- scripts/config | 10 +++++----- scripts/install | 11 +++++++++-- scripts/upgrade | 7 +++++++ 6 files changed, 34 insertions(+), 15 deletions(-) diff --git a/conf/enigma.config.inc.php b/conf/enigma.config.inc.php index 8990189..4d13f64 100644 --- a/conf/enigma.config.inc.php +++ b/conf/enigma.config.inc.php @@ -14,7 +14,7 @@ $config['enigma_debug'] = false; // REQUIRED! Keys directory for all users. // Must be writeable by PHP process, and not in the web server document root -$config['enigma_pgp_homedir'] = '__FINALPATH__/plugins/enigma/home'; +$config['enigma_pgp_homedir'] = '/var/www/__APP__/plugins/enigma/home'; // Location of gpg binary. By default it will be auto-detected. // This is also a way to force gpg2 use if there are both 1.x and 2.x on the system. diff --git a/config_panel.toml b/config_panel.toml index 61d6b6f..e18cff6 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -7,19 +7,24 @@ name = "Roundcube configuration" name = "PHP-FPM configuration" [main.php_fpm_config.fpm_footprint] - ask = "Memory footprint of the service?" - choices = ["low", "medium", "high", "specific"] + ask = "Memory footprint" + 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" - help = "low <= 20Mb per pool. medium between 20Mb and 40Mb per pool. high > 40Mb per pool.
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?" 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] - ask = "Expected usage of the service?" + ask = "Expected usage" + 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." + 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." diff --git a/manifest.json b/manifest.json index 3a79c1e..dd43a77 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Open Source Webmail software", "fr": "Webmail Open Source" }, - "version": "1.6.0~ynh2", + "version": "1.6.0~ynh3", "url": "https://roundcube.net/", "upstream": { "license": "GPL-3.0-only", diff --git a/scripts/config b/scripts/config index 3440bd2..91c2de7 100644 --- a/scripts/config +++ b/scripts/config @@ -56,10 +56,10 @@ set__fpm_footprint() { fi } -set__free_footprint() { +set__fpm_free_footprint() { if [ "$fpm_footprint" = "specific" ] 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 } @@ -70,11 +70,11 @@ set__free_footprint() { ynh_app_config_validate() { _ynh_app_config_validate - if [ "${changed[fpm_usage]}" == "true" ] || [ "${changed[fpm_footprint]}" == "true" ] || [ "${changed[free_footprint]}" == "true" ]; then - # If fpm_footprint is set to 'specific', use $free_footprint value. + if [ "${changed[fpm_usage]}" == "true" ] || [ "${changed[fpm_footprint]}" == "true" ] || [ "${changed[fpm_free_footprint]}" == "true" ]; then + # If fpm_footprint is set to 'specific', use $fpm_free_footprint value. if [ "$fpm_footprint" = "specific" ] then - fpm_footprint=$free_footprint + fpm_footprint=$fpm_free_footprint fi if [ "$fpm_footprint" == "0" ] diff --git a/scripts/install b/scripts/install index c9d76fe..0ac4022 100644 --- a/scripts/install +++ b/scripts/install @@ -27,6 +27,10 @@ language=$YNH_APP_ARG_LANGUAGE 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 #================================================= @@ -47,6 +51,9 @@ ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=with_carddav --value=$with_carddav ynh_app_setting_set --app=$app --key=language --value=$language +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 #================================================= # STANDARD MODIFICATIONS @@ -101,8 +108,8 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Configuring PHP-FPM..." --weight=2 -# Create a dedicated PHP-FPM config -ynh_add_fpm_config --usage=low --footprint=low +# Create a dedicated php-fpm config +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 488fb83..85e1acc 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -27,6 +27,7 @@ language=$(ynh_app_setting_get --app=$app --key=language) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) 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) #================================================= @@ -89,6 +90,12 @@ if [ -z "$fpm_footprint" ]; then 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 + # If fpm_usage doesn't exist, create it if [ -z "$fpm_usage" ]; then fpm_usage=low