From 8cc021813c05855192c597f06257bc5c656d940f Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 28 Feb 2021 09:56:45 +0100 Subject: [PATCH] Apply example_ynh --- README.md | 12 ++++----- README_fr.md | 8 +++--- check_process | 16 +++++++----- conf/app.src | 1 + issue_template.md | 55 ++++++++++++++++++++++++++++++++++++++++ manifest.json | 5 ++-- pull_request_template.md | 4 +-- scripts/backup | 1 - scripts/change_url | 13 +++++----- scripts/install | 15 ++++++----- scripts/remove | 4 +-- scripts/restore | 3 ++- scripts/upgrade | 40 +++++------------------------ 13 files changed, 104 insertions(+), 73 deletions(-) create mode 100644 issue_template.md diff --git a/README.md b/README.md index 6bb9044..ff79c63 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Drupal for YunoHost [![Integration level](https://dash.yunohost.org/integration/drupal.svg)](https://dash.yunohost.org/appci/app/drupal) ![](https://ci-apps.yunohost.org/ci/badges/drupal.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/drupal.maintain.svg) -[![Install Drupal with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=drupal) +[![Install Drupal with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=drupal) *[Lire ce readme en français.](./README_fr.md)* -> *This package allow you to install Drupal quickly and simply on a YunoHost server. -If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* +> *This package allows you to install Drupal quickly and simply on a YunoHost server. +If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* ## Overview Free and open-source content management framework. @@ -23,7 +23,7 @@ Free and open-source content management framework. ## YunoHost specific features -#### Multi-users support +#### Multi-user support LDAP module can be installed @@ -41,9 +41,9 @@ LDAP module can be installed --- -## Developers info +## Developer info -Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/drupal_ynh/tree/testing). +Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/drupal_ynh/tree/testing). To try the testing branch, please proceed like that. ``` diff --git a/README_fr.md b/README_fr.md index 43f5645..7c4436f 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,12 +1,12 @@ # Drupal pour YunoHost [![Niveau d'intégration](https://dash.yunohost.org/integration/drupal.svg)](https://dash.yunohost.org/appci/app/drupal) ![](https://ci-apps.yunohost.org/ci/badges/drupal.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/drupal.maintain.svg) -[![Install Drupal with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=drupal) +[![Installer Drupal avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=drupal) *[Read this readme in english.](./README.md)* > *Ce package vous permet d'installer Drupal 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.* +Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.* ## Vue d'ensemble Framework de gestion de contenu libre et open-source. @@ -23,11 +23,11 @@ Framework de gestion de contenu libre et open-source. ## Caractéristiques spécifiques YunoHost -#### Support multi-utilisateurs +#### Support multi-utilisateur Le module d'authentification LDAP peut être installé. -#### Supported architectures +#### Architectures supportées * x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/drupal%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/drupal/) * ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/drupal%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/drupal/) diff --git a/check_process b/check_process index 5050ccd..dad25b6 100644 --- a/check_process +++ b/check_process @@ -15,17 +15,19 @@ setup_private=1 setup_public=1 upgrade=1 - # 8.7.1 - # upgrade=1 from_commit=f0af5b7a8e58615fe8ad73e3c1d6fe8d1369f061 + # 8.7.1~ynh1 + upgrade=1 from_commit=f0af5b7a8e58615fe8ad73e3c1d6fe8d1369f061 + # 8.9.7~ynh1 + upgrade=1 from_commit=08ca36cc16691ed64a11034c810f5adefb21186a backup_restore=1 multi_instance=1 - # This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version. - # incorrect_path=1 port_already_use=0 change_url=1 -;;; Levels - # If the level 5 (Package linter) is forced to 1. Please add justifications here. - Level 5=auto ;;; Options Email=yalh@yahoo.com Notification=all +;;; Upgrade options + ; commit=f0af5b7a8e58615fe8ad73e3c1d6fe8d1369f061 + name=8.7.1~ynh1 + ; commit=08ca36cc16691ed64a11034c810f5adefb21186a + name=8.9.7~ynh1 diff --git a/conf/app.src b/conf/app.src index 158ead5..a6a23b5 100644 --- a/conf/app.src +++ b/conf/app.src @@ -4,3 +4,4 @@ SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true SOURCE_FILENAME= +SOURCE_EXTRACT=true diff --git a/issue_template.md b/issue_template.md new file mode 100644 index 0000000..37b7897 --- /dev/null +++ b/issue_template.md @@ -0,0 +1,55 @@ +--- +name: Bug report +about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently. + +--- + +**How to post a meaningful bug report** +1. *Read this whole template first.* +2. *Determine if you are on the right place:* + - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* + - *Otherwise, the issue may be due to Drupal itself. Refer to its documentation or repository for help.* + - *When in doubt, post here and we will figure it out together.* +3. *Delete the italic comments as you write over them below, and remove this guide.* +--- + +### Describe the bug + +*A clear and concise description of what the bug is.* + +### Context + +- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...* +- YunoHost version: x.x.x +- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...* +- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes* + - If yes, please explain: +- Using, or trying to install package version/branch: +- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`* + +### Steps to reproduce + +- *If you performed a command from the CLI, the command itself is enough. For example:* + ```sh + sudo yunohost app install drupal + ``` +- *If you used the webadmin, please perform the equivalent command from the CLI first.* +- *If the error occurs in your browser, explain what you did:* + 1. *Go to '...'* + 2. *Click on '...'* + 3. *Scroll down to '...'* + 4. *See error* + +### Expected behavior + +*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.* + +### Logs + +*When an operation fails, YunoHost provides a simple way to share the logs.* +- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.* +- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.* + +*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)* + +*If applicable and useful, add screenshots to help explain your problem.* diff --git a/manifest.json b/manifest.json index f9f9557..71a4cbd 100644 --- a/manifest.json +++ b/manifest.json @@ -13,11 +13,12 @@ "name": "yalh76" }, "requirements": { - "yunohost": ">= 3.8" + "yunohost": ">= 4.1.3" }, "multi_instance": true, "services": [ "nginx", + "php7.3-fpm", "mysql" ], "arguments": { @@ -46,7 +47,7 @@ "type": "user", "ask": { "en": "Choose an admin user", - "fr": "Choisissez l’administrateur" + "fr": "Choisissez l'administrateur" }, "example": "johndoe" }, diff --git a/pull_request_template.md b/pull_request_template.md index 109db08..6c28fc5 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -13,6 +13,4 @@ ## Package_check results --- -*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results* - -[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/drupal_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/drupal_ynh%20PR-NUM-%20(USERNAME)/) +* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"* diff --git a/scripts/backup b/scripts/backup index 23651e6..fd931cd 100644 --- a/scripts/backup +++ b/scripts/backup @@ -57,7 +57,6 @@ ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # BACKUP A CRON FILE #================================================= -ynh_print_info --message="Backing up a cron file..." ynh_backup --src_path="/etc/cron.d/$app" diff --git a/scripts/change_url b/scripts/change_url index aef7dc5..f1f3711 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -12,7 +12,6 @@ source /usr/share/yunohost/helpers #================================================= # RETRIEVE ARGUMENTS #================================================= -ynh_print_info --message="Retrieve arguments from the manifest" old_domain=$YNH_APP_OLD_DOMAIN old_path=$YNH_APP_OLD_PATH @@ -25,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) @@ -38,7 +37,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_print_info --message="Backing up the app before changing its url (may take a while)..." +ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." # Backup the current version of the app ynh_backup_before_upgrade @@ -73,7 +72,7 @@ fi #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_print_info --message="Updating nginx web server configuration..." +ynh_script_progression --message="Updating nginx web server configuration..." nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -104,7 +103,7 @@ fi #================================================= # UPDATE DRUSH ALIAS #================================================= -ynh_print_info --message="Updating Drush alias..." +ynh_script_progression --message="Updating Drush alias..." drush_aliasconfig="$final_path/drush/sites/$app.site.yml" cp -f "../conf/example.site.yml" "$drush_aliasconfig" @@ -119,7 +118,7 @@ ynh_replace_string --match_string="__PATH_URL__" --replace_string="$new_path" -- #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -127,4 +126,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_print_info --message="Change of URL completed for $app" +ynh_script_progression --message="Change of URL completed for $app" diff --git a/scripts/install b/scripts/install index 43b5145..b969e7c 100644 --- a/scripts/install +++ b/scripts/install @@ -55,7 +55,6 @@ 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=admin --value=$admin -ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=language --value=$language ynh_app_setting_set --app=$app --key=install_profil --value=$install_profil @@ -112,13 +111,14 @@ ynh_script_progression --message="Configuring php-fpm..." # Create a dedicated php-fpm config ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies" +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # SPECIFIC SETUP #================================================= # ADD SWAP #================================================= -ynh_print_info --message="Adding swap..." +ynh_script_progression --message="Adding swap..." ynh_add_swap --size=$swap_needed @@ -146,7 +146,7 @@ mkdir -p "$final_path/.composer" cp -f "../conf/composer.json" "$final_path/composer.json" ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/composer.json" -ynh_install_composer --phpversion="${YNH_PHP_VERSION}" --workdir="$final_path" +ynh_install_composer --phpversion="$phpversion" --workdir="$final_path" export PATH="$final_path/vendor/bin:$PATH" @@ -157,7 +157,7 @@ ynh_script_progression --message="Installing Drupal..." chown -R $app: $final_path -update-alternatives --set php /usr/bin/php${YNH_PHP_VERSION} +update-alternatives --set php /usr/bin/php$phpversion pushd "$final_path" sudo -u $app env PATH=$PATH drush site:install $install_profil --account-name=$admin --account-pass=$password --account-mail=$admin_mail --db-url=mysql://$db_user:$db_pwd@localhost/$db_name --site-name="$app" --locale=$language --yes @@ -196,13 +196,14 @@ chown -R $app: $final_path #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." +ynh_script_progression --message="Configuring permissions..." # Make app public if necessary if [ $is_public -eq 1 ] then - # unprotected_uris allows SSO credentials to be passed anyway. - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" + # 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/remove b/scripts/remove index 752d997..c5d854e 100644 --- a/scripts/remove +++ b/scripts/remove @@ -67,7 +67,7 @@ ynh_remove_fpm_config #================================================= # REMOVE SWAP #================================================= -ynh_print_info --message="Removing swap..." +ynh_script_progression --message="Removing swap..." ynh_del_swap @@ -76,7 +76,7 @@ ynh_del_swap #================================================= # REMOVE THE CRON FILE #================================================= -ynh_print_info --message="Removing the cron file..." +ynh_script_progression --message="Removing the cron file..." # Remove a cron file ynh_secure_remove --file="/etc/cron.d/$app" diff --git a/scripts/restore b/scripts/restore index 53430a6..c651863 100644 --- a/scripts/restore +++ b/scripts/restore @@ -84,6 +84,7 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" # Recreate a dedicated php-fpm config ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies" +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # SPECIFIC RESTORATION @@ -125,7 +126,7 @@ ynh_add_swap --size=$swap_needed #================================================= ynh_script_progression --message="Reloading nginx web server and php-fpm..." -ynh_systemd_action --service_name=php${YNH_PHP_VERSION}-fpm --action=reload +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 7a32a01..0a96646 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,7 +21,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) admin=$(ynh_app_setting_get --app=$app --key=admin) -is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) language=$(ynh_app_setting_get --app=$app --key=language) db_name=$(ynh_app_setting_get --app=$app --key=db_name) @@ -39,25 +38,11 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." -# Fix is_public as a boolean value -if [ "$is_public" = "Yes" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=1 - is_public=1 -elif [ "$is_public" = "No" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=0 - is_public=0 -fi +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all -# If db_name doesn't exist, create it -if [ -z "$db_name" ]; then - db_name=$(ynh_sanitize_dbid --db_name=$app) - ynh_app_setting_set --app=$app --key=db_name --value=$db_name -fi - -# If final_path doesn't exist, create it -if [ -z "$final_path" ]; then - final_path=/var/www/$app - ynh_app_setting_set --app=$app --key=final_path --value=$final_path + ynh_app_setting_delete --app=$app --key=is_public fi #================================================= @@ -106,6 +91,7 @@ ynh_script_progression --message="Upgrading php-fpm configuration..." # Create a dedicated php-fpm config ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies" +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # SPECIFIC UPGRADE @@ -156,7 +142,7 @@ ynh_store_file_checksum --file="$final_path/$app/sites/default/settings.php" #================================================= # SETUP THE CRON FILE #================================================= -ynh_print_info --message="Setuping the cron file" +ynh_script_progression --message="Setuping the cron file" cp -f ../conf/cron /etc/cron.d/$app @@ -170,23 +156,11 @@ ynh_systemd_action --service_name=cron --action=restart #================================================= # SECURE FILES AND DIRECTORIES #================================================= -ynh_print_info --message="Securing files and directories..." +ynh_script_progression --message="Securing files and directories..." # Set permissions on app files chown -R $app: $final_path -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." - -# Make app public if necessary -if [ $is_public -eq 1 ] -then - # unprotected_uris allows SSO credentials to be passed anyway. - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" -fi - #================================================= # RELOAD NGINX #=================================================