From 153cc2e65656265378bfb54107c9be0e246fc52b Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 5 Dec 2020 10:36:07 +0100 Subject: [PATCH 01/14] Small typos --- check_process | 2 -- config_panel.toml | 20 ++++++++++---------- scripts/_common.sh | 8 ++++++++ scripts/change_url | 18 +++++++++--------- scripts/install | 28 ++++++++++++++-------------- scripts/remove | 12 ++++++------ scripts/restore | 4 ++-- scripts/upgrade | 23 ++++++++--------------- 8 files changed, 57 insertions(+), 58 deletions(-) diff --git a/check_process b/check_process index ba54d2f..f6a2d98 100644 --- a/check_process +++ b/check_process @@ -48,8 +48,6 @@ upgrade=1 backup_restore=1 multi_instance=1 -;;; Levels - Level 5=auto ;;; Options Email= Notification=change diff --git a/config_panel.toml b/config_panel.toml index c96a294..10e11b1 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -9,7 +9,7 @@ name = "Wordpress configuration" name = "Public access" [main.is_public.is_public] - ask = "Is it a public WordPress site ?" + ask = "Is it a public WordPress site?" type = "boolean" default = true @@ -18,13 +18,13 @@ name = "Wordpress 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 = "Wordpress 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,25 +44,25 @@ name = "Wordpress 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.
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.
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." [main.php_fpm_config.force_max_children] - ask = "Force the value of pm.max_children ?" + ask = "Force the value of pm.max_children?" type = "number" default = "0" - help = "Do not change this value unless you're sure about what you're doing !
pm.max_children is automatically defined by this formula: $max_ram / 2 / $footprint
You can force that value, and ignore the formula by changing the value here.
To reset to the default value, set to 0." + help = "Do not change this value unless you are sure about what you are doing!
pm.max_children is automatically defined by this formula: $max_ram / 2 / $footprint
You can force that value, and ignore the formula by changing the value here.
To reset to the default value, set to 0." diff --git a/scripts/_common.sh b/scripts/_common.sh index ad46f82..3c25980 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,5 +1,13 @@ #!/bin/bash +#================================================= +# COMMON VARIABLES +#================================================= + +YNH_PHP_VERSION="7.3" + +extra_php_dependencies="php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-soap php${YNH_PHP_VERSION}-ssh2 php${YNH_PHP_VERSION}-tokenizer" + #================================================= # EXPERIMENTAL HELPERS #================================================= diff --git a/scripts/change_url b/scripts/change_url index d35f7a7..1777c25 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -31,14 +31,14 @@ multisite=$(ynh_app_setting_get --app=$app --key=multisite) if [ $multisite -eq 1 ] then - echo "A multisite installation of Wordpress can't be moved easily. Please have a look at the Wordpress codex to learn more about that." >&2 + echo "A multisite installation of WordPress can't be moved easily. Please have a look at the WordPress codex to learn more about that." >&2 ynh_die --message="https://codex.wordpress.org/Moving_WordPress#Moving_WordPress_Multisite" fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --weight=5 +ynh_script_progression --message="Backing up the app before changing itsURL (may take a while)..." --weight=5 # Backup the current version of the app ynh_backup_before_upgrade @@ -82,25 +82,25 @@ fi #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating nginx web server configuration..." --weight=3 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=3 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf -# Change the path in the nginx config file +# Change the path in the NGINX config file if [ $change_path -eq 1 ] then - # Make a backup of the original nginx config file if modified + # Make a backup of the original NGINX config file if modified ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for nginx helper + # Set global variables for NGINX helper domain="$old_domain" path_url="$new_path" - # Create a dedicated nginx config + # Create a dedicated NGINX config ynh_add_nginx_config fi -# Change the domain for nginx +# Change the domain for NGINX if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location @@ -135,7 +135,7 @@ echo "# Reach everyday wp-cron.php?doing_wp_cron to trig the internal wordpress #================================================= # 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 diff --git a/scripts/install b/scripts/install index 6e4b383..a785a77 100644 --- a/scripts/install +++ b/scripts/install @@ -83,9 +83,9 @@ ynh_setup_source --dest_dir="$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." --weight=3 +ynh_script_progression --message="Configuring NGINX web server..." --weight=3 -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -99,7 +99,7 @@ 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 # If the app is private, set the usage to low, otherwise to high. if [ $is_public -eq 0 ] @@ -117,7 +117,7 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CONFIGURE WP-CONFIG #================================================= -ynh_script_progression --message="Configuring wordpress..." +ynh_script_progression --message="Configuring WordPress..." cp ../conf/wp-config.php $final_path/wp-config.php # Change variables in Wordpress configuration @@ -134,9 +134,9 @@ done #================================================= # SETTING UP WITH CURL #================================================= -ynh_script_progression --message="Installing wordpress with Curl..." --weight=10 +ynh_script_progression --message="Installing wordpress with cURL..." --weight=10 -# Set right permissions for curl install +# Set right permissions for cURL install chown -R $app: $final_path # Set the app as temporarily public for curl call @@ -144,7 +144,7 @@ ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" # Regen SSOwat configuration yunohost app ssowatconf -# Reload Nginx +# Reload NGINX ynh_systemd_action --service_name=nginx --action=reload # Wordpress installation @@ -153,9 +153,9 @@ ynh_local_curl "/wp-admin/install.php?step=2" "&weblog_title=YunoBlog" "user_nam ynh_print_info --message="Please wait during Wordpress installation..." for i in `seq 1 300` do - # The loop waits for wordpress to be installed, or 5 minutes. + # The loop waits for WordPress to be installed, or 5 minutes. if ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name <<< "show tables" | grep --quiet "wp_options"; then - # If the table wp_options is found, wordpress has finished its installation. + # If the table wp_options is found, WordPress has finished its installation. break fi sleep 1 @@ -164,7 +164,7 @@ done #================================================= # INSTALL WORDPRESS PLUGINS #================================================= -ynh_script_progression --message="Installing wordpress plugins..." --weight=20 +ynh_script_progression --message="Installing WordPress plugins..." --weight=20 ynh_exec_warn_less wget --no-verbose https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar --output-document=$final_path/wp-cli.phar wpcli_alias="php$phpversion $final_path/wp-cli.phar --allow-root --path=$final_path" @@ -228,7 +228,7 @@ ynh_store_file_checksum --file="$final_path/wp-config.php" # CREATE A CRON TASK FOR AUTOMATIC UPDATE #================================================= -echo "# Reach everyday wp-cron.php?doing_wp_cron to trig the internal wordpress cron. +echo "# Reach everyday wp-cron.php?doing_wp_cron to trig the internal WordPress cron. 0 3 * * * root wget -q -O - https://$domain$path_url/wp-cron.php?doing_wp_cron >/dev/null 2>&1" > /etc/cron.d/$app #================================================= @@ -246,9 +246,9 @@ chown root: $final_path/wp-config.php #================================================= # SETUP FAIL2BAN #================================================= -ynh_script_progression --message="Configuring fail2ban..." --weight=7 +ynh_script_progression --message="Configuring Fail2Ban..." --weight=7 -# Create a dedicated fail2ban config +# Create a dedicated Fail2Ban config ynh_add_fail2ban_config --logpath="/var/log/auth.log" --failregex="Authentication (attempt for unknown user|failure for) .* from " --max_retry=5 #================================================= @@ -265,7 +265,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 diff --git a/scripts/remove b/scripts/remove index 72ae00d..d48c28a 100755 --- a/scripts/remove +++ b/scripts/remove @@ -41,25 +41,25 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration..." +ynh_script_progression --message="Removing NGINX web server configuration..." -# Remove the dedicated nginx config +# Remove the dedicated NGINX config ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Removing php-fpm configuration..." --weight=2 +ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=2 -# 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=8 +ynh_script_progression --message="Removing Fail2Ban configuration..." --weight=8 -# Remove the dedicated fail2ban config +# Remove the dedicated Fail2Ban config ynh_remove_fail2ban_config #================================================= diff --git a/scripts/restore b/scripts/restore index 06c945c..8927e42 100644 --- a/scripts/restore +++ b/scripts/restore @@ -99,7 +99,7 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # RESTORE THE FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the fail2ban configuration..." --weight=6 +ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=6 ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" @@ -116,7 +116,7 @@ ynh_restore_file "/etc/cron.d/$app" #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=2 +ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=2 ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index a00b33a..e201461 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -161,13 +161,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 #================================================= @@ -179,10 +172,10 @@ ynh_maintenance_mode_ON # NGINX CONFIGURATION #================================================= -# Overwrite the nginx configuration only if it's allowed +# Overwrite the NGINX configuration only if it's allowed if [ $overwrite_nginx -eq 1 ] then - ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=2 + ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 ynh_add_nginx_config fi @@ -198,11 +191,11 @@ ynh_system_user_create --username=$app # PHP-FPM CONFIGURATION #================================================= -# Overwrite the php-fpm configuration only if it's allowed +# 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=4 - # Create a dedicated php-fpm config + ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=4 + # Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint fi @@ -288,9 +281,9 @@ chown root: $final_path/wp-config.php #================================================= # UPGRADE FAIL2BAN #================================================= -ynh_script_progression --message="Reconfiguring fail2ban..." --weight=9 +ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=9 -# Create a dedicated fail2ban config +# Create a dedicated Fail2Ban config ynh_add_fail2ban_config --logpath="/var/log/auth.log" --failregex="Authentication (attempt for unknown user|failure for) .* from " --max_retry=5 #================================================= @@ -311,7 +304,7 @@ fi #================================================= # 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 From 2d72bf87c3e2e674e967058472586b31e0cb5c62 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 9 Dec 2020 15:09:40 +0100 Subject: [PATCH 02/14] Upgrade to v.5.6 --- CHANGELOG.md | 6 ++++++ README.md | 2 +- README_fr.md | 2 +- check_process | 2 -- conf/app.src | 6 +++--- manifest.json | 4 ++-- 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 644f852..2c584b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ Changelog ## Unreleased - Nothing for now... +## [5.6~ynh1]() + +#### Changed +* [Update to 5.6]() + + ## [5.5.0~ynh1](https://github.com/YunoHost-Apps/wordpress_ynh/pull/108) - 2020-08-15 #### Fixed diff --git a/README.md b/README.md index 563ac63..9c4421c 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to WordPress is open source software you can use to create a beautiful website, blog, or app. With this package, you can even activate the [multisite](https://codex.wordpress.org/Glossary#Multisite) option. -**Shipped version:** 5.5.3 +**Shipped version:** 5.6 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 52288ec..2513872 100644 --- a/README_fr.md +++ b/README_fr.md @@ -12,7 +12,7 @@ Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install WordPress est un logiciel libre que vous pouvez utiliser pour créer un site ou un blog. Avec ce package, vous pouvez même activer l'option [multisite](https://codex.wordpress.org/Glossary#Multisite). -**Version incluse :** 5.5.3 +**Version incluse :** 5.6 ## Captures d'écran diff --git a/check_process b/check_process index ba54d2f..f6a2d98 100644 --- a/check_process +++ b/check_process @@ -48,8 +48,6 @@ upgrade=1 backup_restore=1 multi_instance=1 -;;; Levels - Level 5=auto ;;; Options Email= Notification=change diff --git a/conf/app.src b/conf/app.src index 318167d..6fc3d12 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://wordpress.org/wordpress-5.5.3.tar.gz -SOURCE_SUM=c9220f0d5c9c593412da6c0193e43d94 -SOURCE_SUM_PRG=md5sum +SOURCE_URL=https://wordpress.org/wordpress-5.6.tar.gz +SOURCE_SUM=47f466f375557bd4e3e1fff69b1ccbe29053423736b1af8f3dbf9d38c4c5fcd3 +SOURCE_SUM_PRG=sha256sum ARCH_FORMAT=tar.gz SOURCE_IN_SUBDIR=true SOURCE_FILENAME= diff --git a/manifest.json b/manifest.json index 08b7946..96de966 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Create a beautiful blog or website easily", "fr": "Logiciel de création de blog ou de site Web" }, - "version": "5.5.3~ynh1", + "version": "5.6~ynh1", "url": "https://wordpress.org/", "license": "GPL-2.0", "maintainer": { @@ -18,7 +18,7 @@ "email": "maniackc_dev@crudelis.fr" }], "requirements": { - "yunohost": ">= 3.8.1" + "yunohost": ">= 4.0.0" }, "multi_instance": true, "services": [ From d1c12d8791459598189187b047a8707b62f9d529 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 9 Dec 2020 15:22:25 +0100 Subject: [PATCH 03/14] Small typos --- scripts/_common.sh | 6 ++++++ scripts/actions/disable_maintenance | 2 +- scripts/actions/public_private | 2 +- scripts/actions/reset_default_app | 8 ++++---- scripts/change_url | 16 ++++++++-------- scripts/install | 27 ++++++++++++--------------- scripts/remove | 8 ++++---- scripts/restore | 4 ++-- scripts/upgrade | 15 ++++----------- 9 files changed, 42 insertions(+), 46 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index ad46f82..9d5c330 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,5 +1,11 @@ #!/bin/bash +#================================================= +# COMMON VARIABLES +#================================================= + +YNH_PHP_VERSION="7.3" + #================================================= # EXPERIMENTAL HELPERS #================================================= diff --git a/scripts/actions/disable_maintenance b/scripts/actions/disable_maintenance index 6c3c679..03dd196 100755 --- a/scripts/actions/disable_maintenance +++ b/scripts/actions/disable_maintenance @@ -36,7 +36,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) if [ ! -e "$final_path/.maintenance" ] then - ynh_die --message="Wordpress isn't currently under maintenance." --ret_code=0 + ynh_die --message="WordPress isn't currently under maintenance." --ret_code=0 fi #================================================= diff --git a/scripts/actions/public_private b/scripts/actions/public_private index 397212c..d514a76 100755 --- a/scripts/actions/public_private +++ b/scripts/actions/public_private @@ -69,7 +69,7 @@ ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= # 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 diff --git a/scripts/actions/reset_default_app b/scripts/actions/reset_default_app index bdcafb5..fd1ab8d 100755 --- a/scripts/actions/reset_default_app +++ b/scripts/actions/reset_default_app @@ -40,7 +40,7 @@ ynh_maintenance_mode_ON # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1 +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 # Create a dedicated nginx config yunohost app action run $app reset_default_nginx @@ -57,7 +57,7 @@ ynh_system_user_create --username=$app # PHP-FPM CONFIGURATION #================================================= -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 yunohost app action run $app reset_default_phpfpm @@ -86,7 +86,7 @@ find $final_path/ -type d -print0 | xargs -0 chmod 0755 #================================================= # UPGRADE FAIL2BAN #================================================= -ynh_script_progression --message="Reconfiguring fail2ban..." --weight=5 +ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=5 # Create a dedicated fail2ban config ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="PHP message: Leed: wrong login for .* client: " --max_retry=5 @@ -109,7 +109,7 @@ fi #================================================= # 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 diff --git a/scripts/change_url b/scripts/change_url index d35f7a7..1ddec58 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -38,7 +38,7 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --weight=5 +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=5 # Backup the current version of the app ynh_backup_before_upgrade @@ -82,25 +82,25 @@ fi #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating nginx web server configuration..." --weight=3 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=3 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf -# Change the path in the nginx config file +# Change the path in the NGINX config file if [ $change_path -eq 1 ] then - # Make a backup of the original nginx config file if modified + # Make a backup of the original NGINX config file if modified ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for nginx helper + # Set global variables for NGINX helper domain="$old_domain" path_url="$new_path" - # Create a dedicated nginx config + # Create a dedicated NGINX config ynh_add_nginx_config fi -# Change the domain for nginx +# Change the domain for NGINX if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location @@ -135,7 +135,7 @@ echo "# Reach everyday wp-cron.php?doing_wp_cron to trig the internal wordpress #================================================= # 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 diff --git a/scripts/install b/scripts/install index 6e4b383..5ba7b22 100644 --- a/scripts/install +++ b/scripts/install @@ -83,9 +83,9 @@ ynh_setup_source --dest_dir="$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." --weight=3 +ynh_script_progression --message="Configuring NGINX web server..." --weight=3 -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -99,7 +99,7 @@ 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 # If the app is private, set the usage to low, otherwise to high. if [ $is_public -eq 0 ] @@ -108,7 +108,7 @@ then else usage=high fi -# Create a dedicated php-fpm config +# Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=$usage --footprint=medium phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) @@ -117,7 +117,7 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CONFIGURE WP-CONFIG #================================================= -ynh_script_progression --message="Configuring wordpress..." +ynh_script_progression --message="Configuring WordPress..." cp ../conf/wp-config.php $final_path/wp-config.php # Change variables in Wordpress configuration @@ -134,15 +134,13 @@ done #================================================= # SETTING UP WITH CURL #================================================= -ynh_script_progression --message="Installing wordpress with Curl..." --weight=10 +ynh_script_progression --message="Installing wordpress with cURL..." --weight=10 -# Set right permissions for curl install +# Set right permissions for cURL install chown -R $app: $final_path -# Set the app as temporarily public for curl call -ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" -# Regen SSOwat configuration -yunohost app ssowatconf +# Set the app as temporarily public for cURL call +ynh_permission_update --permission "main" --add "visitors" # Reload Nginx ynh_systemd_action --service_name=nginx --action=reload @@ -246,7 +244,7 @@ chown root: $final_path/wp-config.php #================================================= # SETUP FAIL2BAN #================================================= -ynh_script_progression --message="Configuring fail2ban..." --weight=7 +ynh_script_progression --message="Configuring Fail2Ban..." --weight=7 # Create a dedicated fail2ban config ynh_add_fail2ban_config --logpath="/var/log/auth.log" --failregex="Authentication (attempt for unknown user|failure for) .* from " --max_retry=5 @@ -258,14 +256,13 @@ ynh_script_progression --message="Configuring SSOwat..." if [ $is_public -eq 0 ] then - # Remove the public access - ynh_app_setting_delete --app=$app --key=unprotected_uris + ynh_permission_update --permission "main" --remove "visitors" 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 diff --git a/scripts/remove b/scripts/remove index 72ae00d..f7ec142 100755 --- a/scripts/remove +++ b/scripts/remove @@ -41,15 +41,15 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration..." +ynh_script_progression --message="Removing NGINX web server configuration..." -# Remove the dedicated nginx config +# Remove the dedicated NGINX config ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Removing php-fpm configuration..." --weight=2 +ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=2 # Remove the dedicated php-fpm config ynh_remove_fpm_config @@ -57,7 +57,7 @@ ynh_remove_fpm_config #================================================= # REMOVE FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Removing fail2ban configuration..." --weight=8 +ynh_script_progression --message="Removing Fail2Ban configuration..." --weight=8 # Remove the dedicated fail2ban config ynh_remove_fail2ban_config diff --git a/scripts/restore b/scripts/restore index 06c945c..8927e42 100644 --- a/scripts/restore +++ b/scripts/restore @@ -99,7 +99,7 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # RESTORE THE FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the fail2ban configuration..." --weight=6 +ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=6 ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" @@ -116,7 +116,7 @@ ynh_restore_file "/etc/cron.d/$app" #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=2 +ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=2 ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index a00b33a..f40c431 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -161,13 +161,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 #================================================= @@ -182,7 +175,7 @@ ynh_maintenance_mode_ON # Overwrite the nginx configuration only if it's allowed if [ $overwrite_nginx -eq 1 ] then - ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=2 + ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 ynh_add_nginx_config fi @@ -201,7 +194,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=4 + ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=4 # Create a dedicated php-fpm config ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint fi @@ -288,7 +281,7 @@ chown root: $final_path/wp-config.php #================================================= # UPGRADE FAIL2BAN #================================================= -ynh_script_progression --message="Reconfiguring fail2ban..." --weight=9 +ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=9 # Create a dedicated fail2ban config ynh_add_fail2ban_config --logpath="/var/log/auth.log" --failregex="Authentication (attempt for unknown user|failure for) .* from " --max_retry=5 @@ -311,7 +304,7 @@ fi #================================================= # 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 From 52b19005e83ad20a5a1bb11daa9ae22e945a2988 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 9 Dec 2020 15:41:49 +0100 Subject: [PATCH 04/14] Add php-fpm.conf --- conf/extra_php-fpm.conf | 5 - conf/php-fpm.conf | 430 ++++++++++++++++++++++++++++++++++++++++ scripts/remove | 2 +- 3 files changed, 431 insertions(+), 6 deletions(-) delete mode 100644 conf/extra_php-fpm.conf create mode 100644 conf/php-fpm.conf diff --git a/conf/extra_php-fpm.conf b/conf/extra_php-fpm.conf deleted file mode 100644 index c93210e..0000000 --- a/conf/extra_php-fpm.conf +++ /dev/null @@ -1,5 +0,0 @@ -; Additional php.ini defines, specific to this pool of workers. - -php_admin_value[upload_max_filesize] = 50M -php_admin_value[memory_limit] = 64M -php_admin_value[post_max_size] = 50M diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf new file mode 100644 index 0000000..2932c4b --- /dev/null +++ b/conf/php-fpm.conf @@ -0,0 +1,430 @@ +; Start a new pool named 'www'. +; the variable $pool can be used in any directive and will be replaced by the +; pool name ('www' here) +[__NAMETOCHANGE__] + +; Per pool prefix +; It only applies on the following directives: +; - 'access.log' +; - 'slowlog' +; - 'listen' (unixsocket) +; - 'chroot' +; - 'chdir' +; - 'php_values' +; - 'php_admin_values' +; When not set, the global prefix (or /usr) applies instead. +; Note: This directive can also be relative to the global prefix. +; Default Value: none +;prefix = /path/to/pools/$pool + +; Unix user/group of processes +; Note: The user is mandatory. If the group is not set, the default user's group +; will be used. +user = __USER__ +group = __USER__ + +; The address on which to accept FastCGI requests. +; Valid syntaxes are: +; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on +; a specific port; +; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on +; a specific port; +; 'port' - to listen on a TCP socket to all addresses +; (IPv6 and IPv4-mapped) on a specific port; +; '/path/to/unix/socket' - to listen on a unix socket. +; Note: This value is mandatory. +listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock + +; Set listen(2) backlog. +; Default Value: 511 (-1 on FreeBSD and OpenBSD) +;listen.backlog = 511 + +; Set permissions for unix socket, if one is used. In Linux, read/write +; permissions must be set in order to allow connections from a web server. Many +; BSD-derived systems allow connections regardless of permissions. +; Default Values: user and group are set as the running user +; mode is set to 0660 +listen.owner = www-data +listen.group = www-data +;listen.mode = 0660 +; When POSIX Access Control Lists are supported you can set them using +; these options, value is a comma separated list of user/group names. +; When set, listen.owner and listen.group are ignored +;listen.acl_users = +;listen.acl_groups = + +; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect. +; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original +; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address +; must be separated by a comma. If this value is left blank, connections will be +; accepted from any ip address. +; Default Value: any +;listen.allowed_clients = 127.0.0.1 + +; Specify the nice(2) priority to apply to the pool processes (only if set) +; The value can vary from -19 (highest priority) to 20 (lower priority) +; Note: - It will only work if the FPM master process is launched as root +; - The pool processes will inherit the master process priority +; unless it specified otherwise +; Default Value: no set +; process.priority = -19 + +; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user +; or group is differrent than the master process user. It allows to create process +; core dump and ptrace the process for the pool user. +; Default Value: no +; process.dumpable = yes + +; Choose how the process manager will control the number of child processes. +; Possible Values: +; static - a fixed number (pm.max_children) of child processes; +; dynamic - the number of child processes are set dynamically based on the +; following directives. With this process management, there will be +; always at least 1 children. +; pm.max_children - the maximum number of children that can +; be alive at the same time. +; pm.start_servers - the number of children created on startup. +; pm.min_spare_servers - the minimum number of children in 'idle' +; state (waiting to process). If the number +; of 'idle' processes is less than this +; number then some children will be created. +; pm.max_spare_servers - the maximum number of children in 'idle' +; state (waiting to process). If the number +; of 'idle' processes is greater than this +; number then some children will be killed. +; ondemand - no children are created at startup. Children will be forked when +; new requests will connect. The following parameter are used: +; pm.max_children - the maximum number of children that +; can be alive at the same time. +; pm.process_idle_timeout - The number of seconds after which +; an idle process will be killed. +; Note: This value is mandatory. +pm = dynamic + +; The number of child processes to be created when pm is set to 'static' and the +; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. +; This value sets the limit on the number of simultaneous requests that will be +; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. +; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP +; CGI. The below defaults are based on a server without much resources. Don't +; forget to tweak pm.* to fit your needs. +; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' +; Note: This value is mandatory. +pm.max_children = 5 + +; The number of child processes created on startup. +; Note: Used only when pm is set to 'dynamic' +; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 +pm.start_servers = 2 + +; The desired minimum number of idle server processes. +; Note: Used only when pm is set to 'dynamic' +; Note: Mandatory when pm is set to 'dynamic' +pm.min_spare_servers = 1 + +; The desired maximum number of idle server processes. +; Note: Used only when pm is set to 'dynamic' +; Note: Mandatory when pm is set to 'dynamic' +pm.max_spare_servers = 3 + +; The number of seconds after which an idle process will be killed. +; Note: Used only when pm is set to 'ondemand' +; Default Value: 10s +;pm.process_idle_timeout = 10s; + +; The number of requests each child process should execute before respawning. +; This can be useful to work around memory leaks in 3rd party libraries. For +; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. +; Default Value: 0 +;pm.max_requests = 500 + +; The URI to view the FPM status page. If this value is not set, no URI will be +; recognized as a status page. It shows the following informations: +; pool - the name of the pool; +; process manager - static, dynamic or ondemand; +; start time - the date and time FPM has started; +; start since - number of seconds since FPM has started; +; accepted conn - the number of request accepted by the pool; +; listen queue - the number of request in the queue of pending +; connections (see backlog in listen(2)); +; max listen queue - the maximum number of requests in the queue +; of pending connections since FPM has started; +; listen queue len - the size of the socket queue of pending connections; +; idle processes - the number of idle processes; +; active processes - the number of active processes; +; total processes - the number of idle + active processes; +; max active processes - the maximum number of active processes since FPM +; has started; +; max children reached - number of times, the process limit has been reached, +; when pm tries to start more children (works only for +; pm 'dynamic' and 'ondemand'); +; Value are updated in real time. +; Example output: +; pool: www +; process manager: static +; start time: 01/Jul/2011:17:53:49 +0200 +; start since: 62636 +; accepted conn: 190460 +; listen queue: 0 +; max listen queue: 1 +; listen queue len: 42 +; idle processes: 4 +; active processes: 11 +; total processes: 15 +; max active processes: 12 +; max children reached: 0 +; +; By default the status page output is formatted as text/plain. Passing either +; 'html', 'xml' or 'json' in the query string will return the corresponding +; output syntax. Example: +; http://www.foo.bar/status +; http://www.foo.bar/status?json +; http://www.foo.bar/status?html +; http://www.foo.bar/status?xml +; +; By default the status page only outputs short status. Passing 'full' in the +; query string will also return status for each pool process. +; Example: +; http://www.foo.bar/status?full +; http://www.foo.bar/status?json&full +; http://www.foo.bar/status?html&full +; http://www.foo.bar/status?xml&full +; The Full status returns for each process: +; pid - the PID of the process; +; state - the state of the process (Idle, Running, ...); +; start time - the date and time the process has started; +; start since - the number of seconds since the process has started; +; requests - the number of requests the process has served; +; request duration - the duration in µs of the requests; +; request method - the request method (GET, POST, ...); +; request URI - the request URI with the query string; +; content length - the content length of the request (only with POST); +; user - the user (PHP_AUTH_USER) (or '-' if not set); +; script - the main script called (or '-' if not set); +; last request cpu - the %cpu the last request consumed +; it's always 0 if the process is not in Idle state +; because CPU calculation is done when the request +; processing has terminated; +; last request memory - the max amount of memory the last request consumed +; it's always 0 if the process is not in Idle state +; because memory calculation is done when the request +; processing has terminated; +; If the process is in Idle state, then informations are related to the +; last request the process has served. Otherwise informations are related to +; the current request being served. +; Example output: +; ************************ +; pid: 31330 +; state: Running +; start time: 01/Jul/2011:17:53:49 +0200 +; start since: 63087 +; requests: 12808 +; request duration: 1250261 +; request method: GET +; request URI: /test_mem.php?N=10000 +; content length: 0 +; user: - +; script: /home/fat/web/docs/php/test_mem.php +; last request cpu: 0.00 +; last request memory: 0 +; +; Note: There is a real-time FPM status monitoring sample web page available +; It's available in: /usr/share/php/7.0/fpm/status.html +; +; Note: The value must start with a leading slash (/). The value can be +; anything, but it may not be a good idea to use the .php extension or it +; may conflict with a real PHP file. +; Default Value: not set +;pm.status_path = /status + +; The ping URI to call the monitoring page of FPM. If this value is not set, no +; URI will be recognized as a ping page. This could be used to test from outside +; that FPM is alive and responding, or to +; - create a graph of FPM availability (rrd or such); +; - remove a server from a group if it is not responding (load balancing); +; - trigger alerts for the operating team (24/7). +; Note: The value must start with a leading slash (/). The value can be +; anything, but it may not be a good idea to use the .php extension or it +; may conflict with a real PHP file. +; Default Value: not set +;ping.path = /ping + +; This directive may be used to customize the response of a ping request. The +; response is formatted as text/plain with a 200 response code. +; Default Value: pong +;ping.response = pong + +; The access log file +; Default: not set +;access.log = log/$pool.access.log + +; The access log format. +; The following syntax is allowed +; %%: the '%' character +; %C: %CPU used by the request +; it can accept the following format: +; - %{user}C for user CPU only +; - %{system}C for system CPU only +; - %{total}C for user + system CPU (default) +; %d: time taken to serve the request +; it can accept the following format: +; - %{seconds}d (default) +; - %{miliseconds}d +; - %{mili}d +; - %{microseconds}d +; - %{micro}d +; %e: an environment variable (same as $_ENV or $_SERVER) +; it must be associated with embraces to specify the name of the env +; variable. Some exemples: +; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e +; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e +; %f: script filename +; %l: content-length of the request (for POST request only) +; %m: request method +; %M: peak of memory allocated by PHP +; it can accept the following format: +; - %{bytes}M (default) +; - %{kilobytes}M +; - %{kilo}M +; - %{megabytes}M +; - %{mega}M +; %n: pool name +; %o: output header +; it must be associated with embraces to specify the name of the header: +; - %{Content-Type}o +; - %{X-Powered-By}o +; - %{Transfert-Encoding}o +; - .... +; %p: PID of the child that serviced the request +; %P: PID of the parent of the child that serviced the request +; %q: the query string +; %Q: the '?' character if query string exists +; %r: the request URI (without the query string, see %q and %Q) +; %R: remote IP address +; %s: status (response code) +; %t: server time the request was received +; it can accept a strftime(3) format: +; %d/%b/%Y:%H:%M:%S %z (default) +; The strftime(3) format must be encapsuled in a %{}t tag +; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t +; %T: time the log has been written (the request has finished) +; it can accept a strftime(3) format: +; %d/%b/%Y:%H:%M:%S %z (default) +; The strftime(3) format must be encapsuled in a %{}t tag +; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t +; %u: remote user +; +; Default: "%R - %u %t \"%m %r\" %s" +;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" + +; The log file for slow requests +; Default Value: not set +; Note: slowlog is mandatory if request_slowlog_timeout is set +;slowlog = log/$pool.log.slow + +; The timeout for serving a single request after which a PHP backtrace will be +; dumped to the 'slowlog' file. A value of '0s' means 'off'. +; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) +; Default Value: 0 +;request_slowlog_timeout = 0 + +; The timeout for serving a single request after which the worker process will +; be killed. This option should be used when the 'max_execution_time' ini option +; does not stop script execution for some reason. A value of '0' means 'off'. +; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) +; Default Value: 0 +request_terminate_timeout = 1d + +; Set open file descriptor rlimit. +; Default Value: system defined value +;rlimit_files = 1024 + +; Set max core size rlimit. +; Possible Values: 'unlimited' or an integer greater or equal to 0 +; Default Value: system defined value +;rlimit_core = 0 + +; Chroot to this directory at the start. This value must be defined as an +; absolute path. When this value is not set, chroot is not used. +; Note: you can prefix with '$prefix' to chroot to the pool prefix or one +; of its subdirectories. If the pool prefix is not set, the global prefix +; will be used instead. +; Note: chrooting is a great security feature and should be used whenever +; possible. However, all PHP paths will be relative to the chroot +; (error_log, sessions.save_path, ...). +; Default Value: not set +;chroot = + +; Chdir to this directory at the start. +; Note: relative path can be used. +; Default Value: current directory or / when chroot +chdir = __FINALPATH__ + +; Redirect worker stdout and stderr into main error log. If not set, stdout and +; stderr will be redirected to /dev/null according to FastCGI specs. +; Note: on highloaded environement, this can cause some delay in the page +; process time (several ms). +; Default Value: no +;catch_workers_output = yes + +; Clear environment in FPM workers +; Prevents arbitrary environment variables from reaching FPM worker processes +; by clearing the environment in workers before env vars specified in this +; pool configuration are added. +; Setting to "no" will make all environment variables available to PHP code +; via getenv(), $_ENV and $_SERVER. +; Default Value: yes +;clear_env = no + +; Limits the extensions of the main script FPM will allow to parse. This can +; prevent configuration mistakes on the web server side. You should only limit +; FPM to .php extensions to prevent malicious users to use other extensions to +; execute php code. +; Note: set an empty value to allow all extensions. +; Default Value: .php +;security.limit_extensions = .php .php3 .php4 .php5 .php7 + +; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from +; the current environment. +; Default Value: clean env +;env[HOSTNAME] = $HOSTNAME +;env[PATH] = /usr/local/bin:/usr/bin:/bin +;env[TMP] = /tmp +;env[TMPDIR] = /tmp +;env[TEMP] = /tmp + +; Additional php.ini defines, specific to this pool of workers. These settings +; overwrite the values previously defined in the php.ini. The directives are the +; same as the PHP SAPI: +; php_value/php_flag - you can set classic ini defines which can +; be overwritten from PHP call 'ini_set'. +; php_admin_value/php_admin_flag - these directives won't be overwritten by +; PHP call 'ini_set' +; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. + +; Defining 'extension' will load the corresponding shared extension from +; extension_dir. Defining 'disable_functions' or 'disable_classes' will not +; overwrite previously defined php.ini values, but will append the new value +; instead. + +; Note: path INI options can be relative and will be expanded with the prefix +; (pool, global or /usr) + +; Default Value: nothing is defined by default except the values in php.ini and +; specified at startup with the -d argument +;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com +;php_flag[display_errors] = off +;php_admin_value[error_log] = /var/log/fpm-php.www.log +;php_admin_flag[log_errors] = on +;php_admin_value[memory_limit] = 32M + +; Common values to change to increase file upload limit +php_admin_value[upload_max_filesize] = 50M +php_admin_value[post_max_size] = 64M +; php_admin_flag[mail.add_x_header] = Off + +; Other common parameters +; php_admin_value[max_execution_time] = 600 +; php_admin_value[max_input_time] = 300 +php_admin_value[memory_limit] = 256M +; php_admin_flag[short_open_tag] = On diff --git a/scripts/remove b/scripts/remove index f7ec142..71ec8a0 100755 --- a/scripts/remove +++ b/scripts/remove @@ -51,7 +51,7 @@ ynh_remove_nginx_config #================================================= ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=2 -# Remove the dedicated php-fpm config +# Remove the dedicated PHP-FPM config ynh_remove_fpm_config #================================================= From cbe03aaf5aec6884f350db58be567744cceb7566 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 9 Dec 2020 15:47:40 +0100 Subject: [PATCH 05/14] Add extra_php_dependencies --- scripts/install | 2 +- scripts/restore | 2 ++ scripts/upgrade | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 27b7ba6..a238903 100644 --- a/scripts/install +++ b/scripts/install @@ -109,7 +109,7 @@ else usage=high fi # Create a dedicated PHP-FPM config -ynh_add_fpm_config --usage=$usage --footprint=medium +ynh_add_fpm_config --usage=$usage --footprint=medium --package="$extra_php_dependencies" phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= diff --git a/scripts/restore b/scripts/restore index 8927e42..55f5fbb 100644 --- a/scripts/restore +++ b/scripts/restore @@ -96,6 +96,8 @@ chown root: $final_path/wp-config.php ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +ynh_add_fpm_config --package="$extra_php_dependencies" + #================================================= # RESTORE THE FAIL2BAN CONFIGURATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index e201461..4df9b47 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -196,7 +196,7 @@ if [ $overwrite_phpfpm -eq 1 ] then ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=4 # Create a dedicated PHP-FPM config - ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint + ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies" fi #================================================= From cc14b0d3d7351ecc5b446fa3d22e88c51e486581 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 9 Dec 2020 16:32:46 +0100 Subject: [PATCH 06/14] Update actions.toml --- actions.toml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/actions.toml b/actions.toml index 4524def..d5f7cd1 100644 --- a/actions.toml +++ b/actions.toml @@ -7,27 +7,27 @@ description = "Change the public access of the app." [public_private.arguments] [public_private.arguments.is_public] type = "boolean" - ask = "Is it a public app ?" + ask = "Is it a public app?" default = true [reset_default_nginx] -name = "Reset the nginx config for this app." +name = "Reset the NGINX config for this app." command = "/bin/bash scripts/actions/reset_default_system nginx" # user = "root" # optional # cwd = "/" # optional # accepted_return_codes = [0, 1, 2, 3] # optional accepted_return_codes = [0] -description = "Reset the nginx config for this app." +description = "Reset the NGINX config for this app." [reset_default_phpfpm] -name = "Reset the php-fpm config for this app." +name = "Reset the PHP-FPM config for this app." command = "/bin/bash scripts/actions/reset_default_system phpfpm" # user = "root" # optional # cwd = "/" # optional # accepted_return_codes = [0, 1, 2, 3] # optional accepted_return_codes = [0] -description = "Reset the php-fpm config for this app." +description = "Reset the PHP-FPM config for this app." [reset_default_app] @@ -41,10 +41,10 @@ description = "Reset the app to its default configuration to try to fix potentia [disable_maintenance] -name = "Disable the maintenance mode of Wordpress" +name = "Disable the maintenance mode of WordPress" command = "/bin/bash scripts/actions/disable_maintenance" # user = "root" # optional # cwd = "/" # optional # accepted_return_codes = [0, 1, 2, 3] # optional accepted_return_codes = [0] -description = "Disable the maintenance mode of Wordpress if you're stuck after an upgrade" +description = "Disable the maintenance mode of WordPress if you're stuck after an upgrade" From 0f1fd757f31129b80c2dd73857a6ad8fe4b9d446 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 9 Dec 2020 17:26:51 +0100 Subject: [PATCH 07/14] Changelog --- CHANGELOG.md | 6 +++--- README.md | 2 +- README_fr.md | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c584b3..c8543ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,11 @@ Changelog ## Unreleased - Nothing for now... -## [5.6~ynh1]() +## [5.6~ynh1](https://github.com/YunoHost-Apps/wordpress_ynh/pull/115) - 2020-12-09 #### Changed -* [Update to 5.6]() - +* [Update to 5.6](https://github.com/YunoHost-Apps/wordpress_ynh/pull/115/commits/2d72bf87c3e2e674e967058472586b31e0cb5c62) +* [Use php-fpm.conf](https://github.com/YunoHost-Apps/wordpress_ynh/pull/115/commits/52b19005e83ad20a5a1bb11daa9ae22e945a2988) ## [5.5.0~ynh1](https://github.com/YunoHost-Apps/wordpress_ynh/pull/108) - 2020-08-15 diff --git a/README.md b/README.md index 9c4421c..f280337 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Use the admin panel of your WordPress to configure this app. ## Documentation * Official documentation: https://codex.wordpress.org/ - * YunoHost documentation: There no other documentations, feel free to contribute. + * YunoHost documentation: https://yunohost.org/#/app_wordpress ## YunoHost specific features diff --git a/README_fr.md b/README_fr.md index 2513872..da30f79 100644 --- a/README_fr.md +++ b/README_fr.md @@ -25,7 +25,7 @@ Utilisez le panneau d'administration de votre WordPress pour le configurer. ## Documentation * Documentation officielle : https://codex.wordpress.org/ - * Documentation YunoHost : https://yunohost.org/#/app_wordpress + * Documentation YunoHost : https://yunohost.org/#/app_wordpress_fr ## Caractéristiques spécifiques YunoHost From 41a43f759503e1caa977f5f9951525d52dc5d000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 10 Dec 2020 11:39:37 +0100 Subject: [PATCH 08/14] Update scripts/restore Co-authored-by: Kayou --- scripts/restore | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/restore b/scripts/restore index 55f5fbb..289f7e6 100644 --- a/scripts/restore +++ b/scripts/restore @@ -94,9 +94,7 @@ chown root: $final_path/wp-config.php # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" - -ynh_add_fpm_config --package="$extra_php_dependencies" +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies" #================================================= # RESTORE THE FAIL2BAN CONFIGURATION From b716b2909f906b384c77807d2b291a6b94a0dc7c Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 10 Dec 2020 11:43:01 +0100 Subject: [PATCH 09/14] Add extra_php-fpm conf --- conf/extra_php-fpm.conf | 5 + conf/php-fpm.conf | 430 ---------------------------------------- 2 files changed, 5 insertions(+), 430 deletions(-) create mode 100644 conf/extra_php-fpm.conf delete mode 100644 conf/php-fpm.conf diff --git a/conf/extra_php-fpm.conf b/conf/extra_php-fpm.conf new file mode 100644 index 0000000..c93210e --- /dev/null +++ b/conf/extra_php-fpm.conf @@ -0,0 +1,5 @@ +; Additional php.ini defines, specific to this pool of workers. + +php_admin_value[upload_max_filesize] = 50M +php_admin_value[memory_limit] = 64M +php_admin_value[post_max_size] = 50M diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf deleted file mode 100644 index 2932c4b..0000000 --- a/conf/php-fpm.conf +++ /dev/null @@ -1,430 +0,0 @@ -; Start a new pool named 'www'. -; the variable $pool can be used in any directive and will be replaced by the -; pool name ('www' here) -[__NAMETOCHANGE__] - -; Per pool prefix -; It only applies on the following directives: -; - 'access.log' -; - 'slowlog' -; - 'listen' (unixsocket) -; - 'chroot' -; - 'chdir' -; - 'php_values' -; - 'php_admin_values' -; When not set, the global prefix (or /usr) applies instead. -; Note: This directive can also be relative to the global prefix. -; Default Value: none -;prefix = /path/to/pools/$pool - -; Unix user/group of processes -; Note: The user is mandatory. If the group is not set, the default user's group -; will be used. -user = __USER__ -group = __USER__ - -; The address on which to accept FastCGI requests. -; Valid syntaxes are: -; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on -; a specific port; -; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on -; a specific port; -; 'port' - to listen on a TCP socket to all addresses -; (IPv6 and IPv4-mapped) on a specific port; -; '/path/to/unix/socket' - to listen on a unix socket. -; Note: This value is mandatory. -listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock - -; Set listen(2) backlog. -; Default Value: 511 (-1 on FreeBSD and OpenBSD) -;listen.backlog = 511 - -; Set permissions for unix socket, if one is used. In Linux, read/write -; permissions must be set in order to allow connections from a web server. Many -; BSD-derived systems allow connections regardless of permissions. -; Default Values: user and group are set as the running user -; mode is set to 0660 -listen.owner = www-data -listen.group = www-data -;listen.mode = 0660 -; When POSIX Access Control Lists are supported you can set them using -; these options, value is a comma separated list of user/group names. -; When set, listen.owner and listen.group are ignored -;listen.acl_users = -;listen.acl_groups = - -; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect. -; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original -; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address -; must be separated by a comma. If this value is left blank, connections will be -; accepted from any ip address. -; Default Value: any -;listen.allowed_clients = 127.0.0.1 - -; Specify the nice(2) priority to apply to the pool processes (only if set) -; The value can vary from -19 (highest priority) to 20 (lower priority) -; Note: - It will only work if the FPM master process is launched as root -; - The pool processes will inherit the master process priority -; unless it specified otherwise -; Default Value: no set -; process.priority = -19 - -; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user -; or group is differrent than the master process user. It allows to create process -; core dump and ptrace the process for the pool user. -; Default Value: no -; process.dumpable = yes - -; Choose how the process manager will control the number of child processes. -; Possible Values: -; static - a fixed number (pm.max_children) of child processes; -; dynamic - the number of child processes are set dynamically based on the -; following directives. With this process management, there will be -; always at least 1 children. -; pm.max_children - the maximum number of children that can -; be alive at the same time. -; pm.start_servers - the number of children created on startup. -; pm.min_spare_servers - the minimum number of children in 'idle' -; state (waiting to process). If the number -; of 'idle' processes is less than this -; number then some children will be created. -; pm.max_spare_servers - the maximum number of children in 'idle' -; state (waiting to process). If the number -; of 'idle' processes is greater than this -; number then some children will be killed. -; ondemand - no children are created at startup. Children will be forked when -; new requests will connect. The following parameter are used: -; pm.max_children - the maximum number of children that -; can be alive at the same time. -; pm.process_idle_timeout - The number of seconds after which -; an idle process will be killed. -; Note: This value is mandatory. -pm = dynamic - -; The number of child processes to be created when pm is set to 'static' and the -; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. -; This value sets the limit on the number of simultaneous requests that will be -; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. -; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP -; CGI. The below defaults are based on a server without much resources. Don't -; forget to tweak pm.* to fit your needs. -; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' -; Note: This value is mandatory. -pm.max_children = 5 - -; The number of child processes created on startup. -; Note: Used only when pm is set to 'dynamic' -; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 -pm.start_servers = 2 - -; The desired minimum number of idle server processes. -; Note: Used only when pm is set to 'dynamic' -; Note: Mandatory when pm is set to 'dynamic' -pm.min_spare_servers = 1 - -; The desired maximum number of idle server processes. -; Note: Used only when pm is set to 'dynamic' -; Note: Mandatory when pm is set to 'dynamic' -pm.max_spare_servers = 3 - -; The number of seconds after which an idle process will be killed. -; Note: Used only when pm is set to 'ondemand' -; Default Value: 10s -;pm.process_idle_timeout = 10s; - -; The number of requests each child process should execute before respawning. -; This can be useful to work around memory leaks in 3rd party libraries. For -; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. -; Default Value: 0 -;pm.max_requests = 500 - -; The URI to view the FPM status page. If this value is not set, no URI will be -; recognized as a status page. It shows the following informations: -; pool - the name of the pool; -; process manager - static, dynamic or ondemand; -; start time - the date and time FPM has started; -; start since - number of seconds since FPM has started; -; accepted conn - the number of request accepted by the pool; -; listen queue - the number of request in the queue of pending -; connections (see backlog in listen(2)); -; max listen queue - the maximum number of requests in the queue -; of pending connections since FPM has started; -; listen queue len - the size of the socket queue of pending connections; -; idle processes - the number of idle processes; -; active processes - the number of active processes; -; total processes - the number of idle + active processes; -; max active processes - the maximum number of active processes since FPM -; has started; -; max children reached - number of times, the process limit has been reached, -; when pm tries to start more children (works only for -; pm 'dynamic' and 'ondemand'); -; Value are updated in real time. -; Example output: -; pool: www -; process manager: static -; start time: 01/Jul/2011:17:53:49 +0200 -; start since: 62636 -; accepted conn: 190460 -; listen queue: 0 -; max listen queue: 1 -; listen queue len: 42 -; idle processes: 4 -; active processes: 11 -; total processes: 15 -; max active processes: 12 -; max children reached: 0 -; -; By default the status page output is formatted as text/plain. Passing either -; 'html', 'xml' or 'json' in the query string will return the corresponding -; output syntax. Example: -; http://www.foo.bar/status -; http://www.foo.bar/status?json -; http://www.foo.bar/status?html -; http://www.foo.bar/status?xml -; -; By default the status page only outputs short status. Passing 'full' in the -; query string will also return status for each pool process. -; Example: -; http://www.foo.bar/status?full -; http://www.foo.bar/status?json&full -; http://www.foo.bar/status?html&full -; http://www.foo.bar/status?xml&full -; The Full status returns for each process: -; pid - the PID of the process; -; state - the state of the process (Idle, Running, ...); -; start time - the date and time the process has started; -; start since - the number of seconds since the process has started; -; requests - the number of requests the process has served; -; request duration - the duration in µs of the requests; -; request method - the request method (GET, POST, ...); -; request URI - the request URI with the query string; -; content length - the content length of the request (only with POST); -; user - the user (PHP_AUTH_USER) (or '-' if not set); -; script - the main script called (or '-' if not set); -; last request cpu - the %cpu the last request consumed -; it's always 0 if the process is not in Idle state -; because CPU calculation is done when the request -; processing has terminated; -; last request memory - the max amount of memory the last request consumed -; it's always 0 if the process is not in Idle state -; because memory calculation is done when the request -; processing has terminated; -; If the process is in Idle state, then informations are related to the -; last request the process has served. Otherwise informations are related to -; the current request being served. -; Example output: -; ************************ -; pid: 31330 -; state: Running -; start time: 01/Jul/2011:17:53:49 +0200 -; start since: 63087 -; requests: 12808 -; request duration: 1250261 -; request method: GET -; request URI: /test_mem.php?N=10000 -; content length: 0 -; user: - -; script: /home/fat/web/docs/php/test_mem.php -; last request cpu: 0.00 -; last request memory: 0 -; -; Note: There is a real-time FPM status monitoring sample web page available -; It's available in: /usr/share/php/7.0/fpm/status.html -; -; Note: The value must start with a leading slash (/). The value can be -; anything, but it may not be a good idea to use the .php extension or it -; may conflict with a real PHP file. -; Default Value: not set -;pm.status_path = /status - -; The ping URI to call the monitoring page of FPM. If this value is not set, no -; URI will be recognized as a ping page. This could be used to test from outside -; that FPM is alive and responding, or to -; - create a graph of FPM availability (rrd or such); -; - remove a server from a group if it is not responding (load balancing); -; - trigger alerts for the operating team (24/7). -; Note: The value must start with a leading slash (/). The value can be -; anything, but it may not be a good idea to use the .php extension or it -; may conflict with a real PHP file. -; Default Value: not set -;ping.path = /ping - -; This directive may be used to customize the response of a ping request. The -; response is formatted as text/plain with a 200 response code. -; Default Value: pong -;ping.response = pong - -; The access log file -; Default: not set -;access.log = log/$pool.access.log - -; The access log format. -; The following syntax is allowed -; %%: the '%' character -; %C: %CPU used by the request -; it can accept the following format: -; - %{user}C for user CPU only -; - %{system}C for system CPU only -; - %{total}C for user + system CPU (default) -; %d: time taken to serve the request -; it can accept the following format: -; - %{seconds}d (default) -; - %{miliseconds}d -; - %{mili}d -; - %{microseconds}d -; - %{micro}d -; %e: an environment variable (same as $_ENV or $_SERVER) -; it must be associated with embraces to specify the name of the env -; variable. Some exemples: -; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e -; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e -; %f: script filename -; %l: content-length of the request (for POST request only) -; %m: request method -; %M: peak of memory allocated by PHP -; it can accept the following format: -; - %{bytes}M (default) -; - %{kilobytes}M -; - %{kilo}M -; - %{megabytes}M -; - %{mega}M -; %n: pool name -; %o: output header -; it must be associated with embraces to specify the name of the header: -; - %{Content-Type}o -; - %{X-Powered-By}o -; - %{Transfert-Encoding}o -; - .... -; %p: PID of the child that serviced the request -; %P: PID of the parent of the child that serviced the request -; %q: the query string -; %Q: the '?' character if query string exists -; %r: the request URI (without the query string, see %q and %Q) -; %R: remote IP address -; %s: status (response code) -; %t: server time the request was received -; it can accept a strftime(3) format: -; %d/%b/%Y:%H:%M:%S %z (default) -; The strftime(3) format must be encapsuled in a %{}t tag -; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t -; %T: time the log has been written (the request has finished) -; it can accept a strftime(3) format: -; %d/%b/%Y:%H:%M:%S %z (default) -; The strftime(3) format must be encapsuled in a %{}t tag -; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t -; %u: remote user -; -; Default: "%R - %u %t \"%m %r\" %s" -;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" - -; The log file for slow requests -; Default Value: not set -; Note: slowlog is mandatory if request_slowlog_timeout is set -;slowlog = log/$pool.log.slow - -; The timeout for serving a single request after which a PHP backtrace will be -; dumped to the 'slowlog' file. A value of '0s' means 'off'. -; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) -; Default Value: 0 -;request_slowlog_timeout = 0 - -; The timeout for serving a single request after which the worker process will -; be killed. This option should be used when the 'max_execution_time' ini option -; does not stop script execution for some reason. A value of '0' means 'off'. -; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) -; Default Value: 0 -request_terminate_timeout = 1d - -; Set open file descriptor rlimit. -; Default Value: system defined value -;rlimit_files = 1024 - -; Set max core size rlimit. -; Possible Values: 'unlimited' or an integer greater or equal to 0 -; Default Value: system defined value -;rlimit_core = 0 - -; Chroot to this directory at the start. This value must be defined as an -; absolute path. When this value is not set, chroot is not used. -; Note: you can prefix with '$prefix' to chroot to the pool prefix or one -; of its subdirectories. If the pool prefix is not set, the global prefix -; will be used instead. -; Note: chrooting is a great security feature and should be used whenever -; possible. However, all PHP paths will be relative to the chroot -; (error_log, sessions.save_path, ...). -; Default Value: not set -;chroot = - -; Chdir to this directory at the start. -; Note: relative path can be used. -; Default Value: current directory or / when chroot -chdir = __FINALPATH__ - -; Redirect worker stdout and stderr into main error log. If not set, stdout and -; stderr will be redirected to /dev/null according to FastCGI specs. -; Note: on highloaded environement, this can cause some delay in the page -; process time (several ms). -; Default Value: no -;catch_workers_output = yes - -; Clear environment in FPM workers -; Prevents arbitrary environment variables from reaching FPM worker processes -; by clearing the environment in workers before env vars specified in this -; pool configuration are added. -; Setting to "no" will make all environment variables available to PHP code -; via getenv(), $_ENV and $_SERVER. -; Default Value: yes -;clear_env = no - -; Limits the extensions of the main script FPM will allow to parse. This can -; prevent configuration mistakes on the web server side. You should only limit -; FPM to .php extensions to prevent malicious users to use other extensions to -; execute php code. -; Note: set an empty value to allow all extensions. -; Default Value: .php -;security.limit_extensions = .php .php3 .php4 .php5 .php7 - -; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from -; the current environment. -; Default Value: clean env -;env[HOSTNAME] = $HOSTNAME -;env[PATH] = /usr/local/bin:/usr/bin:/bin -;env[TMP] = /tmp -;env[TMPDIR] = /tmp -;env[TEMP] = /tmp - -; Additional php.ini defines, specific to this pool of workers. These settings -; overwrite the values previously defined in the php.ini. The directives are the -; same as the PHP SAPI: -; php_value/php_flag - you can set classic ini defines which can -; be overwritten from PHP call 'ini_set'. -; php_admin_value/php_admin_flag - these directives won't be overwritten by -; PHP call 'ini_set' -; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. - -; Defining 'extension' will load the corresponding shared extension from -; extension_dir. Defining 'disable_functions' or 'disable_classes' will not -; overwrite previously defined php.ini values, but will append the new value -; instead. - -; Note: path INI options can be relative and will be expanded with the prefix -; (pool, global or /usr) - -; Default Value: nothing is defined by default except the values in php.ini and -; specified at startup with the -d argument -;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com -;php_flag[display_errors] = off -;php_admin_value[error_log] = /var/log/fpm-php.www.log -;php_admin_flag[log_errors] = on -;php_admin_value[memory_limit] = 32M - -; Common values to change to increase file upload limit -php_admin_value[upload_max_filesize] = 50M -php_admin_value[post_max_size] = 64M -; php_admin_flag[mail.add_x_header] = Off - -; Other common parameters -; php_admin_value[max_execution_time] = 600 -; php_admin_value[max_input_time] = 300 -php_admin_value[memory_limit] = 256M -; php_admin_flag[short_open_tag] = On From 2a2c8635c78b14ec7288b94cb9e06033cad2aa36 Mon Sep 17 00:00:00 2001 From: Kayou Date: Thu, 10 Dec 2020 11:56:26 +0100 Subject: [PATCH 10/14] Get footprint and usage in the restore script --- scripts/restore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/restore b/scripts/restore index 289f7e6..83149f4 100644 --- a/scripts/restore +++ b/scripts/restore @@ -31,6 +31,9 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) admin_wordpress=$(ynh_app_setting_get --app=$app --key=admin) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) +fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) + #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= From 60d0140a66b81530a29393f799d109f75ebd37f7 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 10 Dec 2020 12:28:05 +0100 Subject: [PATCH 11/14] Revert permissions --- scripts/install | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index a238903..eb9ab33 100644 --- a/scripts/install +++ b/scripts/install @@ -256,7 +256,8 @@ ynh_script_progression --message="Configuring SSOwat..." if [ $is_public -eq 0 ] then - ynh_permission_update --permission "main" --remove "visitors" + # Remove the public access + ynh_app_setting_delete --app=$app --key=unprotected_uris fi #================================================= From 628ae1fd39e44951b2191fb3998785b1d717df26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 10 Dec 2020 12:28:24 +0100 Subject: [PATCH 12/14] Update scripts/restore Co-authored-by: Kayou --- scripts/restore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/restore b/scripts/restore index 83149f4..d77447c 100644 --- a/scripts/restore +++ b/scripts/restore @@ -97,6 +97,10 @@ chown root: $final_path/wp-config.php # RESTORE THE PHP-FPM CONFIGURATION #================================================= +# Restore the file first, so it can have a backup if different +ynh_restore_file --origin_path="/etc/php/$phpversion/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" #================================================= From 48e19e702208d8fc316d6969dd199285178f540b Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 11 Dec 2020 18:07:39 +0100 Subject: [PATCH 13/14] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 96de966..00e8571 100644 --- a/manifest.json +++ b/manifest.json @@ -18,7 +18,7 @@ "email": "maniackc_dev@crudelis.fr" }], "requirements": { - "yunohost": ">= 4.0.0" + "yunohost": ">= 3.8.1" }, "multi_instance": true, "services": [ From 504d694573c566193326c635cb585ea32da60f24 Mon Sep 17 00:00:00 2001 From: Kayou Date: Fri, 11 Dec 2020 18:56:38 +0100 Subject: [PATCH 14/14] Apply suggestions from code review --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8543ee..8487d12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,6 @@ Changelog #### Changed * [Update to 5.6](https://github.com/YunoHost-Apps/wordpress_ynh/pull/115/commits/2d72bf87c3e2e674e967058472586b31e0cb5c62) -* [Use php-fpm.conf](https://github.com/YunoHost-Apps/wordpress_ynh/pull/115/commits/52b19005e83ad20a5a1bb11daa9ae22e945a2988) ## [5.5.0~ynh1](https://github.com/YunoHost-Apps/wordpress_ynh/pull/108) - 2020-08-15