From 6869e0a9863456753248448c048c0e666bc67636 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 18 Jun 2022 18:51:02 +0200 Subject: [PATCH 1/3] Apply example_ynh --- check_process | 2 +- conf/nginx.conf | 11 +++++++---- scripts/_common.sh | 2 -- scripts/install | 16 ++++++++-------- scripts/restore | 27 +++++++++++++-------------- scripts/upgrade | 41 ++++++++++++++++------------------------- 6 files changed, 45 insertions(+), 54 deletions(-) diff --git a/check_process b/check_process index 7bf732c..5caef48 100644 --- a/check_process +++ b/check_process @@ -5,7 +5,7 @@ is_public=1 language="fr" admin="john" - password="jztI4OHHr2RfhrqK5wgX" + password="1Strong-Password" wiki_name="MyYunoWiki" ; Checks pkg_linter=1 diff --git a/conf/nginx.conf b/conf/nginx.conf index c5d1085..597ab0a 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -5,10 +5,13 @@ location __PATH__/ { # Path to source - alias __FINALPATH__/ ; + alias __FINALPATH__/; index index.php; + # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file + #client_max_body_size 50M; + try_files $uri $uri/ @rewrite___NAME__; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; @@ -17,9 +20,9 @@ location __PATH__/ { fastcgi_index index.php; include fastcgi_params; fastcgi_param HTTPS on if_not_empty; - fastcgi_param REMOTE_USER $remote_user; - fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_param SCRIPT_FILENAME $request_filename; + fastcgi_param REMOTE_USER $remote_user; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param SCRIPT_FILENAME $request_filename; } location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { diff --git a/scripts/_common.sh b/scripts/_common.sh index 8794b2c..fc8dbe7 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -7,8 +7,6 @@ # dependencies used by the app pkg_dependencies="diffutils imagemagick acl" -YNH_PHP_VERSION="7.3" - #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/install b/scripts/install index 0d161d3..0243e86 100644 --- a/scripts/install +++ b/scripts/install @@ -104,14 +104,6 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=1 - -# Create a dedicated NGINX config -ynh_add_nginx_config - #================================================= # PHP-FPM CONFIGURATION #================================================= @@ -121,6 +113,14 @@ ynh_script_progression --message="Configuring PHP-FPM..." --weight=1 ynh_add_fpm_config --usage=low --footprint=low phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Configuring NGINX web server..." --weight=1 + +# Create a dedicated NGINX config +ynh_add_nginx_config + #================================================= # SPECIFIC SETUP #================================================= diff --git a/scripts/restore b/scripts/restore index 2b1d91b..a7b9d79 100755 --- a/scripts/restore +++ b/scripts/restore @@ -30,7 +30,6 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name 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) @@ -44,13 +43,6 @@ test ! -d $final_path \ #================================================= # STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -70,6 +62,16 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" +#================================================= +# SPECIFIC RESTORATION +#================================================= +# REINSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Reinstalling dependencies..." --weight=10 + +# Define and install dependencies +ynh_install_app_dependencies $pkg_dependencies + #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= @@ -81,14 +83,11 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion #================================================= -# SPECIFIC RESTORATION +# RESTORE THE NGINX CONFIGURATION #================================================= -# REINSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=10 +ynh_script_progression --message="Restoring the NGINX web server configuration..." -# Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE MYSQL DATABASE diff --git a/scripts/upgrade b/scripts/upgrade index a6d5a46..f15f10d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -27,7 +27,6 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) wiki_name=$(ynh_app_setting_get --app=$app --key=wiki_name) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) secret=$(ynh_app_setting_get --app=$app --key=secret) - fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) @@ -59,6 +58,13 @@ ynh_abort_if_errors #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + # If db_name doesn't exist, create it if [ -z "$db_name" ]; then db_name=$(ynh_sanitize_dbid --db_name=$app) @@ -91,13 +97,6 @@ if [[ -n "$ldap_user" ]]; then ynh_app_setting_delete --app=$app --key=ldap_password fi -# Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - #================================================= # CREATE DEDICATED USER #================================================= @@ -131,14 +130,6 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 - -# Create a dedicated NGINX config -ynh_add_nginx_config - #================================================= # UPGRADE DEPENDENCIES #================================================= @@ -155,19 +146,19 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1 ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint #================================================= -# SPECIFIC UPGRADE +# NGINX CONFIGURATION #================================================= -# REMOVE LEGACY LDAP USER -#================================================= -#================================================= -# STORE THE CONFIG FILE CHECKSUM -#================================================= -ynh_backup_if_checksum_is_different --file="$final_path/LocalSettings.php" +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 + +# Create a dedicated NGINX config +ynh_add_nginx_config #================================================= -# REPLACE CONFIGURATION SETTINGS +# SPECIFIC UPGRADE #================================================= -ynh_script_progression --message="Upgrading application files..." --weight=4 +# UPDATE A CONFIG FILE +#================================================= +ynh_script_progression --message="Updating a configuration file..." --weight=4 if [ "$path_url" = "/" ]; then # MediaWiki expects a "" for the root URL which is typically assumed to be From b46374f057170f52a11c9f3f4dbc5eae2e7d5ae7 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 18 Jun 2022 18:58:43 +0200 Subject: [PATCH 2/3] Update ldap_authentication2.src --- conf/ldap_authentication2.src | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/ldap_authentication2.src b/conf/ldap_authentication2.src index 0345e5c..7aa6c03 100644 --- a/conf/ldap_authentication2.src +++ b/conf/ldap_authentication2.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://extdist.wmflabs.org/dist/extensions/LDAPAuthentication2-REL1_35-03fba4b.tar.gz -SOURCE_SUM=bbda25c02d85c31bef158b03958edfa3e46831ef53672f8cc8c24c6adda6d244 +SOURCE_URL=https://extdist.wmflabs.org/dist/extensions/LDAPAuthentication2-REL1_38-502759b.tar.gz +SOURCE_SUM=2212a2baa6b070d08fe36b8f3cf236a76a7aa58cdc5953c65a9a66d16cee3dc6 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=.tar.gz SOURCE_IN_SUBDIR=true From 87335020d652d7c66716e1a25cd3a0f6f85725cb Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 21 Jun 2022 01:44:23 +0200 Subject: [PATCH 3/3] Fix sources --- .github/workflows/update_extensions.py | 5 +++-- conf/app.src | 1 + conf/ldap_authentication2.src | 5 +++-- conf/ldap_authorization.src | 5 +++-- conf/ldap_groups.src | 5 +++-- conf/ldap_provider.src | 5 +++-- conf/ldap_userinfo.src | 5 +++-- conf/pluggable_auth.src | 5 +++-- 8 files changed, 22 insertions(+), 14 deletions(-) diff --git a/.github/workflows/update_extensions.py b/.github/workflows/update_extensions.py index c0626ca..627c9a8 100755 --- a/.github/workflows/update_extensions.py +++ b/.github/workflows/update_extensions.py @@ -36,8 +36,9 @@ def generate_ext_source(asset_url: str, src_filename: str) -> None: SOURCE_URL={asset_url} SOURCE_SUM={sha256sum_of_url(asset_url)} SOURCE_SUM_PRG=sha256sum - SOURCE_FORMAT=.tar.gz - SOURCE_IN_SUBDIR=true + SOURCE_FORMAT=tar.gz + SOURCE_IN_SUBDIR=false + SOURCE_FILENAME= SOURCE_EXTRACT=true """)) diff --git a/conf/app.src b/conf/app.src index 672e632..bc76007 100644 --- a/conf/app.src +++ b/conf/app.src @@ -3,4 +3,5 @@ SOURCE_SUM=583f074bcafcec17da50142a56f5bbfde5c3366977d61d912d7e56fcca3bda1b SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true +SOURCE_FILENAME= SOURCE_EXTRACT=true diff --git a/conf/ldap_authentication2.src b/conf/ldap_authentication2.src index 7aa6c03..2506301 100644 --- a/conf/ldap_authentication2.src +++ b/conf/ldap_authentication2.src @@ -1,6 +1,7 @@ SOURCE_URL=https://extdist.wmflabs.org/dist/extensions/LDAPAuthentication2-REL1_38-502759b.tar.gz SOURCE_SUM=2212a2baa6b070d08fe36b8f3cf236a76a7aa58cdc5953c65a9a66d16cee3dc6 SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=.tar.gz -SOURCE_IN_SUBDIR=true +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=false +SOURCE_FILENAME= SOURCE_EXTRACT=true diff --git a/conf/ldap_authorization.src b/conf/ldap_authorization.src index 4b32c64..661f613 100644 --- a/conf/ldap_authorization.src +++ b/conf/ldap_authorization.src @@ -1,6 +1,7 @@ SOURCE_URL=https://extdist.wmflabs.org/dist/extensions/LDAPAuthorization-REL1_37-ba9cdb5.tar.gz SOURCE_SUM=b5134407376f33e0c43c7c85fb965757a6ffd83d13280ff26e84d1ced4747bb8 SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=.tar.gz -SOURCE_IN_SUBDIR=true +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=false +SOURCE_FILENAME= SOURCE_EXTRACT=true diff --git a/conf/ldap_groups.src b/conf/ldap_groups.src index e42b144..b8593d1 100644 --- a/conf/ldap_groups.src +++ b/conf/ldap_groups.src @@ -1,6 +1,7 @@ SOURCE_URL=https://extdist.wmflabs.org/dist/extensions/LDAPGroups-REL1_37-ad40602.tar.gz SOURCE_SUM=d98161ae03319bfd92c140210224c3da5fb42c015d2c606eaa64692f69a00dec SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=.tar.gz -SOURCE_IN_SUBDIR=true +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=false +SOURCE_FILENAME= SOURCE_EXTRACT=true diff --git a/conf/ldap_provider.src b/conf/ldap_provider.src index 338b234..82d4cf2 100644 --- a/conf/ldap_provider.src +++ b/conf/ldap_provider.src @@ -1,6 +1,7 @@ SOURCE_URL=https://extdist.wmflabs.org/dist/extensions/LDAPProvider-REL1_35-1300b26.tar.gz SOURCE_SUM=6c42b82a4d7753c280731c8f8bda5640cfb2822a6e130e30c95d58476ab7725f SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=.tar.gz -SOURCE_IN_SUBDIR=true +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=false +SOURCE_FILENAME= SOURCE_EXTRACT=true diff --git a/conf/ldap_userinfo.src b/conf/ldap_userinfo.src index 161e59a..d903f2a 100644 --- a/conf/ldap_userinfo.src +++ b/conf/ldap_userinfo.src @@ -1,6 +1,7 @@ SOURCE_URL=https://extdist.wmflabs.org/dist/extensions/LDAPUserInfo-REL1_37-255e2b9.tar.gz SOURCE_SUM=3751415aa48d1d552c185ce884a3a7ed5745a3baf91c72aa7820b8f89fd548a4 SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=.tar.gz -SOURCE_IN_SUBDIR=true +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=false +SOURCE_FILENAME= SOURCE_EXTRACT=true diff --git a/conf/pluggable_auth.src b/conf/pluggable_auth.src index 3e91bed..08b50fe 100644 --- a/conf/pluggable_auth.src +++ b/conf/pluggable_auth.src @@ -1,6 +1,7 @@ SOURCE_URL=https://extdist.wmflabs.org/dist/extensions/PluggableAuth-REL1_37-a932c78.tar.gz SOURCE_SUM=fbfce41876ff07be8d69a29b8b35054a68543d2cc91aa0280e73793d42c6e48e SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=.tar.gz -SOURCE_IN_SUBDIR=true +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=false +SOURCE_FILENAME= SOURCE_EXTRACT=true