From 1f995ff7f38cb5b5f2bd066e01e363f88aca8f5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 28 Dec 2022 09:05:05 +0100 Subject: [PATCH] Testing (#78) * Upgrade (#68) * Apply example_ynh * Fix melange-de-versions https://forum.yunohost.org/t/melange-de-versions-de-moodle-detectees/19985 * Update manifest.json * Auto-update README Co-authored-by: yunohost-bot * 4.0.2 (#71) * 4.0.2 * Auto-update README Co-authored-by: yunohost-bot * Auto-update README * Bullseye (#73) * Update manifest.json * Auto-update README * Update upgrade * Fix * Auto-update README * Auto-update README Co-authored-by: yunohost-bot * 4.0.3 (#74) * 4.0.3 * Auto-update README Co-authored-by: yunohost-bot * 4.0.4 * Auto-update README * 4.1.0 (#77) * 4.1.0 * Auto-update README * fix PHP * Update config_panel.toml * Update config_panel.toml Co-authored-by: yunohost-bot Co-authored-by: yalh76 Co-authored-by: yunohost-bot --- README.md | 2 +- README_fr.md | 2 +- conf/app.src | 4 ++-- conf/extra_php-fpm.conf | 4 ++++ config_panel.toml | 17 +++++++++++------ manifest.json | 2 +- scripts/config | 14 +++++++------- scripts/install | 8 +++++++- scripts/upgrade | 17 +++++++++++++---- 9 files changed, 47 insertions(+), 23 deletions(-) create mode 100644 conf/extra_php-fpm.conf diff --git a/README.md b/README.md index 2fd59b2..c25c18f 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Moodle is widely used around the world by universities, schools, companies and all manner of organisations and individuals. -**Shipped version:** 4.0.4~ynh1 +**Shipped version:** 4.1.0~ynh1 **Demo:** https://sandbox.moodledemo.net/ diff --git a/README_fr.md b/README_fr.md index db5dd5e..aaa945a 100644 --- a/README_fr.md +++ b/README_fr.md @@ -20,7 +20,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Moodle est largement utilisé dans le monde entier par les universités, les écoles, les entreprises et toutes sortes d'organisations et d'individus. -**Version incluse :** 4.0.4~ynh1 +**Version incluse :** 4.1.0~ynh1 **Démo :** https://sandbox.moodledemo.net/ diff --git a/conf/app.src b/conf/app.src index 033aac6..0a63b22 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/moodle/moodle/archive/v4.0.4.zip -SOURCE_SUM=f1a14cd9a03568f1f6beb61479ef696de61bcf986d63f48f5b29f9c0a18cb597 +SOURCE_URL=https://github.com/moodle/moodle/archive/v4.1.0.zip +SOURCE_SUM=1f7ae1e72e1d7e3b01ae3199ee78dd7b100f21ab3447457ea170ac1a8f96cf20 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true diff --git a/conf/extra_php-fpm.conf b/conf/extra_php-fpm.conf new file mode 100644 index 0000000..0c90ab6 --- /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] = 1G +php_admin_value[post_max_size] = 1G \ No newline at end of file diff --git a/config_panel.toml b/config_panel.toml index d6d68fe..dc274e5 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -7,19 +7,24 @@ name = "Moodle 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 2adecc9..f33d8ea 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Online learning platform", "fr": "Plateforme d'apprentissage en ligne" }, - "version": "4.0.4~ynh1", + "version": "4.1.0~ynh1", "url": "https://moodle.org/", "upstream": { "license": "GPL-3.0-or-later", diff --git a/scripts/config b/scripts/config index 8a9110c..91c2de7 100644 --- a/scripts/config +++ b/scripts/config @@ -56,10 +56,10 @@ set__fpm_footprint() { fi } -set__free_footprint() { - if [ "$fpm_footprint" == "specific" ] +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 [ "$fpm_footprint" == "specific" ] + 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 0493dce..aa31aec 100644 --- a/scripts/install +++ b/scripts/install @@ -30,6 +30,9 @@ app=$YNH_APP_INSTANCE_NAME email=$(ynh_user_get_info --username=$admin --key=mail) password=$(ynh_string_random --length=30) +fpm_footprint="low" +fpm_free_footprint=0 +fpm_usage="low" #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS @@ -51,6 +54,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=admin --value=$admin ynh_app_setting_set --app=$app --key=site_name --value=$site_name +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 @@ -99,7 +105,7 @@ chown -R $app:www-data "$final_path" ynh_script_progression --message="Configuring PHP-FPM..." --weight=1 # 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) #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 2bfcf9e..3568b06 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,7 +24,9 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir) db_name=$(ynh_app_setting_get --app=$app --key=db_name) site_name=$(ynh_app_setting_get --app=$app --key=site_name) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) + 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) #================================================= @@ -76,16 +78,23 @@ fi # If fpm_footprint doesn't exist, create it if [ -z "$fpm_footprint" ]; then - fpm_footprint=low - ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint + fpm_footprint=low + 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 - ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage + fpm_usage=low + ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage fi + # If datadir doesn't exist, create it if [ -z "$datadir" ]; then datadir=$(ynh_app_setting_get --app=$app --key=data_path)