From 550a9c05be3192c573e067bef87ab619eda8f864 Mon Sep 17 00:00:00 2001 From: antoine Date: Sat, 13 Jun 2020 08:54:59 +0200 Subject: [PATCH 01/14] update version --- README.md | 2 +- README_fr.md | 2 +- manifest.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 50508ed..e8e4284 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to Make your own classified advertising website easily. -**Shipped version:** 0.1.0~ynh2 +**Shipped version:** 0.1.0 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 7401897..e984ef6 100644 --- a/README_fr.md +++ b/README_fr.md @@ -24,7 +24,7 @@ Les fonctionnalités de cette outils sont : * Possibilité d'envoyer un message à celui qui a déposé l'annonce -**Version incluse:** 0.1.0~ynh2 +**Version incluse:** 0.1.0 ## Captures d'écran diff --git a/manifest.json b/manifest.json index c3a367a..d6e00ac 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Make your own classified advertising website easily.", "fr": "Grâce à cet outil, créer simplement et rapidement votre site de Petites Annonces." }, - "version": "0.1.0~ynh1", + "version": "0.1.0~ynh2", "url": "https://framagit.org/toitoinebzh/petitesannonces", "license": "AGPL-3.0-or-later", "maintainer": { From 99342c36e035e2f7d2382824d86d7cc8ea7f7944 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sat, 9 Jan 2021 22:47:34 +0100 Subject: [PATCH 02/14] Finding an available port --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 1b26082..95204a1 100755 --- a/scripts/install +++ b/scripts/install @@ -80,7 +80,7 @@ ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Configuring firewall..." --time --weight=1 +ynh_script_progression --message="Finding an available port..." --time --weight=1 ### Use these lines if you have to open a port for the application ### `ynh_find_port` will find the first available port starting from the given port. From de3c72f3733c1bb7dc0de463568b20656500ed8d Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 20 Mar 2021 16:05:24 +0100 Subject: [PATCH 03/14] Cleaning up --- README.md | 7 +- README_fr.md | 10 +- check_process | 5 - issue_template.md | 2 +- manifest.json | 18 +-- pull_request_template.md | 4 +- scripts/_common.sh | 3 - scripts/backup | 37 ----- scripts/change_url | 11 -- scripts/install | 234 +---------------------------- scripts/remove | 40 ----- scripts/restore | 44 ------ scripts/upgrade | 110 +------------- sources/extra_files/app/.gitignore | 2 - sources/patches/.gitignore | 2 - 15 files changed, 16 insertions(+), 513 deletions(-) delete mode 100644 sources/extra_files/app/.gitignore delete mode 100644 sources/patches/.gitignore diff --git a/README.md b/README.md index e8e4284..0f9353a 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,7 @@ ![](https://dash.yunohost.org/integration/petitesannonces.svg) ![](https://ci-apps.yunohost.org/ci/badges/petitesannonces.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/petitesannonces.maintain.svg) -](https://dash.yunohost.org/appci/app/petitesannonces) - +](https://dash.yunohost.org/appci/app/petitesannonces) [![Install petitesannonces with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=petitesannonces) *[Lire ce readme en français.](./README_fr.md)* @@ -69,10 +68,8 @@ https://yunohost.org/packaging_apps --- -Developer info ----------------- +## Developer info -**Only if you want to use a testing branch for coding, instead of merging directly into master.** Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/petitesannonces_ynh/tree/testing). To try the testing branch, please proceed like that. diff --git a/README_fr.md b/README_fr.md index e984ef6..f85cb24 100644 --- a/README_fr.md +++ b/README_fr.md @@ -4,8 +4,7 @@ ![](https://dash.yunohost.org/integration/petitesannonces.svg) ![](https://ci-apps.yunohost.org/ci/badges/petitesannonces.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/petitesannonces.maintain.svg) -](https://dash.yunohost.org/appci/app/petitesannonces) - +](https://dash.yunohost.org/appci/app/petitesannonces) [![Installer petitesannonces avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=petitesannonces) *[Read this readme in english.](./README.md)* @@ -64,9 +63,6 @@ L'application peut-elle être utilisée par plusieurs utilisateurs? : Non * Autres informations que vous souhaitez ajouter sur cette application : RAS -**Plus d'informations sur la page de documentation:** -https://yunohost.org/packaging_apps - ## Liens * Signaler un bug: https://github.com/YunoHost-Apps/petitesannonces_ynh/issues @@ -76,10 +72,8 @@ https://yunohost.org/packaging_apps --- -Informations pour les développeurs ----------------- +## Informations pour les développeurs -**Seulement si vous voulez utiliser une branche de test pour le codage, au lieu de fusionner directement dans la banche principale.** Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/petitesannonces_ynh/tree/testing). Pour essayer la branche testing, procédez comme suit. diff --git a/check_process b/check_process index 7713123..78296bb 100644 --- a/check_process +++ b/check_process @@ -23,13 +23,8 @@ #upgrade=1 from_commit=CommitHash 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= Notification=none diff --git a/issue_template.md b/issue_template.md index 79526b7..78f6dad 100644 --- a/issue_template.md +++ b/issue_template.md @@ -29,7 +29,7 @@ about: Create a report to help us debug, it would be nice to fill the template a *Steps to reproduce the behavior.* - *If you performed a command from the CLI, the command itself is enough. For example:* ```sh - sudo yunohost app install PetitesAnnonces + sudo yunohost app install petitesannonces ``` - *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:* diff --git a/manifest.json b/manifest.json index d6e00ac..260db35 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Make your own classified advertising website easily.", "fr": "Grâce à cet outil, créer simplement et rapidement votre site de Petites Annonces." }, - "version": "0.1.0~ynh2", + "version": "0.1.0~ynh3", "url": "https://framagit.org/toitoinebzh/petitesannonces", "license": "AGPL-3.0-or-later", "maintainer": { @@ -14,12 +14,12 @@ "email": "antoine@miaou.org" }, "requirements": { - "yunohost": ">= 3.5" + "yunohost": ">= 4.1.7" }, "multi_instance": true, "services": [ "nginx", - "php7.0-fpm", + "php7.3-fpm", "mysql" ], "arguments": { @@ -27,29 +27,17 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain name for PetitesAnnonces", - "fr": "Choisissez un nom de domaine pour PetitesAnnonces" - }, "example": "example.com" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for PetitesAnnonces", - "fr": "Choisissez un chemin pour PetitesAnnonces" - }, "example": "/annonces", "default": "/annonces" }, { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public application?", - "fr": "Est-ce une application publique ?" - }, "default": true } ] diff --git a/pull_request_template.md b/pull_request_template.md index e393d3e..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/petitesannonces_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/petitesannonces_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/_common.sh b/scripts/_common.sh index 7e55ac0..944a65e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,6 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -pkg_dependencies="deb1 deb2 php$YNH_DEFAULT_PHP_VERSION-deb1 php$YNH_DEFAULT_PHP_VERSION-deb2" - #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index d0e7833..33b53ee 100755 --- a/scripts/backup +++ b/scripts/backup @@ -38,11 +38,6 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= ynh_print_info --message="Declaring files to be backed up..." -### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs -### to be backuped and not an actual copy of any file. The actual backup that -### creates and fill the archive with the files happens in the core after this -### script is called. Hence ynh_backups calls takes basically 0 seconds to run. - #================================================= # BACKUP THE APP MAIN DIR #================================================= @@ -61,43 +56,11 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" -#================================================= -# BACKUP FAIL2BAN CONFIGURATION -#================================================= - -#ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" -#ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" - -#================================================= -# SPECIFIC BACKUP -#================================================= -# BACKUP LOGROTATE -#================================================= - -#ynh_backup --src_path="/etc/logrotate.d/$app" - -#================================================= -# BACKUP SYSTEMD -#================================================= - -#ynh_backup --src_path="/etc/systemd/system/$app.service" - -#================================================= -# BACKUP VARIOUS FILES -#================================================= - -#ynh_backup --src_path="/etc/cron.d/$app" - -#ynh_backup --src_path="/etc/$app/" - #================================================= # BACKUP THE MYSQL DATABASE #================================================= ynh_print_info --message="Backing up the MySQL database..." -### (However, things like mysql dumps *do* take some time to run, though the -### copy of the generated dump to the archive still happens later) - ynh_mysql_dump_db --database="$db_name" > db.sql #================================================= diff --git a/scripts/change_url b/scripts/change_url index 6708db0..cb30bdc 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -29,11 +29,6 @@ ynh_script_progression --message="Loading installation settings..." --time --wei # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) -# Add settings here as needed by your application -#db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#db_user=$db_name -#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -105,12 +100,6 @@ then ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi -#================================================= -# SPECIFIC MODIFICATIONS -#================================================= -# ... -#================================================= - #================================================= # GENERIC FINALISATION #================================================= diff --git a/scripts/install b/scripts/install index 95204a1..a21f07a 100755 --- a/scripts/install +++ b/scripts/install @@ -26,38 +26,15 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH -#admin=$YNH_APP_ARG_ADMIN # l'administration se fait via phpmyadmin user et mot de passe créés plus bas is_public=$YNH_APP_ARG_IS_PUBLIC -#language=$YNH_APP_ARG_LANGUAGE -#password=$YNH_APP_ARG_PASSWORD -### If it's a multi-instance app, meaning it can be installed several times independently -### The id of the app as stated in the manifest is available as $YNH_APP_ID -### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...) -### The app instance name is available as $YNH_APP_INSTANCE_NAME -### - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample -### - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2 -### - ynhexample__{N} for the subsequent installations, with N=3,4, ... -### The app instance name is probably what interests you most, since this is -### guaranteed to be unique. This is a good unique identifier to define installation path, -### db names, ... app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -### About --weight and --time -### ynh_script_progression will show to your final users the progression of each scripts. -### In order to do that, --weight will represent the relative time of execution compared to the other steps in the script. -### --time is a packager option, it will show you the execution time since the previous call. -### This option should be removed before releasing your app. -### Use the execution time, given by --time, to estimate the weight of a step. -### A common way to do it is to set a weight equal to the execution time in second +1. -### The execution time is given for the duration since the previous call. So the weight should be applied to this previous call. ynh_script_progression --message="Validating installation parameters..." --time --weight=1 -### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". -### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app" final_path=/var/www/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" @@ -70,63 +47,12 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url ynh_script_progression --message="Storing installation settings..." --time --weight=1 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 - -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -ynh_script_progression --message="Finding an available port..." --time --weight=1 - -### Use these lines if you have to open a port for the application -### `ynh_find_port` will find the first available port starting from the given port. -### If you're not using these lines: -### - Remove the section "CLOSE A PORT" in the remove script - -# Find an available port # pas nécessaire -#port=$(ynh_find_port --port=8095) -#ynh_app_setting_set --app=$app --key=port --value=$port - -# Optional: Expose this port publicly -# (N.B. : you only need to do this if the app actually needs to expose the port publicly. -# If you do this and the app doesn't actually need you are CREATING SECURITY HOLES IN THE SERVER !) - -# Open the port -# ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port - -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Installing dependencies..." --time --weight=1 - -### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package. -### Those deb packages will be installed as dependencies of this package. -### If you're not using this helper: -### - Remove the section "REMOVE DEPENDENCIES" in the remove script -### - Remove the variable "pkg_dependencies" in _common.sh -### - As well as the section "REINSTALL DEPENDENCIES" in the restore script -### - And the section "UPGRADE DEPENDENCIES" in the upgrade script - -#ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE A MYSQL DATABASE #================================================= ynh_script_progression --message="Creating a MySQL database..." --time --weight=1 -### Use these lines if you need a database for the application. -### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password. -### The password will be stored as 'mysqlpwd' into the app settings, -### and will be available as $db_pwd -### If you're not using these lines: -### - Remove the section "BACKUP THE MYSQL DATABASE" in the backup script -### - Remove also the section "REMOVE THE MYSQL DATABASE" in the remove script -### - As well as the section "RESTORE THE MYSQL DATABASE" in the restore script - db_name=$(ynh_sanitize_dbid --db_name=$app) db_user=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name @@ -137,10 +63,6 @@ ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name #================================================= ynh_script_progression --message="Setting up source files..." --time --weight=1 -### `ynh_setup_source` is used to install an app from a zip or tar.gz file, -### downloaded from an upstream source, like a git repository. -### `ynh_setup_source` use the file conf/app.src - ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" @@ -150,8 +72,6 @@ ynh_setup_source --dest_dir="$final_path" #================================================= ynh_script_progression --message="Configuring nginx web server..." --time --weight=1 -### `ynh_add_nginx_config` will use the file conf/nginx.conf - # Create a dedicated nginx config ynh_add_nginx_config @@ -168,62 +88,20 @@ ynh_system_user_create --username=$app #================================================= ynh_script_progression --message="Configuring php-fpm..." --time --weight=1 -### `ynh_add_fpm_config` is used to set up a PHP config. -### You can remove it if your app doesn't use PHP. -### `ynh_add_fpm_config` will use the files conf/php-fpm.conf -### If you're not using these lines: -### - You can remove these files in conf/. -### - Remove the section "BACKUP THE PHP-FPM CONFIGURATION" in the backup script -### - Remove also the section "REMOVE PHP-FPM CONFIGURATION" in the remove script -### - As well as the section "RESTORE THE PHP-FPM CONFIGURATION" in the restore script -### With the reload at the end of the script. -### - And the section "PHP-FPM CONFIGURATION" in the upgrade script - # Create a dedicated php-fpm config ynh_add_fpm_config -#================================================= -# SPECIFIC SETUP -#================================================= -# ... -#================================================= - -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." --time --weight=1 - -### `ynh_systemd_config` is used to configure a systemd script for an app. -### It can be used for apps that use sysvinit (with adaptation) or systemd. -### Have a look at the app to be sure this app needs a systemd script. -### `ynh_systemd_config` will use the file conf/systemd.service -### If you're not using these lines: -### - You can remove those files in conf/. -### - Remove the section "BACKUP SYSTEMD" in the backup script -### - Remove also the section "STOP AND REMOVE SERVICE" in the remove script -### - As well as the section "RESTORE SYSTEMD" in the restore script -### - And the section "SETUP SYSTEMD" in the upgrade script - -# Create a dedicated systemd config -#ynh_add_systemd_config - #================================================= # SETUP APPLICATION WITH CURL #================================================= -### Use these lines only if the app installation needs to be finalized through -### web forms. We generally don't want to ask the final user, -### so we're going to use curl to automatically fill the fields and submit the -### forms. - # Set right permissions for curl install chown -R $app: $final_path # Set the app as temporarily public for curl call ynh_script_progression --message="Configuring SSOwat..." --time --weight=1 -ynh_app_setting_set --app=$app --key=skipped_uris --value="/" -# Reload SSOwat config -yunohost app ssowatconf + +ynh_permission_update --permission="main" --add="visitors" # Reload Nginx ynh_systemd_action --service_name=nginx --action=reload @@ -238,32 +116,6 @@ ynh_replace_string --match_string="votre_mdp_de_bdd" --replace_string=$db_pwd -- ynh_local_curl "/install.php" -# Remove the public access -if [ $is_public -eq 0 ] -then - ynh_app_setting_delete --app=$app --key=skipped_uris -fi - -#================================================= -# MODIFY A CONFIG FILE -#================================================= - -### `ynh_replace_string` is used to replace a string in a file. -### (It's compatible with sed regular expressions syntax) - -#ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$final_path/CONFIG_FILE" - -#================================================= -# STORE THE CONFIG FILE CHECKSUM -#================================================= - -### `ynh_store_file_checksum` is used to store the checksum of a file. -### That way, during the upgrade script, by using `ynh_backup_if_checksum_is_different`, -### you can make a backup of this file before modifying it again if the admin had modified it. - -# Calculate and store the config file checksum into the app settings -#ynh_store_file_checksum --file="$final_path/CONFIG_FILE" - #================================================= # GENERIC FINALIZATION #================================================= @@ -275,95 +127,19 @@ rm $final_path/install.php # SECURE FILES AND DIRECTORIES #================================================= -### For security reason, any app should set the permissions to root: before anything else. -### Then, if write authorization is needed, any access should be given only to directories -### that really need such authorization. - # Set permissions to app files chown -R root: $final_path chown -R $app:$app $final_path/uploads -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." --time --weight=1 - -### `ynh_use_logrotate` is used to configure a logrotate configuration for the logs of this app. -### Use this helper only if there is effectively a log file for this app. -### If you're not using this helper: -### - Remove the section "BACKUP LOGROTATE" in the backup script -### - Remove also the section "REMOVE LOGROTATE CONFIGURATION" in the remove script -### - As well as the section "RESTORE THE LOGROTATE CONFIGURATION" in the restore script -### - And the section "SETUP LOGROTATE" in the upgrade script - -# Use logrotate to manage application logfile(s) -#ynh_use_logrotate - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= - -### `yunohost service add` integrates a service in YunoHost. It then gets -### displayed in the admin interface and through the others `yunohost service` commands. -### (N.B. : this line only makes sense if the app adds a service to the system!) -### If you're not using these lines: -### - You can remove these files in conf/. -### - Remove the section "REMOVE SERVICE FROM ADMIN PANEL" in the remove script -### - As well as the section "INTEGRATE SERVICE IN YUNOHOST" in the restore script - -#yunohost service add $app --description "A short description of the app" --log "/var/log/$app/$app.log" - -### Additional options starting with 3.8: -### -### --needs_exposed_ports "$port" a list of ports that needs to be publicly exposed -### which will then be checked by YunoHost's diagnosis system -### (N.B. DO NOT USE THIS is the port is only internal !!!) -### -### --test_status "some command" a custom command to check the status of the service -### (only relevant if 'systemctl status' doesn't do a good job) -### -### --test_conf "some command" some command similar to "nginx -t" that validates the conf of the service -### -### Re-calling 'yunohost service add' during the upgrade script is the right way -### to proceed if you later realize that you need to enable some flags that -### weren't enabled on old installs (be careful it'll override the existing -### service though so you should re-provide all relevant flags when doing so) -### - -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 - -### `ynh_systemd_action` is used to start a systemd service for an app. -### Only needed if you have configure a systemd service -### If you're not using these lines: -### - Remove the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the backup script -### - As well as the section "START SYSTEMD SERVICE" in the restore script -### - As well as the section"STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the upgrade script -### - And the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the change_url script - -# Start a systemd service -#ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" - -#================================================= -# SETUP FAIL2BAN -#================================================= -ynh_script_progression --message="Configuring fail2ban..." --time --weight=1 - -# Create a dedicated fail2ban config -#ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login" - #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." --time --weight=1 +ynh_script_progression --message="Configuring permissions..." --time --weight=1 # Make app public if necessary -if [ $is_public -eq 1 ] +if [ $is_public -eq 0 ] then - # unprotected_uris allows SSO credentials to be passed anyway. - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" + ynh_permission_update --permission="main" --remove="visitors" fi #================================================= diff --git a/scripts/remove b/scripts/remove index 0e5b7a5..a62fb9a 100755 --- a/scripts/remove +++ b/scripts/remove @@ -17,7 +17,6 @@ ynh_script_progression --message="Loading installation settings..." --time --wei app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) -#port=$(ynh_app_setting_get --app=$app --key=port) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name final_path=$(ynh_app_setting_get --app=$app --key=final_path) @@ -35,14 +34,6 @@ then #yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --time --weight=1 - -# Remove the dedicated systemd config -#ynh_remove_systemd_config - #================================================= # REMOVE THE MYSQL DATABASE #================================================= @@ -51,14 +42,6 @@ ynh_script_progression --message="Removing the MySQL database..." --time --weigh # Remove a database if it exists, along with the associated user ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --time --weight=1 - -# Remove metapackage and its dependencies -#ynh_remove_app_dependencies - #================================================= # REMOVE APP MAIN DIR #================================================= @@ -101,29 +84,6 @@ then ynh_exec_warn_less yunohost firewall disallow TCP $port fi -#================================================= -# REMOVE FAIL2BAN CONFIGURATION -#================================================= -ynh_script_progression --message="Removing fail2ban configuration..." --time --weight=1 - -# Remove the dedicated fail2ban config -#ynh_remove_fail2ban_config - -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE VARIOUS FILES -#================================================= - -# Remove a cron file -#ynh_secure_remove --file="/etc/cron.d/$app" - -# Remove a directory securely -#ynh_secure_remove --file="/etc/$app/" - -# Remove the log files -#ynh_secure_remove --file="/var/log/$app/" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index af86347..993fd35 100755 --- a/scripts/restore +++ b/scripts/restore @@ -81,15 +81,6 @@ chown -R root: $final_path ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" -#================================================= -# RESTORE FAIL2BAN CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the fail2ban configuration..." --time --weight=1 - -#ynh_restore_file "/etc/fail2ban/jail.d/$app.conf" -#ynh_restore_file "/etc/fail2ban/filter.d/$app.conf" -#ynh_systemd_action --action=restart --service_name=fail2ban - #================================================= # SPECIFIC RESTORATION #================================================= @@ -109,41 +100,6 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql -#================================================= -# RESTORE SYSTEMD -#================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --time --weight=1 - -#ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -#systemctl enable $app.service - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= - -#yunohost service add $app --description "A short description of the app" --log "/var/log/$app/$app.log" - -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 - -#ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" - -#================================================= -# RESTORE VARIOUS FILES -#================================================= - -#ynh_restore_file --origin_path="/etc/cron.d/$app" - -#ynh_restore_file --origin_path="/etc/$app/" - -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= - -#ynh_restore_file --origin_path="/etc/logrotate.d/$app" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 54bdd7d..5ec514d 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,22 +18,16 @@ 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) +db_user=$db_name +db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) #================================================= # CHECK VERSION #================================================= -### This helper will compare the version of the currently installed app and the version of the upstream package. -### $upgrade_type can have 2 different values -### - UPGRADE_APP if the upstream app version has changed -### - UPGRADE_PACKAGE if only the YunoHost package has changed -### ynh_check_app_version_changed will stop the upgrade if the app is up to date. -### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do. upgrade_type=$(ynh_check_app_version_changed) #================================================= @@ -41,15 +35,6 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --time --weight=1 -# 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 - # If db_name doesn't exist, create it if [ -z "$db_name" ]; then db_name=$(ynh_sanitize_dbid --db_name=$app) @@ -76,27 +61,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 -# N.B. : this is for app installations before YunoHost 2.7 -# where this value might be something like /foo/ or foo/ -# instead of /foo .... -# If nobody installed your app before 2.7, then you may -# safely remove this line -path_url=$(ynh_normalize_url_path --path_url=$path_url) - -#================================================= -# STANDARD UPGRADE STEPS -#================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 - -#ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -117,13 +81,6 @@ ynh_script_progression --message="Upgrading nginx web server configuration..." - # Create a dedicated nginx config ynh_add_nginx_config -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." --time --weight=1 - -#ynh_install_app_dependencies $pkg_dependencies - #================================================= # CREATE DEDICATED USER #================================================= @@ -143,8 +100,6 @@ ynh_add_fpm_config #================================================= # SPECIFIC UPGRADE #================================================= -# ... -#================================================= # Supprimer install.php rm $final_path/install.php @@ -152,52 +107,10 @@ rm $final_path/install.php # ynh_restore_file $final_path/conf/config.php # pas autorisé dans upgrade # autre piste -db_user=$db_name -db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) ynh_replace_string --match_string="votre_nom_de_bdd" --replace_string=$db_name --target_file="$final_path/conf/config.php" ynh_replace_string --match_string="votre_utilisateur_de_bdd" --replace_string=$db_user --target_file="$final_path/conf/config.php" ynh_replace_string --match_string="votre_mdp_de_bdd" --replace_string=$db_pwd --target_file="$final_path/conf/config.php" - -#================================================= -# MODIFY A CONFIG FILE -#================================================= - -### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. -### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. -#ynh_backup_if_checksum_is_different --file="$final_path/CONFIG_FILE" - -#ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$final_path/CONFIG_FILE" - -# Recalculate and store the checksum of the file for the next upgrade. -#ynh_store_file_checksum --file="$final_path/CONFIG_FILE" - -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --time --weight=1 - -# Use logrotate to manage app-specific logfile(s) -#ynh_use_logrotate --non-append - -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --time --weight=1 - -# Create a dedicated systemd config -#ynh_add_systemd_config - -#================================================= -# GENERIC FINALIZATION -#================================================= -# UPGRADE FAIL2BAN -#================================================= -ynh_script_progression --message="Reconfiguring fail2ban..." --time --weight=1 - -# Create a dedicated fail2ban config -#ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login" - #================================================= # SECURE FILES AND DIRECTORIES #================================================= @@ -205,25 +118,6 @@ ynh_script_progression --message="Reconfiguring fail2ban..." --time --weight=1 # Set permissions on app files chown -R root: $final_path -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." --time --weight=1 - -# 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 - -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 - -#ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" - #================================================= # RELOAD NGINX #================================================= diff --git a/sources/extra_files/app/.gitignore b/sources/extra_files/app/.gitignore deleted file mode 100644 index 783a4ae..0000000 --- a/sources/extra_files/app/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*~ -*.sw[op] diff --git a/sources/patches/.gitignore b/sources/patches/.gitignore deleted file mode 100644 index 783a4ae..0000000 --- a/sources/patches/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*~ -*.sw[op] From c22ba7d11f6789e7aaa344add34f0db97abf7ea2 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Thu, 13 May 2021 17:50:58 +0200 Subject: [PATCH 04/14] [autopatch] Update issue and PR templates --- .../ISSUE_TEMPLATE.md | 39 ++++++++++++------- .github/PULL_REQUEST_TEMPLATE.md | 16 ++++++++ pull_request_template.md | 18 --------- 3 files changed, 40 insertions(+), 33 deletions(-) rename issue_template.md => .github/ISSUE_TEMPLATE.md (51%) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 pull_request_template.md diff --git a/issue_template.md b/.github/ISSUE_TEMPLATE.md similarity index 51% rename from issue_template.md rename to .github/ISSUE_TEMPLATE.md index 79526b7..2729a6b 100644 --- a/issue_template.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,46 +1,55 @@ --- name: Bug report -about: Create a report to help us debug, it would be nice to fill the template as much as you can to help us, help you and help us all. +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 PetitesAnnonces itself. Refer to its documentation or repository for help.* - - *If you have a doubt, post here, we will figure it out together.* + - *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 the app 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** +### Describe the bug + *A clear and concise description of what the bug is.* -**Versions** +### 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* +- 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`* -**To Reproduce** -*Steps to reproduce the behavior.* +### Steps to reproduce + - *If you performed a command from the CLI, the command itself is enough. For example:* ```sh - sudo yunohost app install PetitesAnnonces + sudo yunohost app install the_app ``` - *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 '....'* + 2. *Click on '...'* + 3. *Scroll down to '...'* 4. *See error* -**Expected behavior** +### 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** -*After a failed command, YunoHost makes the log available to you, but also to others, thanks to `yunohost log display [log name] --share`. The actual command, with the correct log name, is displayed at the end of the failed attempt in the CLI. Execute it and copy here the share link it outputs.* +### 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/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..ef70e18 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,16 @@ +## Problem + +- *Description of why you made this PR* + +## Solution + +- *And how do you fix that problem* + +## PR Status + +- [ ] Code finished and ready to be reviewed/tested +- [ ] The fix/enhancement were manually tested (if applicable) + +## Automatic tests + +Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization) diff --git a/pull_request_template.md b/pull_request_template.md deleted file mode 100644 index e393d3e..0000000 --- a/pull_request_template.md +++ /dev/null @@ -1,18 +0,0 @@ -## Problem -- *Description of why you made this PR* - -## Solution -- *And how do you fix that problem* - -## PR Status -- [ ] Code finished. -- [ ] Tested with Package_check. -- [ ] Fix or enhancement tested. -- [ ] Upgrade from last version tested. -- [ ] Can be reviewed and tested. - -## 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/petitesannonces_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/petitesannonces_ynh%20PR-NUM-%20(USERNAME)/) From 6e8b9c4f84548cd90f751f88e9f5a220a508b89e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 11 Jul 2021 19:20:29 +0200 Subject: [PATCH 05/14] Fix --- .DS_Store | Bin 0 -> 6148 bytes check_process | 18 +++++--------- doc/.DS_Store | Bin 0 -> 6148 bytes doc/{ => screenshots}/demo.png | Bin manifest.json | 12 ++++++--- scripts/_common.sh | 2 ++ scripts/change_url | 12 ++++----- scripts/install | 44 ++++++++++++++------------------- scripts/remove | 28 +++++++-------------- scripts/restore | 12 +-------- scripts/upgrade | 37 ++++++++++++++------------- 11 files changed, 69 insertions(+), 96 deletions(-) create mode 100644 .DS_Store create mode 100644 doc/.DS_Store rename doc/{ => screenshots}/demo.png (100%) diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..9b786ce52aa00e90336160999621dda530c39633 GIT binary patch literal 6148 zcmeH~J!%6%427R!7lt%jrkutH$PET#pTHLg*pSB9U`XmYdY*ooY+RcqJc0B^niaeI z6+0^cw);B20~3G^-4$C8Gc)EZoN>eH`*^=zZr4v%yb8QT%#4)@v;EqZh=2%)fCz|y z2rP&|p5oZNF6f!`C?X&N%OK$2hemhpr6V;y9Sku7P}eMnaUHV+wRwTsOGhdzG^^>s zs?}l)@p`mVTV2;nM{2giYWT3av-uQ5vuuYoCN%3I3L+o^GXks3CqMrW^hfjmtVO8^ zh`>K1VC(&HzvD~Q+4|@8y#7&DUk^GpE@$}l6Trle;x~F2_nR-My>z6qLeq~xU{DZ& HrxN%9njH~; literal 0 HcmV?d00001 diff --git a/check_process b/check_process index 78296bb..e8a2b05 100644 --- a/check_process +++ b/check_process @@ -1,17 +1,12 @@ -# See here for more information -# https://github.com/YunoHost/package_check#syntax-check_process-file - -# Move this file from check_process.default to check_process when you have filled it. - ;; Test complet ; Manifest - domain="domain.tld" (DOMAIN) - path="/path" (PATH) - admin="john" (USER) + domain="domain.tld" + path="/path" + admin="john" language="fr" - is_public=1 (PUBLIC|public=1|private=0) - password="pass" - port="666" (PORT) + is_public=1 + password="password" + port="666" ; Checks pkg_linter=1 setup_sub_dir=1 @@ -23,7 +18,6 @@ #upgrade=1 from_commit=CommitHash backup_restore=1 multi_instance=1 - port_already_use=0 change_url=1 ;;; Options Email= diff --git a/doc/.DS_Store b/doc/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0= 4.1.7" + "yunohost": ">= 4.2.4" }, "multi_instance": true, "services": [ diff --git a/scripts/_common.sh b/scripts/_common.sh index 944a65e..d7614e9 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,6 +4,8 @@ # COMMON VARIABLES #================================================= +YNH_PHP_VERSION="7.3" + #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/change_url b/scripts/change_url index cb30bdc..3cda925 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) @@ -67,14 +67,14 @@ fi #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 +ynh_script_progression --message="Stopping a systemd service..." --weight=1 #ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating nginx web server configuration..." --time --weight=1 +ynh_script_progression --message="Updating nginx web server configuration..." --weight=1 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -105,14 +105,14 @@ fi #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 +ynh_script_progression --message="Starting a systemd service..." --weight=1 #ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +ynh_script_progression --message="Reloading nginx web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -120,4 +120,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --time --last +ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/install b/scripts/install index a21f07a..a88c5b5 100755 --- a/scripts/install +++ b/scripts/install @@ -44,24 +44,32 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --time --weight=1 +ynh_script_progression --message="Storing installation settings..." --weight=1 ynh_app_setting_set --app=$app --key=domain --value=$domain #================================================= # CREATE A MYSQL DATABASE #================================================= -ynh_script_progression --message="Creating a MySQL database..." --time --weight=1 +ynh_script_progression --message="Creating a MySQL database..." --weight=1 db_name=$(ynh_sanitize_dbid --db_name=$app) db_user=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." --time --weight=1 + +# Create a system user +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --time --weight=1 +ynh_script_progression --message="Setting up source files..." --weight=1 ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src @@ -70,23 +78,15 @@ ynh_setup_source --dest_dir="$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." --time --weight=1 +ynh_script_progression --message="Configuring nginx web server..." --weight=1 # Create a dedicated nginx config ynh_add_nginx_config -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." --time --weight=1 - -# Create a system user -ynh_system_user_create --username=$app - #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring php-fpm..." --time --weight=1 +ynh_script_progression --message="Configuring php-fpm..." --weight=1 # Create a dedicated php-fpm config ynh_add_fpm_config @@ -98,17 +98,13 @@ ynh_add_fpm_config # Set right permissions for curl install chown -R $app: $final_path -# Set the app as temporarily public for curl call -ynh_script_progression --message="Configuring SSOwat..." --time --weight=1 - ynh_permission_update --permission="main" --add="visitors" # Reload Nginx ynh_systemd_action --service_name=nginx --action=reload # Installation with curl -ynh_script_progression --message="Finalizing installation..." --time --weight=1 -#ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3" +ynh_script_progression --message="Finalizing installation..." --weight=1 ynh_replace_string --match_string="votre_nom_de_bdd" --replace_string=$db_name --target_file="$final_path/conf/config.php" ynh_replace_string --match_string="votre_utilisateur_de_bdd" --replace_string=$db_user --target_file="$final_path/conf/config.php" @@ -116,12 +112,8 @@ ynh_replace_string --match_string="votre_mdp_de_bdd" --replace_string=$db_pwd -- ynh_local_curl "/install.php" -#================================================= -# GENERIC FINALIZATION -#================================================= - # Supprimer install.php -rm $final_path/install.php +ynh_secure_remove --file=$final_path/install.php #================================================= # SECURE FILES AND DIRECTORIES @@ -134,7 +126,7 @@ chown -R $app:$app $final_path/uploads #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring permissions..." --time --weight=1 +ynh_script_progression --message="Configuring permissions..." --weight=1 # Make app public if necessary if [ $is_public -eq 0 ] @@ -145,7 +137,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +ynh_script_progression --message="Reloading nginx web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -153,4 +145,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --time --last +ynh_script_progression --message="Installation of $app completed" --last diff --git a/scripts/remove b/scripts/remove index a62fb9a..a2855d1 100755 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -30,14 +30,14 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) # Remove the service from the list of services known by Yunohost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null then - ynh_script_progression --message="Removing $app service..." --time --weight=1 + ynh_script_progression --message="Removing $app service..." --weight=1 #yunohost service remove $app fi #================================================= # REMOVE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Removing the MySQL database..." --time --weight=1 +ynh_script_progression --message="Removing the MySQL database..." --weight=1 # Remove a database if it exists, along with the associated user ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name @@ -45,7 +45,7 @@ ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --time --weight=1 +ynh_script_progression --message="Removing app main directory..." --weight=1 # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -53,7 +53,7 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration..." --time --weight=1 +ynh_script_progression --message="Removing nginx web server configuration..." --weight=1 # Remove the dedicated nginx config ynh_remove_nginx_config @@ -61,7 +61,7 @@ ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Removing php-fpm configuration..." --time --weight=1 +ynh_script_progression --message="Removing php-fpm configuration..." --weight=1 # Remove the dedicated php-fpm config ynh_remove_fpm_config @@ -69,27 +69,17 @@ ynh_remove_fpm_config #================================================= # REMOVE LOGROTATE CONFIGURATION #================================================= -ynh_script_progression --message="Removing logrotate configuration..." --time --weight=1 +ynh_script_progression --message="Removing logrotate configuration..." --weight=1 # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $port$" -then - ynh_script_progression --message="Closing port $port..." --time --weight=1 - ynh_exec_warn_less yunohost firewall disallow TCP $port -fi - #================================================= # GENERIC FINALIZATION #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." --time --weight=1 +ynh_script_progression --message="Removing the dedicated system user..." --weight=1 # Delete a system user ynh_system_user_delete --username=$app @@ -98,4 +88,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --time --last +ynh_script_progression --message="Removal of $app completed" --last diff --git a/scripts/restore b/scripts/restore index 993fd35..96122e7 100755 --- a/scripts/restore +++ b/scripts/restore @@ -81,16 +81,6 @@ chown -R root: $final_path ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" -#================================================= -# SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1 - -# Define and install dependencies -#ynh_install_app_dependencies $pkg_dependencies - #================================================= # RESTORE THE MYSQL DATABASE #================================================= @@ -105,7 +95,7 @@ ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./ #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading nginx web server and php-fpm..." --time --weight=1 +ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=1 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 5ec514d..1e9c24a 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -30,6 +30,19 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) 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)..." --time --weight=1 + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -48,18 +61,12 @@ if [ -z "$final_path" ]; then fi #================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +# CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --time --weight=1 +ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1 -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - # restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -81,14 +88,6 @@ ynh_script_progression --message="Upgrading nginx web server configuration..." - # Create a dedicated nginx config ynh_add_nginx_config -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1 - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app - #================================================= # PHP-FPM CONFIGURATION #================================================= @@ -102,7 +101,7 @@ ynh_add_fpm_config #================================================= # Supprimer install.php -rm $final_path/install.php +ynh_secure_remove --file="$final_path/install.php" # Restaurer config.php # ynh_restore_file $final_path/conf/config.php # pas autorisé dans upgrade From c851ddbea868f31803ccef01a950616e9805cf7a Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Sun, 11 Jul 2021 17:20:36 +0000 Subject: [PATCH 06/14] Auto-update README --- README.md | 76 +++++++++++++++------------------------------------- README_fr.md | 76 ++++++++++++---------------------------------------- 2 files changed, 38 insertions(+), 114 deletions(-) diff --git a/README.md b/README.md index 0f9353a..e5f1d50 100644 --- a/README.md +++ b/README.md @@ -1,72 +1,36 @@ + + # PetitesAnnonces for YunoHost -[ -![](https://dash.yunohost.org/integration/petitesannonces.svg) -![](https://ci-apps.yunohost.org/ci/badges/petitesannonces.status.svg) -![](https://ci-apps.yunohost.org/ci/badges/petitesannonces.maintain.svg) -](https://dash.yunohost.org/appci/app/petitesannonces) -[![Install petitesannonces with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=petitesannonces) +[![Integration level](https://dash.yunohost.org/integration/petitesannonces.svg)](https://dash.yunohost.org/appci/app/petitesannonces) ![](https://ci-apps.yunohost.org/ci/badges/petitesannonces.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/petitesannonces.maintain.svg) +[![Install PetitesAnnonces with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=petitesannonces) *[Lire ce readme en français.](./README_fr.md)* -> *This package allow you to install PetitesAnnonces 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 PetitesAnnonces 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 -Make your own classified advertising website easily. +Make your own classified advertising website easily -**Shipped version:** 0.1.0 +**Shipped version:** 0.1.0~ynh3 + +**Demo:** https://demo.example.com ## Screenshots -![demo](doc/demo.png) +![](./doc/screenshots/demo.png) - -## Configuration - -How to configure this app: From an admin panel, a plain file with SSH, or any other way. - -## Documentation - - * Official documentation: https://framagit.org/anto1ne/petitesannonces - * YunoHost documentation: If specific documentation is needed, feel free to contribute. - -## YunoHost specific features - -#### Multi-user support - -Are LDAP and HTTP auth supported? : No -Can the app be used by multiple users? : No - -#### Supported architectures - -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/petitesannonces%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/petitesannonces/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/petitesannonces%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/petitesannonces/) - -## Limitations - -* Any known limitations : young application, still in developpment. - -## Additional information - -* Other info you would like to add about this app. - -**More info on the documentation page:** -https://yunohost.org/packaging_apps - -## Links - - * Report a bug: https://github.com/YunoHost-Apps/petitesannonces_ynh/issues - * App website: https://framagit.org/anto1ne/petitesannonces - * Upstream app repository: https://framagit.org/anto1ne/petitesannonces - * YunoHost website: https://yunohost.org/ - ---- +* Official app website: https://framagit.org/toitoinebzh/petitesannonces +* Upstream app code repository: https://framagit.org/toitoinebzh/petitesannonces +* YunoHost documentation for this app: https://yunohost.org/app_petitesannonces +* Report a bug: https://github.com/YunoHost-Apps/petitesannonces_ynh/issues ## Developer info @@ -78,3 +42,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/petitesannonces_ynh/t or sudo yunohost app upgrade petitesannonces -u https://github.com/YunoHost-Apps/petitesannonces_ynh/tree/testing --debug ``` + +**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/README_fr.md b/README_fr.md index f85cb24..2547eb4 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,76 +1,32 @@ # PetitesAnnonces pour YunoHost -[ -![](https://dash.yunohost.org/integration/petitesannonces.svg) -![](https://ci-apps.yunohost.org/ci/badges/petitesannonces.status.svg) -![](https://ci-apps.yunohost.org/ci/badges/petitesannonces.maintain.svg) -](https://dash.yunohost.org/appci/app/petitesannonces) -[![Installer petitesannonces avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=petitesannonces) +[![Niveau d'intégration](https://dash.yunohost.org/integration/petitesannonces.svg)](https://dash.yunohost.org/appci/app/petitesannonces) ![](https://ci-apps.yunohost.org/ci/badges/petitesannonces.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/petitesannonces.maintain.svg) +[![Installer PetitesAnnonces avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=petitesannonces) -*[Read this readme in english.](./README.md)* +*[Read this readme in english.](./README.md)* +*[Lire ce readme en français.](./README_fr.md)* -> *Ce package vous permet d'installer PetitesAnnonces rapidement et simplement sur un serveur Yunohost. -Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* +> *Ce package vous permet d'installer PetitesAnnonces 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.* ## Vue d'ensemble -Grâce à cet outil, créer simplement et rapidement votre site de Petites Annonces. +Créer simplement et rapidement votre site de Petites Annonces -Les fonctionnalités de cette outils sont : - * Affichage des annonces mises en ligne - * Tri selon la région, la catégorie et mot-clés - * Ajout/suppression d'annonces - * Possibilité d'envoyer un message à celui qui a déposé l'annonce +**Version incluse :** 0.1.0~ynh3 - -**Version incluse:** 0.1.0 +**Démo :** https://demo.example.com ## Captures d'écran -![demo](doc/demo.png) +![](./doc/screenshots/demo.png) - -## Configuration - -Comment configurer cette application: via le panneau d'administration, un fichier brut en SSH ou tout autre moyen. - -## Documentation - - * Documentation officielle: https://framagit.org/anto1ne/petitesannonces - * Documentation YunoHost: Si une documentation spécifique est nécessaire, n'hésitez pas à contribuer. - -## Caractéristiques spécifiques YunoHost - -#### Support multi-utilisateur - -L'authentification LDAP et HTTP est-elle prise en charge? : Non -L'application peut-elle être utilisée par plusieurs utilisateurs? : Non - -#### Architectures supportées - -* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/petitesannonces%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/petitesannonces/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/petitesannonces%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/petitesannonces/) - -## Limitations - -* Limitations connues : jeune application en cours de développement. - -## Informations additionnelles - -* Autres informations que vous souhaitez ajouter sur cette application : RAS - -## Liens - - * Signaler un bug: https://github.com/YunoHost-Apps/petitesannonces_ynh/issues - * Site de l'application: https://framagit.org/anto1ne/petitesannonces - * Dépôt de l'application principale: https://framagit.org/anto1ne/petitesannonces - * Site web YunoHost: https://yunohost.org/ - ---- +* Site officiel de l'app : https://framagit.org/toitoinebzh/petitesannonces +* Dépôt de code officiel de l'app : https://framagit.org/toitoinebzh/petitesannonces +* Documentation YunoHost pour cette app : https://yunohost.org/app_petitesannonces +* Signaler un bug : https://github.com/YunoHost-Apps/petitesannonces_ynh/issues ## Informations pour les développeurs @@ -82,3 +38,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/petitesannonces_ynh/t ou sudo yunohost app upgrade petitesannonces -u https://github.com/YunoHost-Apps/petitesannonces_ynh/tree/testing --debug ``` + +**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file From a4beff4b0838cb57690870c896a78f0d98e14aa2 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 11 Jul 2021 19:26:42 +0200 Subject: [PATCH 07/14] Fix --- check_process | 1 - conf/systemd.service | 13 ------------- scripts/install | 4 ++-- scripts/restore | 12 ++++++------ scripts/upgrade | 18 +++++++++--------- 5 files changed, 17 insertions(+), 31 deletions(-) delete mode 100644 conf/systemd.service diff --git a/check_process b/check_process index e8a2b05..ad00dd7 100644 --- a/check_process +++ b/check_process @@ -6,7 +6,6 @@ language="fr" is_public=1 password="password" - port="666" ; Checks pkg_linter=1 setup_sub_dir=1 diff --git a/conf/systemd.service b/conf/systemd.service deleted file mode 100644 index 76cdf64..0000000 --- a/conf/systemd.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Small description of the service -After=network.target - -[Service] -Type=simple -User=__APP__ -Group=__APP__ -WorkingDirectory=__FINALPATH__/ -ExecStart=__FINALPATH__/script >> /var/log/__APP__/__APP__.log 2>&1 - -[Install] -WantedBy=multi-user.target diff --git a/scripts/install b/scripts/install index a88c5b5..b7436ce 100755 --- a/scripts/install +++ b/scripts/install @@ -33,7 +33,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." --time --weight=1 +ynh_script_progression --message="Validating installation parameters..." --weight=1 final_path=/var/www/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" @@ -61,7 +61,7 @@ ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." --time --weight=1 +ynh_script_progression --message="Configuring system user..." --weight=1 # Create a system user ynh_system_user_create --username=$app --home_dir="$final_path" diff --git a/scripts/restore b/scripts/restore index 96122e7..943af49 100755 --- a/scripts/restore +++ b/scripts/restore @@ -24,7 +24,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -38,7 +38,7 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." --time --weight=1 +ynh_script_progression --message="Validating restoration parameters..." --weight=1 ynh_webpath_available --domain=$domain --path_url=$path_url \ || ynh_die --message="Path not available: ${domain}${path_url}" @@ -56,14 +56,14 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." --time --weight=1 +ynh_script_progression --message="Restoring the app main directory..." --weight=1 ynh_restore_file --origin_path="$final_path" #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --time --weight=1 +ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 # Create the dedicated user (if not existing) ynh_system_user_create --username=$app @@ -84,7 +84,7 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # RESTORE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Restoring the MySQL database..." --time --weight=1 +ynh_script_progression --message="Restoring the MySQL database..." --weight=1 db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd @@ -104,4 +104,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --time --last +ynh_script_progression --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index 1e9c24a..a7175ce 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -33,7 +33,7 @@ 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)..." --time --weight=1 +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 # Backup the current version of the app ynh_backup_before_upgrade @@ -46,7 +46,7 @@ ynh_abort_if_errors #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --time --weight=1 +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 # If db_name doesn't exist, create it if [ -z "$db_name" ]; then @@ -63,7 +63,7 @@ fi #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1 +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 # Create a dedicated user (if not existing) ynh_system_user_create --username=$app --home_dir="$final_path" @@ -74,7 +74,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path" if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Upgrading source files..." --time --weight=1 + ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" @@ -83,7 +83,7 @@ fi #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1 # Create a dedicated nginx config ynh_add_nginx_config @@ -91,7 +91,7 @@ ynh_add_nginx_config #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading php-fpm configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=1 # Create a dedicated php-fpm config ynh_add_fpm_config @@ -120,7 +120,7 @@ chown -R root: $final_path #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +ynh_script_progression --message="Reloading nginx web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -128,4 +128,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --time --last +ynh_script_progression --message="Upgrade of $app completed" --last From 559d6b63b88c3a77e640412eda1957278b58210a Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 11 Jul 2021 19:30:50 +0200 Subject: [PATCH 08/14] Fix --- scripts/change_url | 15 +++------------ scripts/install | 21 +++++++-------------- scripts/remove | 4 ++-- scripts/restore | 25 +++++++++++-------------- scripts/upgrade | 17 +++++++---------- 5 files changed, 30 insertions(+), 52 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 3cda925..039a977 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -32,7 +32,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --time --weight=1 +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --time --weight=1 # Backup the current version of the app ynh_backup_before_upgrade @@ -62,19 +62,10 @@ then change_path=1 fi -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 - -#ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" - #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating nginx web server configuration..." --weight=1 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -112,7 +103,7 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/install b/scripts/install index b7436ce..d93c61a 100755 --- a/scripts/install +++ b/scripts/install @@ -75,10 +75,14 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" +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 +ynh_script_progression --message="Configuring NGINX web server..." --weight=1 # Create a dedicated nginx config ynh_add_nginx_config @@ -86,7 +90,7 @@ ynh_add_nginx_config #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring php-fpm..." --weight=1 +ynh_script_progression --message="Configuring PHP-FPM..." --weight=1 # Create a dedicated php-fpm config ynh_add_fpm_config @@ -95,9 +99,6 @@ ynh_add_fpm_config # SETUP APPLICATION WITH CURL #================================================= -# Set right permissions for curl install -chown -R $app: $final_path - ynh_permission_update --permission="main" --add="visitors" # Reload Nginx @@ -115,14 +116,6 @@ ynh_local_curl "/install.php" # Supprimer install.php ynh_secure_remove --file=$final_path/install.php -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions to app files -chown -R root: $final_path -chown -R $app:$app $final_path/uploads - #================================================= # SETUP SSOWAT #================================================= @@ -137,7 +130,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/remove b/scripts/remove index a2855d1..7618fe2 100755 --- a/scripts/remove +++ b/scripts/remove @@ -53,7 +53,7 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration..." --weight=1 +ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 # Remove the dedicated nginx config ynh_remove_nginx_config @@ -61,7 +61,7 @@ ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Removing php-fpm configuration..." --weight=1 +ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1 # Remove the dedicated php-fpm config ynh_remove_fpm_config diff --git a/scripts/restore b/scripts/restore index 943af49..d6b56cb 100755 --- a/scripts/restore +++ b/scripts/restore @@ -53,6 +53,14 @@ test ! -d $final_path \ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +#================================================= +# RECREATE THE DEDICATED USER +#================================================= +ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 + +# Create the dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -60,20 +68,9 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$final_path" -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 - -# Create the dedicated user (if not existing) -ynh_system_user_create --username=$app - -#================================================= -# RESTORE USER RIGHTS -#================================================= - -# Restore permissions on app files -chown -R root: $final_path +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" #================================================= # RESTORE THE PHP-FPM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index a7175ce..9050a1a 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -80,10 +80,14 @@ then ynh_setup_source --dest_dir="$final_path" fi +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 +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 # Create a dedicated nginx config ynh_add_nginx_config @@ -91,7 +95,7 @@ ynh_add_nginx_config #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=1 +ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1 # Create a dedicated php-fpm config ynh_add_fpm_config @@ -110,17 +114,10 @@ ynh_replace_string --match_string="votre_nom_de_bdd" --replace_string=$db_name - ynh_replace_string --match_string="votre_utilisateur_de_bdd" --replace_string=$db_user --target_file="$final_path/conf/config.php" ynh_replace_string --match_string="votre_mdp_de_bdd" --replace_string=$db_pwd --target_file="$final_path/conf/config.php" -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions on app files -chown -R root: $final_path - #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload From c72facd89e9bcac620dcabe8966b22599a0fbb93 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 12 Jul 2021 07:46:51 +0200 Subject: [PATCH 09/14] cleaning up --- manifest.json | 2 +- scripts/change_url | 11 +---------- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/manifest.json b/manifest.json index 5cf1e13..637483b 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Make your own classified advertising website easily", "fr": "Créer simplement et rapidement votre site de Petites Annonces" }, - "version": "0.1.0~ynh3", + "version": "0.1.0~ynh4", "url": "https://framagit.org/toitoinebzh/petitesannonces", "upstream": { "license": "AGPL-3.0-or-later", diff --git a/scripts/change_url b/scripts/change_url index 039a977..27e120d 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -32,7 +32,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --time --weight=1 +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 # Backup the current version of the app ynh_backup_before_upgrade @@ -91,15 +91,6 @@ then ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi -#================================================= -# GENERIC FINALISATION -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 - -#ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" - #================================================= # RELOAD NGINX #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 9050a1a..1f7fff9 100755 --- 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) db_user=$db_name @@ -43,6 +42,7 @@ ynh_clean_setup () { } # Exit if an error occurs during the execution of the script ynh_abort_if_errors + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= From 2ecb23b948036a5fd8c8b16d815df947a53162f1 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Mon, 12 Jul 2021 05:46:59 +0000 Subject: [PATCH 10/14] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e5f1d50..6465264 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Make your own classified advertising website easily -**Shipped version:** 0.1.0~ynh3 +**Shipped version:** 0.1.0~ynh4 **Demo:** https://demo.example.com diff --git a/README_fr.md b/README_fr.md index 2547eb4..a7ae51d 100644 --- a/README_fr.md +++ b/README_fr.md @@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Créer simplement et rapidement votre site de Petites Annonces -**Version incluse :** 0.1.0~ynh3 +**Version incluse :** 0.1.0~ynh4 **Démo :** https://demo.example.com From b0e1061d5c1f79f67ef6ed9db388855e3f6870a4 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 12 Jul 2021 19:21:29 +0200 Subject: [PATCH 11/14] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 637483b..1379b22 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Make your own classified advertising website easily", "fr": "Créer simplement et rapidement votre site de Petites Annonces" }, - "version": "0.1.0~ynh4", + "version": "0.1.0~ynh2", "url": "https://framagit.org/toitoinebzh/petitesannonces", "upstream": { "license": "AGPL-3.0-or-later", From b6d0319980159b476e1080e2fc6c6fa035e157fe Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Mon, 12 Jul 2021 17:21:36 +0000 Subject: [PATCH 12/14] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6465264..8d03470 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Make your own classified advertising website easily -**Shipped version:** 0.1.0~ynh4 +**Shipped version:** 0.1.0~ynh2 **Demo:** https://demo.example.com diff --git a/README_fr.md b/README_fr.md index a7ae51d..c5778c6 100644 --- a/README_fr.md +++ b/README_fr.md @@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Créer simplement et rapidement votre site de Petites Annonces -**Version incluse :** 0.1.0~ynh4 +**Version incluse :** 0.1.0~ynh2 **Démo :** https://demo.example.com From ce47112e742b979cf8ebe6b382da9976d7f74e43 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 12 Jul 2021 19:21:52 +0200 Subject: [PATCH 13/14] Update manifest.json --- manifest.json | 1 - 1 file changed, 1 deletion(-) diff --git a/manifest.json b/manifest.json index 1379b22..40bbf75 100644 --- a/manifest.json +++ b/manifest.json @@ -11,7 +11,6 @@ "upstream": { "license": "AGPL-3.0-or-later", "website": "https://framagit.org/toitoinebzh/petitesannonces", - "demo": "https://demo.example.com", "code": "https://framagit.org/toitoinebzh/petitesannonces" }, "license": "AGPL-3.0-or-later", From 8c51e6edb8802118ab4064a4d08cf85dbc16bea6 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Mon, 12 Jul 2021 17:22:04 +0000 Subject: [PATCH 14/14] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8d03470..e79ca07 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Make your own classified advertising website easily **Shipped version:** 0.1.0~ynh2 -**Demo:** https://demo.example.com + ## Screenshots diff --git a/README_fr.md b/README_fr.md index c5778c6..f5193d4 100644 --- a/README_fr.md +++ b/README_fr.md @@ -15,7 +15,7 @@ Créer simplement et rapidement votre site de Petites Annonces **Version incluse :** 0.1.0~ynh2 -**Démo :** https://demo.example.com + ## Captures d'écran