1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/grav_ynh.git synced 2024-09-03 19:16:01 +02:00

Merge pull request #156 from YunoHost-Apps/testing

Testing
This commit is contained in:
Alexandre Aubin 2024-01-28 17:46:05 +01:00 committed by GitHub
commit 09fb1b0cb0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 12 additions and 131 deletions

View file

@ -19,7 +19,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
Grav is a modern open source flat-file CMS.
**Shipped version:** 1.7.42.3~ynh1
**Shipped version:** 1.7.44~ynh1
**Demo:** https://getgrav.org/downloads/themes

View file

@ -19,7 +19,7 @@ Si vous navez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po
Un CMS moderne basé sur des fichiers plats
**Version incluse :** 1.7.42.3~ynh1
**Version incluse :** 1.7.44~ynh1
**Démo :** https://getgrav.org/downloads/themes

View file

@ -17,29 +17,3 @@ name = "Grav configuration"
optional = true
visible = "with_sftp"
help = "If a password already exists, leave blank and it will not be replaced."
[main.php_fpm_config]
name = "PHP-FPM configuration"
[main.php_fpm_config.fpm_footprint]
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"
[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"
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."

View file

@ -7,4 +7,4 @@
1. `cd __INSTALL_DIR__`
2. `sudo -u __APP__ php__PHPVERSION__ bin/grav ...` ou `sudo -u __APP__ php__PHPVERSION__ bin/gpm ...`
* Vous pouvez installer les extensions soit via le panneau d'administration, soit via GPM.
* Si vous installez Grav à la racine d'un domaine, sachez que les chemins d'accès commançant par `/yunohost` sont réservés.
* Si vous installez Grav à la racine d'un domaine, sachez que les chemins d'accès commençant par `/yunohost` sont réservés.

View file

@ -5,7 +5,7 @@ name = "Grav"
description.en = "Modern open source flat-file CMS"
description.fr = "CMS moderne basé sur des fichiers plats"
version = "1.7.42.3~ynh1"
version = "1.7.44~ynh1"
maintainers = ["tituspijean"]
@ -63,14 +63,14 @@ ram.runtime = "50M"
autoupdate.upstream = "https://github.com/trilbymedia/grav-plugin-login-ldap"
[resources.sources.main]
url = "https://github.com/getgrav/grav/releases/download/1.7.42.3/grav-admin-v1.7.42.3.zip"
sha256 = "243512b322d5562e620346d6b9fba33d5617c4531a685d22acfd313621bd00e7"
url = "https://github.com/getgrav/grav/releases/download/1.7.44/grav-admin-v1.7.44.zip"
sha256 = "e1ed0746f5c107f2e6d8f2174d8bac25abe07ccf7f8eec1e6d65c4dc63908fa5"
autoupdate.strategy = "latest_github_release"
autoupdate.asset = "grav-admin.*.zip"
[resources.sources.app-upgrade]
url = "https://github.com/getgrav/grav/releases/download/1.7.42.3/grav-update-v1.7.42.3.zip"
sha256 = "3932e6c40101233b6e7369b989feb5ee942ec92261a9102fa6343fb7d9826ad9"
url = "https://github.com/getgrav/grav/releases/download/1.7.44/grav-update-v1.7.44.zip"
sha256 = "d3766001bb3711f7c8530b0d2e8ab26c7de7bca50c1cc81b8f4792a4b926001f"
autoupdate.strategy = "latest_github_release"
autoupdate.asset = "grav-update.*.zip"

View file

@ -1,55 +1,10 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
#=================================================
# SPECIFIC GETTERS FOR TOML SHORT KEY
#=================================================
get__fpm_footprint() {
# Free footprint value for php-fpm
# Check if current_fpm_footprint is an integer
if [ "$current_fpm_footprint" -eq "$current_fpm_footprint" ] 2> /dev/null
then
echo "specific"
else
echo "$current_fpm_footprint"
fi
}
get__free_footprint() {
# Free footprint value for php-fpm
# Check if current_fpm_footprint is an integer
if [ "$current_fpm_footprint" -eq "$current_fpm_footprint" ] 2> /dev/null
then
# If current_fpm_footprint is an integer, that's a numeric value for the footprint
echo "$current_fpm_footprint"
else
echo "0"
fi
}
#=================================================
# SPECIFIC VALIDATORS FOR TOML SHORT KEYS
#=================================================
#=================================================
# SPECIFIC SETTERS FOR TOML SHORT KEYS
#=================================================
@ -61,20 +16,6 @@ set__password() {
fi
}
set__fpm_footprint() {
if [ "$fpm_footprint" != "specific" ]
then
ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_footprint"
fi
}
set__fpm_free_footprint() {
if [ "$fpm_footprint" = "specific" ]
then
ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_free_footprint"
fi
}
#=================================================
# GENERIC FINALIZATION
#=================================================
@ -86,20 +27,6 @@ ynh_app_config_validate() {
then
ynh_die --message="You need to set a password to enable SSH and SFTP"
fi
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=$fpm_free_footprint
fi
if [ "$fpm_footprint" == "0" ]
then
ynh_print_err --message="When selecting 'specific', you have to set a footprint value into the field below."
exit 0
fi
fi
}
ynh_app_config_apply() {
@ -119,8 +46,6 @@ ynh_app_config_apply() {
ynh_system_user_del_group --username=$app --groups="sftp.app ssh.app"
usermod --shel /usr/sbin/nologin $app
fi
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
}
ynh_app_config_run $1

View file

@ -12,9 +12,6 @@ source /usr/share/yunohost/helpers
# Initialize the SFTP setting for the config panel
ynh_app_setting_set --app=$app --key=with_sftp --value="false"
ynh_app_setting_set --app=$app --key=password --value=$(ynh_string_random)
ynh_app_setting_set --app=$app --key=fpm_footprint --value="medium"
ynh_app_setting_set --app=$app --key=fpm_free_footprint --value="0"
ynh_app_setting_set --app=$app --key=fpm_usage --value="medium"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -38,7 +35,9 @@ find "$install_dir" -type d -exec chmod +s {} \;
ynh_script_progression --message="Configuring PHP-FPM..." --weight=3
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=medium --footprint=medium
ynh_app_setting_set --app=$app --key=fpm_footprint --value="medium"
ynh_app_setting_set --app=$app --key=fpm_usage --value="medium"
ynh_add_fpm_config
#=================================================
# NGINX CONFIGURATION

View file

@ -23,29 +23,12 @@ upgrade_type=$(ynh_check_app_version_changed)
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# If fpm_footprint doesn't exist, create it
if [ -z "${fpm_footprint:-}" ]; then
fpm_footprint=medium
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
fi
# If fpm_usage doesn't exist, create it
if [ -z "${fpm_usage:-}" ]; then
fpm_usage=medium
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
fi
# If with_sftp or password don't exist, create them
if [ -z "${with_sftp:-}" ] || [ -z "${password:-}" ]; then
ynh_app_setting_set --app=$app --key=with_sftp --value="false"
ynh_app_setting_set --app=$app --key=password --value=$(ynh_string_random)
fi
# Delete existing ini configuration file (backward compatibility)
if [ -f /etc/php/$phpversion/fpm/conf.d/20-$app.ini ]; then
ynh_secure_remove --file=/etc/php/$phpversion/fpm/conf.d/20-$app.ini
fi
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -72,7 +55,7 @@ find "$install_dir" -type d -exec chmod +s {} \;
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
ynh_add_fpm_config
#=================================================
# NGINX CONFIGURATION