From 6903e33ce906a747750c2301eb808969402d1b96 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 26 Feb 2021 12:43:30 +0100 Subject: [PATCH 1/6] Create issue_template.md --- issue_template.md | 55 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 issue_template.md diff --git a/issue_template.md b/issue_template.md new file mode 100644 index 0000000..c017fee --- /dev/null +++ b/issue_template.md @@ -0,0 +1,55 @@ +--- +name: Bug report +about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently. + +--- + +**How to post a meaningful bug report** +1. *Read this whole template first.* +2. *Determine if you are on the right place:* + - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* + - *Otherwise, the issue may be due to Searx itself. Refer to its documentation or repository for help.* + - *When in doubt, post here and we will figure it out together.* +3. *Delete the italic comments as you write over them below, and remove this guide.* +--- + +### Describe the bug + +*A clear and concise description of what the bug is.* + +### Context + +- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...* +- YunoHost version: x.x.x +- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...* +- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes* + - If yes, please explain: +- Using, or trying to install package version/branch: +- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`* + +### Steps to reproduce + +- *If you performed a command from the CLI, the command itself is enough. For example:* + ```sh + sudo yunohost app install searx + ``` +- *If you used the webadmin, please perform the equivalent command from the CLI first.* +- *If the error occurs in your browser, explain what you did:* + 1. *Go to '...'* + 2. *Click on '...'* + 3. *Scroll down to '...'* + 4. *See error* + +### Expected behavior + +*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.* + +### Logs + +*When an operation fails, YunoHost provides a simple way to share the logs.* +- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.* +- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.* + +*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)* + +*If applicable and useful, add screenshots to help explain your problem.* From c3109edb323ccfbd2cc14b4a99be29fcce347e6d Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 14 Mar 2021 22:54:50 +0100 Subject: [PATCH 2/6] Remove is_public var --- scripts/install | 1 - scripts/upgrade | 10 ---------- 2 files changed, 11 deletions(-) diff --git a/scripts/install b/scripts/install index 513cc18..a6a57d2 100644 --- a/scripts/install +++ b/scripts/install @@ -47,7 +47,6 @@ ynh_script_progression --message="Storing installation settings..." --weight=2 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= # STANDARD MODIFICATIONS diff --git a/scripts/upgrade b/scripts/upgrade index c35e989..f43378c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,7 +18,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) -is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= @@ -32,15 +31,6 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." -# Fix is_public as a boolean value -if [ "$is_public" = "Yes" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=1 - is_public=1 -elif [ "$is_public" = "No" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=0 - is_public=0 -fi - # If final_path doesn't exist, create it if [ -z "$final_path" ]; then final_path=/var/www/$app From 4175b0ae6a31d0d7e411e714138463aedfc64f7d Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Mon, 15 Mar 2021 00:22:37 +0100 Subject: [PATCH 3/6] [autopatch] Missing ynh_abort_if_errors in change_url scripts --- scripts/change_url | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/change_url b/scripts/change_url index 8c77b8a..534b46d 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -8,6 +8,7 @@ source _common.sh source /usr/share/yunohost/helpers +ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS From d72b778e7bc0d583f8671e44dcfe4759c0987d66 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 15 Mar 2021 09:19:37 +0100 Subject: [PATCH 4/6] Update manifest.json --- manifest.json | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/manifest.json b/manifest.json index 2c4c9cd..7255722 100644 --- a/manifest.json +++ b/manifest.json @@ -15,7 +15,7 @@ "email": "opi@zeropi.net" }, "requirements": { - "yunohost": ">= 3.8.1" + "yunohost": ">= 4.1.7" }, "multi_instance": false, "services": [ @@ -27,32 +27,17 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain for Searx", - "fr": "Choisissez un domaine pour Searx", - "de": "Wählen einen Domain-Namen für Searx" - }, "example": "domain.org" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for Searx", - "fr": "Choisissez un chemin pour Searx", - "de": "Wählen einen Pfad für Searx" - }, "example": "/searx", "default": "/searx" }, { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public Searx site?", - "fr": "Est-ce un site public ?", - "de": "Ist es eine öffentliche Applikation ?" - }, "help": { "en": "If enabled, Searx will be accessible by people who do not have an account. This can be changed later via the webadmin.", "fr": "Si cette case est cochée, Searx sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin.", From c0be4c6410abd15d1a62299d88963795bf6c6d29 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 21 Mar 2021 23:13:21 +0100 Subject: [PATCH 5/6] Fix --- scripts/install | 16 ++++++++-------- scripts/restore | 16 ++++++++-------- scripts/upgrade | 16 ++++++++-------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/scripts/install b/scripts/install index a6a57d2..3d2fb91 100644 --- a/scripts/install +++ b/scripts/install @@ -57,6 +57,14 @@ ynh_script_progression --message="Installing dependencies..." --weight=2 ynh_install_app_dependencies $pkg_dependencies +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." --weight=3 + +# Create a system user +ynh_system_user_create --username=$app + #================================================= # NGINX CONFIGURATION #================================================= @@ -66,14 +74,6 @@ path_no_root=${path_url%/} # Create a dedicated NGINX config ynh_add_nginx_config "path_no_root" -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." --weight=3 - -# Create a system user -ynh_system_user_create --username=$app - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= diff --git a/scripts/restore b/scripts/restore index 7641b1d..8672a9b 100755 --- a/scripts/restore +++ b/scripts/restore @@ -47,6 +47,14 @@ test ! -d $final_path \ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +#================================================= +# RECREATE OF THE DEDICATED USER +#================================================= +ynh_script_progression --message="Recreating the dedicated system user..." --weight=3 + +# Create the dedicated user (if not existing) +ynh_system_user_create --username=$app + #================================================= # RESTORE OF THE MAIN DIR OF THE APP #================================================= @@ -62,14 +70,6 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=35 ynh_install_app_dependencies $pkg_dependencies -#================================================= -# RECREATE OF THE DEDICATED USER -#================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=3 - -# Create the dedicated user (if not existing) -ynh_system_user_create --username=$app - #================================================= # SPECIFIC RESTORE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index f43378c..afcc96e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -67,6 +67,14 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=7 ynh_install_app_dependencies $pkg_dependencies +#================================================= +# CREATE DEDICATED USER +#================================================= +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 + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -91,14 +99,6 @@ path_no_root=${path_url%/} # Create a dedicated NGINX config ynh_add_nginx_config "path_no_root" -#================================================= -# CREATE DEDICATED USER -#================================================= -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 - #================================================= # SPECIFIC UPGRADE #================================================= From 27351a4936c4e87054576e427ca86e5d89d97488 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 26 Mar 2021 22:33:29 +0100 Subject: [PATCH 6/6] Add ynh_abort_if_errors --- check_process | 1 - scripts/change_url | 18 +++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/check_process b/check_process index 4b54ba9..9b4f39b 100644 --- a/check_process +++ b/check_process @@ -14,7 +14,6 @@ upgrade=1 from_commit=8843877c494c6b47edf2846cb6f1664e4404815c backup_restore=1 multi_instance=0 - port_already_use=0 change_url=1 ;;; Options Email= diff --git a/scripts/change_url b/scripts/change_url index 534b46d..3773192 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -8,7 +8,6 @@ source _common.sh source /usr/share/yunohost/helpers -ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS @@ -30,6 +29,23 @@ 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) +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +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 +ynh_clean_setup () { + # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. + ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" + + # Restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED #=================================================