mirror of
https://github.com/YunoHost-Apps/leed_ynh.git
synced 2024-09-03 19:26:32 +02:00
commit
fc31525e15
16 changed files with 61 additions and 387 deletions
10
README.md
10
README.md
|
@ -1,7 +1,7 @@
|
|||
# Leed for YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/leed)  
|
||||
[](https://install-app.yunohost.org/?app=leed)
|
||||
[](https://install-app.yunohost.org/?app=leed)
|
||||
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
||||
|
@ -31,7 +31,7 @@ Use the admin panel of your Leed to configure this app.
|
|||
|
||||
## YunoHost specific features
|
||||
|
||||
* Login secured by fail2ban
|
||||
* Login secured by Fail2Ban
|
||||
|
||||
#### Multi-users support
|
||||
|
||||
|
@ -39,9 +39,8 @@ Not supported.
|
|||
|
||||
#### Supported architectures
|
||||
|
||||
* x86-64b - [](https://ci-apps.yunohost.org/ci/apps/leed/)
|
||||
* x86-64 - [](https://ci-apps.yunohost.org/ci/apps/leed/)
|
||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/leed/)
|
||||
* Jessie x86-64b - [](https://ci-stretch.nohost.me/ci/apps/leed/)
|
||||
|
||||
## Limitations
|
||||
|
||||
|
@ -56,8 +55,7 @@ Not supported.
|
|||
|
||||
---
|
||||
|
||||
Developers infos
|
||||
----------------
|
||||
## Developers infos
|
||||
|
||||
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/leed_ynh/tree/testing).
|
||||
|
||||
|
|
22
README_fr.md
22
README_fr.md
|
@ -1,7 +1,7 @@
|
|||
# Leed pour YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/leed)  
|
||||
[](https://install-app.yunohost.org/?app=leed)
|
||||
[](https://install-app.yunohost.org/?app=leed)
|
||||
|
||||
*[Read this readme in english.](./README.md)*
|
||||
|
||||
|
@ -11,7 +11,7 @@ Si vous n'avez pas YunoHost, merci de regarder [ici](https://yunohost.org/#/inst
|
|||
## Résumé
|
||||
Leed (contraction de Light Feed) est un agrégateur RSS/ATOM minimaliste qui permet la consultation de flux RSS de manière rapide et non intrusive.
|
||||
|
||||
**Version embarquée:** 1.8.3
|
||||
**Version embarquée :** 1.8.3
|
||||
|
||||
## Captures d'écran
|
||||
|
||||
|
@ -27,11 +27,11 @@ Utiliser le panneau d'administration de votre Jenkins pour configurer cette appl
|
|||
|
||||
## Documentation
|
||||
|
||||
* Documentation YunoHost: Il n'y a pas d'autre documentation, n'hésitez pas à contribuer.
|
||||
* Documentation YunoHost : Il n'y a pas d'autre documentation, n'hésitez pas à contribuer.
|
||||
|
||||
## Fonctionnalités spécifiques à YunoHost
|
||||
|
||||
* Login sécurisé par fail2ban
|
||||
* Login sécurisé par Fail2Ban
|
||||
|
||||
#### Support multi-utilisateurs
|
||||
|
||||
|
@ -39,23 +39,21 @@ Non supportée.
|
|||
|
||||
#### Architectures supportées.
|
||||
|
||||
* x86-64b - [](https://ci-apps.yunohost.org/ci/apps/leed/)
|
||||
* x86-64 - [](https://ci-apps.yunohost.org/ci/apps/leed/)
|
||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/leed/)
|
||||
* Jessie x86-64b - [](https://ci-stretch.nohost.me/ci/apps/leed/)
|
||||
|
||||
## Informations additionnelles
|
||||
|
||||
## Liens
|
||||
|
||||
* Reporter un bug: https://github.com/YunoHost-Apps/leed_ynh/issues
|
||||
* Site de Leed: http://leed.idleman.fr/
|
||||
* Dépôt de Leed: http://git.idleman.fr/LeedRSS/Leed
|
||||
* Site de YunoHost: https://yunohost.org/
|
||||
* Reporter un bug : https://github.com/YunoHost-Apps/leed_ynh/issues
|
||||
* Site de Leed : http://leed.idleman.fr/
|
||||
* Dépôt de Leed : http://git.idleman.fr/LeedRSS/Leed
|
||||
* Site de YunoHost : https://yunohost.org/
|
||||
|
||||
---
|
||||
|
||||
Informations à l'intention des développeurs
|
||||
----------------
|
||||
## Informations à l'intention des développeurs
|
||||
|
||||
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/leed_ynh/tree/testing).
|
||||
|
||||
|
|
|
@ -28,13 +28,10 @@
|
|||
upgrade=1 from_commit=8b622d430db9ab860aee156a32086507669243fd
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
incorrect_path=1
|
||||
port_already_use=0
|
||||
change_url=1
|
||||
actions=1
|
||||
config_panel=1
|
||||
;;; Levels
|
||||
Level 5=auto
|
||||
;;; Options
|
||||
Email=
|
||||
Notification=change
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
SOURCE_URL=https://github.com/LeedRSS/Leed/archive/v1.8.3.tar.gz
|
||||
SOURCE_SUM=4fb46124695dfc8e6a3bfa5e48850547
|
||||
SOURCE_SUM_PRG=md5sum
|
||||
SOURCE_SUM=792215b9a4429c66ac52b4619fbda4b664c83ef03543a62a8b58e2c631874001
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=
|
||||
|
|
|
@ -14,7 +14,7 @@ location __PATH__/ {
|
|||
try_files $uri $uri/ index.php;
|
||||
location ~ [^/]\.php(/|$) {
|
||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
|
||||
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param REMOTE_USER $remote_user;
|
||||
|
|
|
@ -8,7 +8,7 @@ name = "Leed configuration"
|
|||
name = "Public access"
|
||||
|
||||
[main.is_public.is_public]
|
||||
ask = "Is it a public website ?"
|
||||
ask = "Is it a public website?"
|
||||
type = "boolean"
|
||||
default = true
|
||||
help = "A public Leed will be accessible for third party apps.<br>By turning on 'anonymous readers' in Leed configuration, you can made your feeds public."
|
||||
|
@ -18,13 +18,13 @@ name = "Leed configuration"
|
|||
name = "Overwriting config files"
|
||||
|
||||
[main.overwrite_files.overwrite_nginx]
|
||||
ask = "Overwrite the nginx config file ?"
|
||||
ask = "Overwrite the nginx config file?"
|
||||
type = "boolean"
|
||||
default = true
|
||||
help = "If the file is overwritten, a backup will be created."
|
||||
|
||||
[main.overwrite_files.overwrite_phpfpm]
|
||||
ask = "Overwrite the php-fpm config file ?"
|
||||
ask = "Overwrite the php-fpm config file?"
|
||||
type = "boolean"
|
||||
default = true
|
||||
help = "If the file is overwritten, a backup will be created."
|
||||
|
@ -34,7 +34,7 @@ name = "Leed configuration"
|
|||
name = "Global configuration"
|
||||
|
||||
[main.global_config.email_type]
|
||||
ask = "Send HTML email to admin ?"
|
||||
ask = "Send HTML email to admin?"
|
||||
type = "boolean"
|
||||
default = true
|
||||
help = "Allow app scripts to send HTML mails instead of plain text."
|
||||
|
@ -44,19 +44,19 @@ name = "Leed configuration"
|
|||
name = "PHP-FPM configuration"
|
||||
|
||||
[main.php_fpm_config.footprint]
|
||||
ask = "Memory footprint of the service ?"
|
||||
ask = "Memory footprint of the service?"
|
||||
choices = ["low", "medium", "high", "specific"]
|
||||
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 ?"
|
||||
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 ?"
|
||||
ask = "Expected usage of the service?"
|
||||
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."
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
"id": "leed",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "A minimalistic RSS feed aggregator which allows quick and non-intrusive reading of feeds.",
|
||||
"fr": "Un agrégateur RSS minimaliste qui permet la consultation de flux RSS de manière rapide et non intrusive."
|
||||
"en": "Minimalistic RSS feed aggregator which allows quick and non-intrusive reading of feeds.",
|
||||
"fr": "Agrégateur RSS minimaliste qui permet la consultation de flux RSS de manière rapide et non intrusive."
|
||||
},
|
||||
"version": "1.8.3~ynh9",
|
||||
"url": "http://leed.idleman.fr/",
|
||||
|
@ -18,7 +18,7 @@
|
|||
"email": "maniackc_dev@crudelis.fr"
|
||||
}],
|
||||
"requirements": {
|
||||
"yunohost": ">= 3.5"
|
||||
"yunohost": ">= 3.8.1"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
|
@ -79,7 +79,7 @@
|
|||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Is it a public website ?",
|
||||
"en": "Is it a public website?",
|
||||
"fr": "Est-ce un site public ?"
|
||||
},
|
||||
"default": false,
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
YNH_PHP_VERSION="7.3"
|
||||
|
||||
|
||||
#=================================================
|
||||
# BACKUP
|
||||
#=================================================
|
||||
|
@ -69,7 +72,7 @@ ynh_multimedia_build_main_dir () {
|
|||
local checksum="806a827ba1902d6911095602a9221181"
|
||||
|
||||
# Download yunohost.multimedia scripts
|
||||
wget -nv https://github.com/YunoHost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz
|
||||
wget -nv https://github.com/YunoHost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz 2>&1
|
||||
|
||||
# Check the control sum
|
||||
echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \
|
||||
|
@ -283,30 +286,6 @@ __PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/service
|
|||
|
||||
#=================================================
|
||||
|
||||
ynh_debian_release () {
|
||||
lsb_release --codename --short
|
||||
}
|
||||
|
||||
is_stretch () {
|
||||
if [ "$(ynh_debian_release)" == "stretch" ]
|
||||
then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
is_jessie () {
|
||||
if [ "$(ynh_debian_release)" == "jessie" ]
|
||||
then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
#=================================================
|
||||
|
||||
ynh_maintenance_mode_ON () {
|
||||
# Load value of $path_url and $domain from the config if their not set
|
||||
if [ -z $path_url ]; then
|
||||
|
@ -596,158 +575,3 @@ ynh_check_ram () {
|
|||
echo $ram
|
||||
fi
|
||||
}
|
||||
|
||||
#=================================================
|
||||
|
||||
# Define the values to configure php-fpm
|
||||
#
|
||||
# usage: ynh_get_scalable_phpfpm --usage=usage --footprint=footprint [--print]
|
||||
# | arg: -f, --footprint - Memory footprint of the service (low/medium/high).
|
||||
# low - Less than 20Mb of ram by pool.
|
||||
# medium - Between 20Mb and 40Mb of ram by pool.
|
||||
# high - More than 40Mb of ram by pool.
|
||||
# Or specify exactly the footprint, the load of the service as Mb by pool instead of having a standard value.
|
||||
# To have this value, use the following command and stress the service.
|
||||
# watch -n0.5 ps -o user,cmd,%cpu,rss -u APP
|
||||
#
|
||||
# | arg: -u, --usage - Expected usage of the service (low/medium/high).
|
||||
# low - Personal usage, behind the sso.
|
||||
# medium - Low usage, few people or/and publicly accessible.
|
||||
# high - High usage, frequently visited website.
|
||||
#
|
||||
# | arg: -p, --print - Print the result
|
||||
#
|
||||
#
|
||||
#
|
||||
# The footprint of the service will be used to defined the maximum footprint we can allow, which is half the maximum RAM.
|
||||
# So it will be used to defined 'pm.max_children'
|
||||
# A lower value for the footprint will allow more children for 'pm.max_children'. And so for
|
||||
# 'pm.start_servers', 'pm.min_spare_servers' and 'pm.max_spare_servers' which are defined from the
|
||||
# value of 'pm.max_children'
|
||||
# NOTE: 'pm.max_children' can't exceed 4 times the number of processor's cores.
|
||||
#
|
||||
# The usage value will defined the way php will handle the children for the pool.
|
||||
# A value set as 'low' will set the process manager to 'ondemand'. Children will start only if the
|
||||
# service is used, otherwise no child will stay alive. This config gives the lower footprint when the
|
||||
# service is idle. But will use more proc since it has to start a child as soon it's used.
|
||||
# Set as 'medium', the process manager will be at dynamic. If the service is idle, a number of children
|
||||
# equal to pm.min_spare_servers will stay alive. So the service can be quick to answer to any request.
|
||||
# The number of children can grow if needed. The footprint can stay low if the service is idle, but
|
||||
# not null. The impact on the proc is a little bit less than 'ondemand' as there's always a few
|
||||
# children already available.
|
||||
# Set as 'high', the process manager will be set at 'static'. There will be always as many children as
|
||||
# 'pm.max_children', the footprint is important (but will be set as maximum a quarter of the maximum
|
||||
# RAM) but the impact on the proc is lower. The service will be quick to answer as there's always many
|
||||
# children ready to answer.
|
||||
ynh_get_scalable_phpfpm () {
|
||||
local legacy_args=ufp
|
||||
# Declare an array to define the options of this helper.
|
||||
declare -Ar args_array=( [u]=usage= [f]=footprint= [p]=print )
|
||||
local usage
|
||||
local footprint
|
||||
local print
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
# Set all characters as lowercase
|
||||
footprint=${footprint,,}
|
||||
usage=${usage,,}
|
||||
print=${print:-0}
|
||||
|
||||
if [ "$footprint" = "low" ]
|
||||
then
|
||||
footprint=20
|
||||
elif [ "$footprint" = "medium" ]
|
||||
then
|
||||
footprint=35
|
||||
elif [ "$footprint" = "high" ]
|
||||
then
|
||||
footprint=50
|
||||
fi
|
||||
|
||||
# Define the way the process manager handle child processes.
|
||||
if [ "$usage" = "low" ]
|
||||
then
|
||||
php_pm=ondemand
|
||||
elif [ "$usage" = "medium" ]
|
||||
then
|
||||
php_pm=dynamic
|
||||
elif [ "$usage" = "high" ]
|
||||
then
|
||||
php_pm=static
|
||||
else
|
||||
ynh_die --message="Does not recognize '$usage' as an usage value."
|
||||
fi
|
||||
|
||||
# Get the total of RAM available, except swap.
|
||||
local max_ram=$(ynh_check_ram --no_swap)
|
||||
|
||||
less0() {
|
||||
# Do not allow value below 1
|
||||
if [ $1 -le 0 ]
|
||||
then
|
||||
echo 1
|
||||
else
|
||||
echo $1
|
||||
fi
|
||||
}
|
||||
|
||||
# Define pm.max_children
|
||||
# The value of pm.max_children is the total amount of ram divide by 2 and divide again by the footprint of a pool for this app.
|
||||
# So if php-fpm start the maximum of children, it won't exceed half of the ram.
|
||||
php_max_children=$(( $max_ram / 2 / $footprint ))
|
||||
# If process manager is set as static, use half less children.
|
||||
# Used as static, there's always as many children as the value of pm.max_children
|
||||
if [ "$php_pm" = "static" ]
|
||||
then
|
||||
php_max_children=$(( $php_max_children / 2 ))
|
||||
fi
|
||||
php_max_children=$(less0 $php_max_children)
|
||||
|
||||
# To not overload the proc, limit the number of children to 4 times the number of cores.
|
||||
local core_number=$(nproc)
|
||||
local max_proc=$(( $core_number * 4 ))
|
||||
if [ $php_max_children -gt $max_proc ]
|
||||
then
|
||||
php_max_children=$max_proc
|
||||
fi
|
||||
|
||||
if [ "$php_pm" = "dynamic" ]
|
||||
then
|
||||
# Define pm.start_servers, pm.min_spare_servers and pm.max_spare_servers for a dynamic process manager
|
||||
php_min_spare_servers=$(( $php_max_children / 8 ))
|
||||
php_min_spare_servers=$(less0 $php_min_spare_servers)
|
||||
|
||||
php_max_spare_servers=$(( $php_max_children / 2 ))
|
||||
php_max_spare_servers=$(less0 $php_max_spare_servers)
|
||||
|
||||
php_start_servers=$(( $php_min_spare_servers + ( $php_max_spare_servers - $php_min_spare_servers ) /2 ))
|
||||
php_start_servers=$(less0 $php_start_servers)
|
||||
else
|
||||
php_min_spare_servers=0
|
||||
php_max_spare_servers=0
|
||||
php_start_servers=0
|
||||
fi
|
||||
|
||||
if [ $print -eq 1 ]
|
||||
then
|
||||
ynh_debug --message="Footprint=${footprint}Mb by pool."
|
||||
ynh_debug --message="Process manager=$php_pm"
|
||||
ynh_debug --message="Max RAM=${max_ram}Mb"
|
||||
if [ "$php_pm" != "static" ]; then
|
||||
ynh_debug --message="\nMax estimated footprint=$(( $php_max_children * $footprint ))"
|
||||
ynh_debug --message="Min estimated footprint=$(( $php_min_spare_servers * $footprint ))"
|
||||
fi
|
||||
if [ "$php_pm" = "dynamic" ]; then
|
||||
ynh_debug --message="Estimated average footprint=$(( $php_max_spare_servers * $footprint ))"
|
||||
elif [ "$php_pm" = "static" ]; then
|
||||
ynh_debug --message="Estimated footprint=$(( $php_max_children * $footprint ))"
|
||||
fi
|
||||
ynh_debug --message="\nRaw php-fpm values:"
|
||||
ynh_debug --message="pm.max_children = $php_max_children"
|
||||
if [ "$php_pm" = "dynamic" ]; then
|
||||
ynh_debug --message="pm.start_servers = $php_start_servers"
|
||||
ynh_debug --message="pm.min_spare_servers = $php_min_spare_servers"
|
||||
ynh_debug --message="pm.max_spare_servers = $php_max_spare_servers"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -1,132 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Create a dedicated php-fpm config
|
||||
#
|
||||
# usage 1: ynh_add_fpm_config [--phpversion=7.X] [--use_template]
|
||||
# | arg: -v, --phpversion - Version of php to use.
|
||||
# | arg: -t, --use_template - Use this helper in template mode.
|
||||
#
|
||||
# -----------------------------------------------------------------------------
|
||||
#
|
||||
# usage 2: ynh_add_fpm_config [--phpversion=7.X] --usage=usage --footprint=footprint
|
||||
# | arg: -v, --phpversion - Version of php to use.#
|
||||
# | arg: -f, --footprint - Memory footprint of the service (low/medium/high).
|
||||
# low - Less than 20Mb of ram by pool.
|
||||
# medium - Between 20Mb and 40Mb of ram by pool.
|
||||
# high - More than 40Mb of ram by pool.
|
||||
# Or specify exactly the footprint, the load of the service as Mb by pool instead of having a standard value.
|
||||
# To have this value, use the following command and stress the service.
|
||||
# watch -n0.5 ps -o user,cmd,%cpu,rss -u APP
|
||||
#
|
||||
# | arg: -u, --usage - Expected usage of the service (low/medium/high).
|
||||
# low - Personal usage, behind the sso.
|
||||
# medium - Low usage, few people or/and publicly accessible.
|
||||
# high - High usage, frequently visited website.
|
||||
#
|
||||
# Requires YunoHost version 2.7.2 or higher.
|
||||
ynh_add_fpm_config () {
|
||||
# Declare an array to define the options of this helper.
|
||||
local legacy_args=vtuf
|
||||
declare -Ar args_array=( [v]=phpversion= [t]=use_template [u]=usage= [f]=footprint= )
|
||||
local phpversion
|
||||
local use_template
|
||||
local usage
|
||||
local footprint
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
# The default behaviour is to use the template.
|
||||
use_template="${use_template:-1}"
|
||||
usage="${usage:-}"
|
||||
footprint="${footprint:-}"
|
||||
if [ -n "$usage" ] || [ -n "$footprint" ]; then
|
||||
use_template=0
|
||||
fi
|
||||
|
||||
# Configure PHP-FPM 7.0 by default
|
||||
phpversion="${phpversion:-7.0}"
|
||||
|
||||
local fpm_config_dir="/etc/php/$phpversion/fpm"
|
||||
local fpm_service="php${phpversion}-fpm"
|
||||
# Configure PHP-FPM 5 on Debian Jessie
|
||||
if [ "$(ynh_get_debian_release)" == "jessie" ]; then
|
||||
fpm_config_dir="/etc/php5/fpm"
|
||||
fpm_service="php5-fpm"
|
||||
fi
|
||||
ynh_app_setting_set --app=$app --key=fpm_config_dir --value="$fpm_config_dir"
|
||||
ynh_app_setting_set --app=$app --key=fpm_service --value="$fpm_service"
|
||||
finalphpconf="$fpm_config_dir/pool.d/$app.conf"
|
||||
ynh_backup_if_checksum_is_different --file="$finalphpconf"
|
||||
|
||||
if [ $use_template -eq 1 ]
|
||||
then
|
||||
# Usage 1, use the template in ../conf/php-fpm.conf
|
||||
sudo cp ../conf/php-fpm.conf "$finalphpconf"
|
||||
ynh_replace_string --match_string="__NAMETOCHANGE__" --replace_string="$app" --target_file="$finalphpconf"
|
||||
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$finalphpconf"
|
||||
ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="$finalphpconf"
|
||||
ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$phpversion" --target_file="$finalphpconf"
|
||||
|
||||
else
|
||||
# Store settings
|
||||
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$footprint
|
||||
ynh_app_setting_set --app=$app --key=fpm_usage --value=$usage
|
||||
|
||||
# Usage 2, generate a php-fpm config file with ynh_get_scalable_phpfpm
|
||||
ynh_get_scalable_phpfpm --usage=$usage --footprint=$footprint
|
||||
|
||||
# Copy the default file
|
||||
sudo cp "$fpm_config_dir/pool.d/www.conf" "$finalphpconf"
|
||||
|
||||
# Replace standard variables into the default file
|
||||
ynh_replace_string --match_string="^\[www\]" --replace_string="[$app]" --target_file="$finalphpconf"
|
||||
ynh_replace_string --match_string=".*listen = .*" --replace_string="listen = /var/run/php/php7.0-fpm-$app.sock" --target_file="$finalphpconf"
|
||||
ynh_replace_string --match_string="^user = .*" --replace_string="user = $app" --target_file="$finalphpconf"
|
||||
ynh_replace_string --match_string="^group = .*" --replace_string="group = $app" --target_file="$finalphpconf"
|
||||
ynh_replace_string --match_string=".*chdir = .*" --replace_string="chdir = $final_path" --target_file="$finalphpconf"
|
||||
|
||||
# Configure fpm children
|
||||
ynh_replace_string --match_string=".*pm = .*" --replace_string="pm = $php_pm" --target_file="$finalphpconf"
|
||||
ynh_replace_string --match_string=".*pm.max_children = .*" --replace_string="pm.max_children = $php_max_children" --target_file="$finalphpconf"
|
||||
ynh_replace_string --match_string=".*pm.max_requests = .*" --replace_string="pm.max_requests = 500" --target_file="$finalphpconf"
|
||||
ynh_replace_string --match_string=".*request_terminate_timeout = .*" --replace_string="request_terminate_timeout = 1d" --target_file="$finalphpconf"
|
||||
if [ "$php_pm" = "dynamic" ]
|
||||
then
|
||||
ynh_replace_string --match_string=".*pm.start_servers = .*" --replace_string="pm.start_servers = $php_start_servers" --target_file="$finalphpconf"
|
||||
ynh_replace_string --match_string=".*pm.min_spare_servers = .*" --replace_string="pm.min_spare_servers = $php_min_spare_servers" --target_file="$finalphpconf"
|
||||
ynh_replace_string --match_string=".*pm.max_spare_servers = .*" --replace_string="pm.max_spare_servers = $php_max_spare_servers" --target_file="$finalphpconf"
|
||||
elif [ "$php_pm" = "ondemand" ]
|
||||
then
|
||||
ynh_replace_string --match_string=".*pm.process_idle_timeout = .*" --replace_string="pm.process_idle_timeout = 10s" --target_file="$finalphpconf"
|
||||
fi
|
||||
|
||||
# Comment unused parameters
|
||||
if [ "$php_pm" != "dynamic" ]
|
||||
then
|
||||
ynh_replace_string --match_string=".*\(pm.start_servers = .*\)" --replace_string=";\1" --target_file="$finalphpconf"
|
||||
ynh_replace_string --match_string=".*\(pm.min_spare_servers = .*\)" --replace_string=";\1" --target_file="$finalphpconf"
|
||||
ynh_replace_string --match_string=".*\(pm.max_spare_servers = .*\)" --replace_string=";\1" --target_file="$finalphpconf"
|
||||
fi
|
||||
if [ "$php_pm" != "ondemand" ]
|
||||
then
|
||||
ynh_replace_string --match_string=".*\(pm.process_idle_timeout = .*\)" --replace_string=";\1" --target_file="$finalphpconf"
|
||||
fi
|
||||
|
||||
# Concatene the extra config.
|
||||
if [ -e ../conf/extra_php-fpm.conf ]; then
|
||||
cat ../conf/extra_php-fpm.conf >> "$finalphpconf"
|
||||
fi
|
||||
fi
|
||||
sudo chown root: "$finalphpconf"
|
||||
ynh_store_file_checksum --file="$finalphpconf"
|
||||
|
||||
if [ -e "../conf/php-fpm.ini" ]
|
||||
then
|
||||
echo "Packagers ! Please do not use a separate php ini file, merge your directives in the pool file instead." >&2
|
||||
finalphpini="$fpm_config_dir/conf.d/20-$app.ini"
|
||||
ynh_backup_if_checksum_is_different "$finalphpini"
|
||||
sudo cp ../conf/php-fpm.ini "$finalphpini"
|
||||
sudo chown root: "$finalphpini"
|
||||
ynh_store_file_checksum "$finalphpini"
|
||||
fi
|
||||
ynh_systemd_action --service_name=$fpm_service --action=reload
|
||||
}
|
|
@ -19,50 +19,47 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=2
|
||||
ynh_print_info --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
|
||||
#=================================================
|
||||
# STANDARD BACKUP STEPS
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
ynh_print_info --message="Declaring files to be backed up..."
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the main app directory..."
|
||||
|
||||
CHECK_SIZE "$final_path"
|
||||
ynh_backup --src_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# BACKUP NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up nginx web server configuration..."
|
||||
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up php-fpm configuration..."
|
||||
|
||||
ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf"
|
||||
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the MySQL database..." --weight=2
|
||||
|
||||
ynh_mysql_dump_db --database="$db_name" > db.sql
|
||||
CHECK_SIZE "db.sql"
|
||||
|
||||
#=================================================
|
||||
# BACKUP FAIL2BAN CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up fail2ban configuration"
|
||||
|
||||
ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
|
||||
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
|
||||
|
@ -72,7 +69,6 @@ ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
|
|||
#=================================================
|
||||
# BACKUP THE CRON FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up cron file"
|
||||
|
||||
ynh_backup --src_path="/etc/cron.d/$app"
|
||||
|
||||
|
@ -80,4 +76,4 @@ ynh_backup --src_path="/etc/cron.d/$app"
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last
|
||||
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
|
|
|
@ -65,7 +65,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating nginx web server configuration..." --weight=2
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
|
||||
|
||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
|
||||
|
@ -121,7 +121,7 @@ ynh_mysql_execute_as_root --sql="UPDATE leed_configuration SET value='$domain_pa
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading nginx web server..."
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
source _ynh_add_fpm_config
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
source _ynh_add_fpm_config
|
||||
|
||||
#=================================================
|
||||
# MANAGE FAILURE OF THE SCRIPT
|
||||
|
@ -77,9 +76,9 @@ ynh_setup_source --dest_dir="$final_path"
|
|||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring nginx web server..." --weight=2
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
||||
|
||||
# Create a dedicated nginx config
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
|
@ -93,17 +92,18 @@ ynh_system_user_create --username=$app
|
|||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring php-fpm..." --weight=2
|
||||
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
|
||||
|
||||
# Create a dedicated php-fpm config
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config --usage=low --footprint=low
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# SETTING UP WITH CURL
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing Leed with Curl..." --weight=5
|
||||
ynh_script_progression --message="Installing Leed with cURL..." --weight=5
|
||||
|
||||
# Set right permissions for curl install
|
||||
chown -R $app: $final_path
|
||||
|
@ -152,7 +152,7 @@ chown -R $app $final_path/cache $final_path/plugins $final_path/updates
|
|||
#=================================================
|
||||
# SETUP FAIL2BAN
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring fail2ban..." --weight=9
|
||||
ynh_script_progression --message="Configuring Fail2Ban..." --weight=9
|
||||
|
||||
# Create a dedicated fail2ban config
|
||||
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="PHP message: Leed: wrong login for .* client: <HOST>" --max_retry=5
|
||||
|
@ -175,7 +175,7 @@ fi
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading nginx web server..." --weight=3
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=3
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
|
|
@ -49,15 +49,15 @@ ynh_remove_nginx_config
|
|||
#=================================================
|
||||
# REMOVE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing php-fpm configuration..."
|
||||
ynh_script_progression --message="Removing PHP-FPM configuration..."
|
||||
|
||||
# Remove the dedicated php-fpm config
|
||||
# Remove the dedicated PHP-FPM config
|
||||
ynh_remove_fpm_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE FAIL2BAN CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing fail2ban configuration..." --weight=5
|
||||
ynh_script_progression --message="Removing Fail2Ban configuration..." --weight=5
|
||||
|
||||
# Remove the dedicated fail2ban config
|
||||
ynh_remove_fail2ban_config
|
||||
|
|
|
@ -28,6 +28,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
|
|||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
|
@ -82,7 +83,7 @@ ynh_system_user_create --username=$app
|
|||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf"
|
||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE FAIL2BAN CONFIGURATION
|
||||
|
@ -114,7 +115,7 @@ chown -R $app $final_path/cache $final_path/plugins $final_path/updates
|
|||
#=================================================
|
||||
ynh_script_progression --message="Reloading nginx web server and php-fpm..."
|
||||
|
||||
ynh_systemd_action --service_name=php7.0-fpm --action=reload
|
||||
ynh_systemd_action --service_name=php${phpversion}-fpm --action=reload
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
source _ynh_add_fpm_config
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
|
@ -31,6 +30,7 @@ admin_mail_html=$(ynh_app_setting_get --app=$app --key=admin_mail_html)
|
|||
|
||||
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
|
||||
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
|
@ -132,13 +132,6 @@ ynh_clean_setup () {
|
|||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# CHECK THE PATH
|
||||
#=================================================
|
||||
|
||||
# Normalize the URL path syntax
|
||||
path_url=$(ynh_normalize_url_path --path_url=$path_url)
|
||||
|
||||
#=================================================
|
||||
# ACTIVATE MAINTENANCE MODE
|
||||
#=================================================
|
||||
|
@ -186,7 +179,7 @@ ynh_system_user_create --username=$app
|
|||
# Overwrite the php-fpm configuration only if it's allowed
|
||||
if [ $overwrite_phpfpm -eq 1 ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=2
|
||||
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
|
||||
fi
|
||||
|
@ -226,7 +219,7 @@ chown -R $app $final_path/cache $final_path/plugins $final_path/updates
|
|||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading Leed with curl..." --weight=4
|
||||
ynh_script_progression --message="Upgrading Leed with cURL..." --weight=4
|
||||
# Set the app as temporarily public for curl call
|
||||
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
|
||||
# Regen SSOwat configuration
|
||||
|
@ -240,7 +233,7 @@ fi
|
|||
#=================================================
|
||||
# UPGRADE FAIL2BAN
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reconfiguring fail2ban..." --weight=8
|
||||
ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=8
|
||||
|
||||
# Create a dedicated fail2ban config
|
||||
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="PHP message: Leed: wrong login for .* client: <HOST>" --max_retry=5
|
||||
|
|
Loading…
Add table
Reference in a new issue