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 #85 from YunoHost-Apps/4.3

4.3
This commit is contained in:
Alexandre Aubin 2021-11-30 19:08:39 +01:00 committed by GitHub
commit 17b96de2a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 40 additions and 37 deletions

View file

@ -3,4 +3,3 @@ SOURCE_SUM=5a4b543ff62fed497a0e0c429389cd730df1cc59327567df02c3dff834af069a
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -3,4 +3,3 @@ SOURCE_SUM=6ee7e6d0008dbbad448718ecd2d714173a1f4e17698805621e1cd1a6e802eb75
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -3,9 +3,6 @@ location __PATH__/ {
alias __FINALPATH__/;
index index.php;
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
client_max_body_size 30m;
# Add headers to serve security related headers

View file

@ -37,7 +37,7 @@
}
],
"requirements": {
"yunohost": ">= 4.1.0"
"yunohost": ">= 4.3.0"
},
"multi_instance": true,
"services": [
@ -47,8 +47,7 @@
"install": [
{
"name": "domain",
"type": "domain",
"example": "example.org"
"type": "domain"
},
{
"name": "path",
@ -58,8 +57,7 @@
},
{
"name": "admin",
"type": "user",
"example": "johndoe"
"type": "user"
},
{
"name": "is_public",

View file

@ -8,22 +8,8 @@
YNH_PHP_VERSION="7.3"
# dependencies used by the app
extra_php_dependencies="php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-dom php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-ldap"
pkg_dependencies="php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-dom php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-ldap"
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
# Execute a command as another user
# usage: exec_as USER COMMAND [ARG ...]
exec_as() {
local USER=$1
shift 1
if [[ $USER = $(whoami) ]]
then
eval $@
else
sudo -u "$USER" $@
fi
}

View file

@ -36,8 +36,6 @@ ynh_script_progression --message="Validating installation parameters..." --weigh
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder"
# Check web path availability
ynh_webpath_available --domain=$domain --path_url=$path_url
# Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
@ -51,6 +49,13 @@ 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=language --value=$language
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
@ -84,7 +89,7 @@ ynh_add_nginx_config
ynh_script_progression --message="Configuring PHP-FPM..." --weight=3
# Create a dedicated php-fpm config
ynh_add_fpm_config --usage=medium --footprint=medium --package="$extra_php_dependencies"
ynh_add_fpm_config --usage=medium --footprint=medium
#=================================================
# GENERIC FINALIZATION
@ -108,8 +113,8 @@ ynh_script_progression --message="Installing and configuring LDAP plugin..." --w
ynh_setup_source --dest_dir="$final_path/user/plugins/login-ldap" --source_id="ldap"
# Preparing config
exec_as $app mkdir -p "$final_path/user/config/plugins/login-ldap"
exec_as $app touch "$final_path/user/accounts/admin.yaml"
ynh_exec_as $app mkdir -p "$final_path/user/config/plugins/login-ldap"
ynh_exec_as $app touch "$final_path/user/accounts/admin.yaml"
# Setting up config
ynh_add_config --template="../conf/login-ldap.yaml" --destination="$final_path/user/config/plugins/login-ldap.yaml"

View file

@ -61,6 +61,14 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=2
# Remove the dedicated php-fpm config
ynh_remove_fpm_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -40,8 +40,7 @@ fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD RESTORATION STEPS
@ -90,8 +89,13 @@ ynh_restore_file --origin_path="/etc/cron.d/$app"
# Restore the file first, so it can have a backup if different
ynh_restore_file --origin_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf"
# Recreate a dedicated php-fpm config
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies"
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# GENERIC FINALIZATION

View file

@ -115,6 +115,13 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
# Create a dedicated nginx config
ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
@ -129,7 +136,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path
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 --package="$extra_php_dependencies"
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
# Delete existing ini configuration file (backward compatibility)
if [ -f /etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini ]; then
@ -146,8 +153,8 @@ ynh_script_progression --message="Installing and configuring LDAP plugin..." --w
# Download LDAP source
ynh_setup_source --dest_dir="$final_path/user/plugins/login-ldap" --source_id="ldap"
exec_as $app mkdir -p "$final_path/user/config/plugins/login-ldap"
exec_as $app touch "$final_path/user/accounts/admin.yaml"
ynh_exec_as $app mkdir -p "$final_path/user/config/plugins/login-ldap"
ynh_exec_as $app touch "$final_path/user/accounts/admin.yaml"
ynh_add_config --template="../conf/login-ldap.yaml" --destination="$final_path/user/config/plugins/login-ldap.yaml"
chown $app:$app "$final_path/user/config/plugins/login-ldap.yaml"