From 2959983820a281ecd457dcd7e85a95e6fcdc65e8 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 15 Jun 2022 22:53:07 +0200 Subject: [PATCH 1/2] Apply last example_ynh --- check_process | 6 +++++- conf/nginx.conf | 8 +------- doc/DISCLAIMER_fr.md | 0 manifest.json | 20 ++++++++++---------- scripts/_common.sh | 2 +- scripts/backup | 4 ++++ scripts/change_url | 10 ++++++---- scripts/install | 40 +++++++++++++++++++++------------------- scripts/restore | 19 ++++++++++--------- scripts/upgrade | 30 ++++++++++++++++++++---------- 10 files changed, 78 insertions(+), 61 deletions(-) create mode 100644 doc/DISCLAIMER_fr.md diff --git a/check_process b/check_process index 4bb1a5e..9743ecc 100644 --- a/check_process +++ b/check_process @@ -1,8 +1,8 @@ ;; Test complet ; Manifest domain="domain.tld" - etherpad_instance="https://annuel2.framapad.org" is_public=1 + etherpad_instance="https://annuel2.framapad.org" creation_open=1 ; Checks pkg_linter=1 @@ -12,9 +12,13 @@ setup_private=1 setup_public=1 upgrade=1 + # 0.0.20180605~ynh2 upgrade=1 from_commit=f6fcb8686cec30da2a7b9e5ba12d6c5b295528d8 + # 0.0.20180605~ynh3 + upgrade=1 from_commit=ce19369d877b54a9b562444ade220d8d55639edb backup_restore=1 multi_instance=1 + port_already_use=0 change_url=1 ;;; Options Email=ljf+libreto_ynh@reflexlibre.net diff --git a/conf/nginx.conf b/conf/nginx.conf index f9e1caa..a7aeb22 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,14 +1,8 @@ - #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { # Path to source - alias __FINALPATH__/ ; - - # Force usage of https - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } + alias __FINALPATH__/; index index.php; # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md new file mode 100644 index 0000000..e69de29 diff --git a/manifest.json b/manifest.json index b75d7f6..24c2568 100644 --- a/manifest.json +++ b/manifest.json @@ -29,7 +29,7 @@ "php7.3-fpm" ], "arguments": { - "install" : [ + "install": [ { "name": "domain", "type": "domain" @@ -40,6 +40,15 @@ "example": "/libreto", "default": "/libreto" }, + { + "name": "is_public", + "type": "boolean", + "help": { + "en": "If enabled, Libreto will be accessible by people who do not have an account. This can be changed later via the webadmin.", + "fr": "Si cette case est cochée, Libreto sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." + }, + "default": true + }, { "name": "etherpad_instance", "type": "string", @@ -55,15 +64,6 @@ "example": "https://annuel2.framapad.org", "default": "https://annuel2.framapad.org" }, - { - "name": "is_public", - "type": "boolean", - "help": { - "en": "If enabled, Libreto will be accessible by people who do not have an account. This can be changed later via the webadmin.", - "fr": "Si cette case est cochée, Libreto sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." - }, - "default": true - }, { "name": "creation_open", "type": "boolean", diff --git a/scripts/_common.sh b/scripts/_common.sh index 26b65ae..14466d3 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -18,4 +18,4 @@ COMMIT="76408f5e98a68156afa47996e670d110a1c6106d" #================================================= # FUTURE OFFICIAL HELPERS -#================================================= \ No newline at end of file +#================================================= diff --git a/scripts/backup b/scripts/backup index 886fc15..9b12047 100755 --- a/scripts/backup +++ b/scripts/backup @@ -6,6 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -13,6 +14,9 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= +ynh_clean_setup () { + true +} # Exit if an error occurs during the execution of the script ynh_abort_if_errors diff --git a/scripts/change_url b/scripts/change_url index 3bbea99..10f4ed7 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -30,7 +30,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=3 @@ -75,7 +75,7 @@ nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf if [ $change_path -eq 1 ] then # Make a backup of the original NGINX config file if modified - ynh_backup_if_checksum_is_different "$nginx_conf_path" + ynh_backup_if_checksum_is_different --file="$nginx_conf_path" # Set global variables for NGINX helper domain="$old_domain" path_url="$new_path" @@ -87,12 +87,14 @@ fi if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location - ynh_delete_file_checksum "$nginx_conf_path" + ynh_delete_file_checksum --file="$nginx_conf_path" mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf # Store file checksum for the new config file location - ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf" + ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi +#================================================= +# GENERIC FINALISATION #================================================= # RELOAD NGINX #================================================= diff --git a/scripts/install b/scripts/install index 2aa595c..99b7e75 100755 --- a/scripts/install +++ b/scripts/install @@ -14,7 +14,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. true } # Exit if an error occurs during the execution of the script @@ -26,8 +25,8 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH -etherpad_instance=$YNH_APP_ARG_ETHERPAD_INSTANCE is_public=$YNH_APP_ARG_IS_PUBLIC +etherpad_instance=$YNH_APP_ARG_ETHERPAD_INSTANCE creation_open=$YNH_APP_ARG_CREATION_OPEN app=$YNH_APP_INSTANCE_NAME @@ -38,7 +37,7 @@ app=$YNH_APP_INSTANCE_NAME ynh_script_progression --message="Validating installation parameters..." --weight=1 final_path=/var/www/$app -test ! -e "$final_path" || ynh_die "This path already contains a folder" +test ! -e "$final_path" || ynh_die --message="This path already contains a folder" # Register (book) web path ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url @@ -46,12 +45,15 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= +ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=etherpad_instance --value=$etherpad_instance ynh_app_setting_set --app=$app --key=creation_open --value=$creation_open +#================================================= +# STANDARD MODIFICATIONS #================================================= # CREATE DEDICATED USER #================================================= @@ -60,8 +62,6 @@ ynh_script_progression --message="Configuring system user..." --weight=1 # Create a system user ynh_system_user_create --username=$app --home_dir="$final_path" -#================================================= -# STANDARD MODIFICATIONS #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -80,14 +80,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=2 - -# Create a dedicated nginx config -ynh_add_nginx_config - #================================================= # PHP-FPM CONFIGURATION #================================================= @@ -97,11 +89,21 @@ ynh_script_progression --message="Configuring PHP-FPM..." --weight=2 ynh_add_fpm_config phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Configuring NGINX web server..." --weight=2 + +# Create a dedicated NGINX config +ynh_add_nginx_config ynh_replace_string --match_string="__INSTANCE__" --replace_string="$etherpad_instance" --target_file="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= -# MODIFY A CONFIG FILE +# SPECIFIC SETUP #================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." cp "../conf/config.dist.php" "$final_path/config.php" @@ -114,13 +116,11 @@ else ynh_replace_string --match_string="__PROVIDER__" --replace_string="framapad" --target_file="$final_path/config.php" fi -#================================================= -# STORE THE CONFIG FILE CHECKSUM -#================================================= - # Calculate and store the config file checksum into the app settings ynh_store_file_checksum "$final_path/config.php" +#================================================= +# GENERIC FINALIZATION #================================================= # SETUP SSOWAT #================================================= @@ -129,7 +129,9 @@ ynh_script_progression --message="Configuring permissions..." --weight=1 # Make app public if necessary if [ $is_public -eq 1 ] then - ynh_permission_update --permission="main" --add="visitors" + # Everyone can access the app. + # The "main" permission is automatically created before the install script. + ynh_permission_update --permission="main" --add="visitors" fi #================================================= diff --git a/scripts/restore b/scripts/restore index 60a1500..00c91e2 100755 --- a/scripts/restore +++ b/scripts/restore @@ -6,6 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -14,7 +15,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - #### Remove this function if there's nothing to clean before calling the remove script. true } # Exit if an error occurs during the execution of the script @@ -37,17 +37,11 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=2 -test ! -d $final_path || ynh_die "There is already a directory: $final_path " +test ! -d $final_path \ + || ynh_die --message="There is already a directory: $final_path " #================================================= # STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -74,6 +68,13 @@ ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weig ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index c69f910..336e383 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -24,22 +25,26 @@ creation_open=$(ynh_app_setting_get --app=$app --key=creation_open) #================================================= # CHECK VERSION #================================================= +ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { - # restore it if the upgrade fails + # Restore it if the upgrade fails ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script ynh_abort_if_errors +#================================================= +# STANDARD UPGRADE STEPS #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -83,6 +88,13 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" +#================================================= +# PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 +# Create a dedicated PHP-FPM config +ynh_add_fpm_config + #================================================= # NGINX CONFIGURATION #================================================= @@ -91,21 +103,19 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 -# Create a dedicated PHP-FPM config -ynh_add_fpm_config - #================================================= # SPECIFIC UPGRADE #================================================= +# UPDATE A CONFIG FILE +#================================================= +ynh_script_progression --message="Updating a configuration file..." -ynh_backup_if_checksum_is_different "$final_path/config.php" +ynh_backup_if_checksum_is_different --file="$final_path/config.php" # Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum "$final_path/config.php" +ynh_store_file_checksum --file="$final_path/config.php" +#================================================= +# GENERIC FINALIZATION #================================================= # RELOAD NGINX #================================================= From b927d94693dbec38ed28d4ff9432c8f58f70a486 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Wed, 15 Jun 2022 20:53:13 +0000 Subject: [PATCH 2/2] Auto-update README --- README.md | 19 ++++++++++--------- README_fr.md | 25 +++++++++++++++---------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index b8ce694..cc453b6 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ It shall NOT be edited by hand. # Libreto for YunoHost -[![Integration level](https://dash.yunohost.org/integration/libreto.svg)](https://dash.yunohost.org/appci/app/libreto) ![](https://ci-apps.yunohost.org/ci/badges/libreto.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/libreto.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/libreto.svg)](https://dash.yunohost.org/appci/app/libreto) ![Working status](https://ci-apps.yunohost.org/ci/badges/libreto.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/libreto.maintain.svg) [![Install Libreto with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=libreto) *[Lire ce readme en français.](./README_fr.md)* @@ -24,25 +24,26 @@ Libreto is a collaborative etherpad-based notebook. It can become a mini-site, t ## Screenshots -![](./doc/screenshots/home.png) -![](./doc/screenshots/menu.png) +![Screenshot of Libreto](./doc/screenshots/home.png) +![Screenshot of Libreto](./doc/screenshots/menu.png) ## Documentation and resources -* Official app website: https://libreto.net -* Upstream app code repository: https://github.com/Ventricule/libreto -* YunoHost documentation for this app: https://yunohost.org/app_libreto -* Report a bug: https://github.com/YunoHost-Apps/libreto_ynh/issues +* Official app website: +* Upstream app code repository: +* YunoHost documentation for this app: +* Report a bug: ## Developer info Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/libreto_ynh/tree/testing). To try the testing branch, please proceed like that. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/libreto_ynh/tree/testing --debug or sudo yunohost app upgrade libreto -u https://github.com/YunoHost-Apps/libreto_ynh/tree/testing --debug ``` -**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file +**More info regarding app packaging:** diff --git a/README_fr.md b/README_fr.md index c78871d..ebc3b49 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,10 +1,14 @@ + + # Libreto pour YunoHost -[![Niveau d'intégration](https://dash.yunohost.org/integration/libreto.svg)](https://dash.yunohost.org/appci/app/libreto) ![](https://ci-apps.yunohost.org/ci/badges/libreto.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/libreto.maintain.svg) +[![Niveau d'intégration](https://dash.yunohost.org/integration/libreto.svg)](https://dash.yunohost.org/appci/app/libreto) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/libreto.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/libreto.maintain.svg) [![Installer Libreto avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=libreto) *[Read this readme in english.](./README.md)* -*[Lire ce readme en français.](./README_fr.md)* > *Ce package vous permet d'installer Libreto rapidement et simplement sur un serveur YunoHost. Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* @@ -20,25 +24,26 @@ Libreto est un carnet de note collaboratif fondé sur etherpad. Il peut devenir ## Captures d'écran -![](./doc/screenshots/home.png) -![](./doc/screenshots/menu.png) +![Capture d'écran de Libreto](./doc/screenshots/home.png) +![Capture d'écran de Libreto](./doc/screenshots/menu.png) ## Documentations et ressources -* Site officiel de l'app : https://libreto.net -* Dépôt de code officiel de l'app : https://github.com/Ventricule/libreto -* Documentation YunoHost pour cette app : https://yunohost.org/app_libreto -* Signaler un bug : https://github.com/YunoHost-Apps/libreto_ynh/issues +* Site officiel de l'app : +* Dépôt de code officiel de l'app : +* Documentation YunoHost pour cette app : +* Signaler un bug : ## Informations pour les développeurs Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/libreto_ynh/tree/testing). Pour essayer la branche testing, procédez comme suit. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/libreto_ynh/tree/testing --debug ou sudo yunohost app upgrade libreto -u https://github.com/YunoHost-Apps/libreto_ynh/tree/testing --debug ``` -**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file +**Plus d'infos sur le packaging d'applications :**