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 #=================================================