From 1a85c85e01b129b69d20bdd519ecf1bd2ce56dae Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 8 Oct 2021 09:25:27 +0200 Subject: [PATCH 1/4] 0.22.0 --- manifest.json | 7 +++---- scripts/install | 5 +---- scripts/remove | 11 ----------- scripts/restore | 15 ++++++--------- scripts/upgrade | 48 +++++++++++++++++++++++------------------------- 5 files changed, 33 insertions(+), 53 deletions(-) diff --git a/manifest.json b/manifest.json index 36426cc..23e5ea8 100644 --- a/manifest.json +++ b/manifest.json @@ -3,8 +3,8 @@ "id": "meilisearch", "packaging_format": 1, "description": { - "en": "Lightning Fast, Ultra Relevant, and Typo-Tolerant Search Engine.", - "fr": "Moteur de recherche rapide, ultra-performant et tolérant aux fautes de frappe." + "en": "Lightning Fast, Ultra Relevant, and Typo-Tolerant Search Engine", + "fr": "Moteur de recherche rapide, ultra-performant et tolérant aux fautes de frappe" }, "version": "0.20.0~ynh1", "url": "https://www.meilisearch.com/", @@ -25,8 +25,7 @@ "install" : [ { "name": "domain", - "type": "domain", - "example": "example.com" + "type": "domain" }, { "name": "is_public", diff --git a/scripts/install b/scripts/install index 17005e2..e4ff01e 100644 --- a/scripts/install +++ b/scripts/install @@ -35,10 +35,8 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= - 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" @@ -63,7 +61,6 @@ ynh_app_setting_set --app=$app --key=allow_analyse --value=$allow_analyse #================================================= # FIND AND OPEN A PORT #================================================= - ynh_script_progression --message="Finding an available port..." --weight=2 # Find an available port @@ -145,7 +142,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." --weight=1 +ynh_script_progression --message="Configuring permissions..." --weight=1 # Make app public if necessary or protect it if [ $is_public -eq 1 ] diff --git a/scripts/remove b/scripts/remove index df57f7c..e05af91 100644 --- a/scripts/remove +++ b/scripts/remove @@ -44,7 +44,6 @@ ynh_remove_systemd_config #================================================= # REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= - ynh_script_progression --message="Removing Meilisearch binary" --weight=1 ynh_secure_remove --file=/usr/bin/meilisearch @@ -66,16 +65,6 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight= # 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..." - ynh_exec_warn_less yunohost firewall disallow TCP $port -fi - #================================================= # REMOVE FAIL2BAN CONFIGURATION #================================================= diff --git a/scripts/restore b/scripts/restore index cb3d3b1..35f9bf6 100644 --- a/scripts/restore +++ b/scripts/restore @@ -37,8 +37,6 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= 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}" test ! -d $final_path \ || ynh_die --message="There is already a directory: $final_path " @@ -72,7 +70,6 @@ chown -R $app:www-data "$final_path" #================================================= # RESTORE Meilisearch #================================================= - ynh_script_progression --message="Download again binary for the API." --weight=5 arch=$(ynh_detect_arch) @@ -106,6 +103,12 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet +#================================================= +# RESTORE THE LOGROTATE CONFIGURATION +#================================================= + +ynh_restore_file --origin_path="/etc/logrotate.d/$app" + #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= @@ -119,12 +122,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= - -ynh_restore_file --origin_path="/etc/logrotate.d/$app" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 61bc011..6f80dc8 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,6 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= - ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -29,6 +28,20 @@ allow_analyse=$(ynh_app_setting_get --app=$app --key=allow_analyse) upgrade_type=$(ynh_check_app_version_changed) +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up Meilisearch before upgrading (may take a while)..." --weight=5 + +# 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 #================================================= @@ -51,34 +64,19 @@ fi #================================================= # FIND AND OPEN A PORT #================================================= - ynh_script_progression --message="Finding an available port.." --weight=2 # Find an available port port=$(ynh_find_port --port=8095) ynh_app_setting_set --app=$app --key=port --value=$port -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up Meilisearch before upgrading (may take a while)..." --weight=5 - -# 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 - #================================================= # STANDARD UPGRADE STEPS #================================================= # 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" #================================================= @@ -125,14 +123,6 @@ ynh_backup_if_checksum_is_different --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..." --weight=2 - -# Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append - #================================================= # SETUP SYSTEMD #================================================= @@ -147,6 +137,14 @@ fi # Create a dedicated systemd config ynh_add_systemd_config +#================================================= +# SETUP LOGROTATE +#================================================= +ynh_script_progression --message="Upgrading logrotate configuration..." --weight=2 + +# Use logrotate to manage app-specific logfile(s) +ynh_use_logrotate --non-append + #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= From c7a529db9a2aae8b5d3511b8dc8b3d71034f3eb8 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 8 Oct 2021 09:26:06 +0200 Subject: [PATCH 2/4] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 23e5ea8..0382b67 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Lightning Fast, Ultra Relevant, and Typo-Tolerant Search Engine", "fr": "Moteur de recherche rapide, ultra-performant et tolérant aux fautes de frappe" }, - "version": "0.20.0~ynh1", + "version": "0.22.0~ynh1", "url": "https://www.meilisearch.com/", "license": "GPL-3.0", "maintainer": { From e429c602ad8728522493e7d3824fee373718ead9 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 8 Oct 2021 09:28:44 +0200 Subject: [PATCH 3/4] fix --- scripts/_common.sh | 2 +- scripts/upgrade | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index df49d65..181233f 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,6 +1,6 @@ #!/bin/bash -latest="v0.20.0" +latest="v0.22.0" ynh_detect_arch() { local architecture diff --git a/scripts/upgrade b/scripts/upgrade index 6f80dc8..8aa18c7 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -47,7 +47,6 @@ ynh_abort_if_errors #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 - # If final_path doesn't exist, create it if [ -z "$final_path" ]; then final_path=/var/www/$app From 2c7a6853d9fc96420d197f0c78b0caa713b60169 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 8 Oct 2021 09:44:53 +0200 Subject: [PATCH 4/4] Update check_process --- check_process | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/check_process b/check_process index 34b5af9..93378bf 100644 --- a/check_process +++ b/check_process @@ -27,7 +27,7 @@ setup_private=1 setup_public=1 upgrade=1 - ;upgrade=1 from_commit=65c382d138596fcb32b4c97c39398815a1dcd4e8 + upgrade=1 from_commit=30d48110ea0c820c89ab8ade34e415f07b5b0b86 backup_restore=1 multi_instance=1 port_already_use=1 (3500) @@ -38,6 +38,6 @@ Email= Notification=none ;;; Upgrade options - ; commit=65c382d138596fcb32b4c97c39398815a1dcd4e8 - name=Name of this previous version + ; commit=30d48110ea0c820c89ab8ade34e415f07b5b0b86 + name=Merge pull request #13 from YunoHost-Apps/testing manifest_arg=domain=DOMAIN&path=PATH&is_public=1&data_path=""&master_key="YUNOHOST-API-KEY-202020201456452135"&