From a5cc8741477a0f37ffd1b84e08bb3dec8af34a46 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 22 Apr 2021 23:20:15 +0200 Subject: [PATCH] Cleaning up --- README.md | 11 +++-------- README_fr.md | 8 ++------ manifest.json | 20 ++------------------ pull_request_template.md | 12 ++---------- scripts/actions/sftp | 4 ++-- scripts/install | 21 ++++++++------------- scripts/upgrade | 32 ++++++++------------------------ 7 files changed, 27 insertions(+), 81 deletions(-) diff --git a/README.md b/README.md index 5111ef8..9348a2e 100644 --- a/README.md +++ b/README.md @@ -24,10 +24,6 @@ of your custom Web application inside. **Shipped version:** 1.0 -## Screenshots - -## Demo - ## Configuration ## Documentation @@ -40,8 +36,8 @@ of your custom Web application inside. #### Supported architectures -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/my_webapp%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/my_webapp/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/my_webapp%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/my_webapp/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/my_webapp.svg)](https://ci-apps.yunohost.org/ci/apps/my_webapp/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/my_webapp.svg)](https://ci-apps-arm.yunohost.org/ci/apps/my_webapp/) ## Limitations @@ -50,7 +46,7 @@ of your custom Web application inside. #### SFTP port You may have change the SSH port as described -[here (section "Modifier le port SSH"](https://yunohost.org/#/security_fr) ; +[here section "Modifier le port SSH"](https://yunohost.org/#/security_fr) ; then you should use this port to update your website with SFTP. ## Links @@ -62,7 +58,6 @@ then you should use this port to update your website with SFTP. ## Developers info -**Only if you want to use a testing branch for coding, instead of merging directly into master.** Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/my_webapp_ynh/tree/testing). To try the testing branch, please proceed like that. diff --git a/README_fr.md b/README_fr.md index e18a57f..6200271 100644 --- a/README_fr.md +++ b/README_fr.md @@ -17,10 +17,6 @@ seront stockés dans le fichier `db_accesss.txt` situé dans le répertoire raci **Version incluse :** 1.0 -## Captures d'écran - -## Démo - ## Configuration ## Documentation @@ -33,8 +29,8 @@ seront stockés dans le fichier `db_accesss.txt` situé dans le répertoire raci #### Architectures supportées -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/my_webapp%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/my_webapp/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/my_webapp%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/my_webapp/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/my_webapp.svg)](https://ci-apps.yunohost.org/ci/apps/my_webapp/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/my_webapp.svg)](https://ci-apps-arm.yunohost.org/ci/apps/my_webapp/) ## Limitations diff --git a/manifest.json b/manifest.json index e910ada..d6a14b1 100644 --- a/manifest.json +++ b/manifest.json @@ -18,12 +18,12 @@ "email": "maniackc_dev@crudelis.fr" }], "requirements": { - "yunohost": ">= 4.0.0" + "yunohost": ">= 4.1.7" }, "multi_instance": true, "services": [ "nginx", - "php7.0-fpm", + "php7.3-fpm", "mysql" ], "arguments": { @@ -31,19 +31,11 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain for your Webapp", - "fr": "Choisissez un domaine pour votre Webapp" - }, "example": "domain.org" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for your Webapp", - "fr": "Choisissez un chemin pour votre Webapp" - }, "example": "/site", "default": "/site" }, @@ -60,19 +52,11 @@ "name": "password", "type": "password", "optional": true, - "ask": { - "en": "Set the password for the SFTP access.", - "fr": "Définissez le mot de passe pour l'accès SFTP." - }, "example": "myreallystrengthpassword" }, { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public website?", - "fr": "Est-ce un site public ?" - }, "default": true }, { diff --git a/pull_request_template.md b/pull_request_template.md index ef766ab..0a198cf 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -11,14 +11,6 @@ - [ ] Upgrade from last version tested. - [ ] Can be reviewed and tested. -## Validation +## Package_check results --- -*Minor decision* -- **Upgrade previous version** : -- [ ] **Code review** : -- [ ] **Approval (LGTM)** : -- [ ] **Approval (LGTM)** : -- **CI succeeded** : -[![Build Status](https://ci-apps-hq.yunohost.org/jenkins/job/my_webapp_ynh%20PR-NUM-/badge/icon)](https://ci-apps-hq.yunohost.org/jenkins/job/my_webapp_ynh%20PR-NUM-/) -*Please replace '-NUM-' in this link by the PR number.* -When the PR is marked as ready to merge, you have to wait for 3 days before really merging it. +* 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/actions/sftp b/scripts/actions/sftp index 0991595..13c8d5b 100755 --- a/scripts/actions/sftp +++ b/scripts/actions/sftp @@ -42,8 +42,8 @@ if [ $with_sftp -eq 1 ] then ynh_script_progression --message="Configuring SSH to add a SFTP access..." --weight=3 - cp -R conf/ssh_regenconf_hook /usr/share/yunohost/hooks/conf_regen/90-ssh_$app - ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file=/usr/share/yunohost/hooks/conf_regen/90-ssh_$app + ynh_add_config --template="conf/ssh_regenconf_hook" --destination="/usr/share/yunohost/hooks/conf_regen/90-ssh_$app" + else ynh_script_progression --message="Removing the custom ssh config for the SFTP access..." --weight=3 diff --git a/scripts/install b/scripts/install index 2b9b168..ba0e392 100644 --- a/scripts/install +++ b/scripts/install @@ -49,7 +49,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=is_public --value=$is_public ynh_app_setting_set --app=$app --key=with_mysql --value=$with_mysql ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp ynh_app_setting_set --app=$app --key=final_path --value=$final_path @@ -102,11 +101,9 @@ fi #================================================= if [ $with_sftp -eq 1 ] then - ynh_script_progression --message="Configuring ssh..." + ynh_script_progression --message="Configuring SSH..." - cp -R ../conf/ssh_regenconf_hook /usr/share/yunohost/hooks/conf_regen/90-ssh_$app - - ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file=/usr/share/yunohost/hooks/conf_regen/90-ssh_$app + ynh_add_config --template="../conf/ssh_regenconf_hook" --destination="/usr/share/yunohost/hooks/conf_regen/90-ssh_$app" yunohost tools regen-conf ssh fi @@ -119,11 +116,9 @@ mkdir -p "$final_path/www" if [ $with_sftp -eq 1 ] then - ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file=../sources/www/index.html - ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file=../sources/www/index.html - # Copy files to the right place - cp "../sources/www/index.html" "$final_path/www/index.html" + ynh_add_config --template="../sources/www/index.html" --destination="$final_path/www/index.html" + else # Copy files to the right place cp "../sources/www/index_no_sftp.html" "$final_path/www/index.html" @@ -141,9 +136,9 @@ fi #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring php-fpm..." --weight=2 +ynh_script_progression --message="Configuring PHP-FPM..." --weight=2 -# Create a dedicated php-fpm config +# Create a dedicatedPHP-FPM config ynh_add_fpm_config --usage=low --footprint=low phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) @@ -161,12 +156,12 @@ chown root: "$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 - ynh_app_setting_set --app=$app --key=skipped_uris --value="/" + ynh_permission_update --permission="main" --add="visitors" fi #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index bdaa87b..ec459e6 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,7 +18,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) -is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) with_mysql=$(ynh_app_setting_get --app=$app --key=with_mysql) @@ -43,15 +42,6 @@ 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 - # Delete old user if [ -n "$(ynh_app_setting_get --app=$app --key=user)" ] then @@ -107,6 +97,13 @@ if [ -z "$with_sftp" ]; then ynh_app_setting_set --app=$app --key=with_sftp --value=$with_sftp 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 + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -183,9 +180,7 @@ if [ $with_sftp -eq 1 ] then ynh_script_progression --message="Configuring SSH..." --weight=1 - cp -R ../conf/ssh_regenconf_hook /usr/share/yunohost/hooks/conf_regen/90-ssh_$app - - ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file=/usr/share/yunohost/hooks/conf_regen/90-ssh_$app + ynh_add_config --template="../conf/ssh_regenconf_hook" --destination="/usr/share/yunohost/hooks/conf_regen/90-ssh_$app" yunohost tools regen-conf ssh fi @@ -201,17 +196,6 @@ chown -R $app: "$final_path" # SFTP connections chown root: "$final_path" -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." - -# Make app public if necessary -if [ $is_public -eq 1 ] -then - ynh_app_setting_set --app=$app --key=skipped_uris --value="/" -fi - #================================================= # RELOAD NGINX #=================================================