diff --git a/README.md b/README.md index 6d3bad3..55c42d0 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,11 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to Meilisearch is an opensource next generation search API. -**Shipped version:** 0.10.1 +**Shipped version:** 0.15.0 ## Screenshots -![Meilisearch Demo](movies-web-demo.gif) +![](movies-web-demo.gif) ## Configuration @@ -44,8 +44,7 @@ It's an API and there is no authentification, without API key. --- -Developers info ----------------- +## Developers info Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/meilisearch_ynh/tree/testing). diff --git a/manifest.json b/manifest.json index 9346c56..fd28617 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.10.1~ynh1", + "version": "0.15.0~ynh1", "url": "https://www.meilisearch.com/", "license": "GPL-3.0", "maintainer": { diff --git a/scripts/_common.sh b/scripts/_common.sh index d2d57c9..329de0c 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,6 +1,6 @@ #!/bin/bash -latest="v0.10.1" +latest="v0.15.0" ynh_detect_arch() { local architecture diff --git a/scripts/backup b/scripts/backup index e469b29..c9c4551 100644 --- a/scripts/backup +++ b/scripts/backup @@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. true } # Exit if an error occurs during the execution of the script @@ -24,7 +23,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -32,62 +31,43 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) #================================================= -# STANDARD BACKUP STEPS +# DECLARE DATA AND CONF FILES TO BACKUP #================================================= -# 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" +ynh_print_info --message="Declaring files to be backed up..." #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_script_progression --message="Backing up the main app directory..." --time --weight=1 ynh_backup --src_path="$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Backing up nginx web server configuration..." --time --weight=1 ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Backing up fail2ban configuration..." --time --weight=1 -ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" -ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" +#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_script_progression --message="Backing up logrotate configuration..." --time --weight=1 ynh_backup --src_path="/etc/logrotate.d/$app" #================================================= # BACKUP SYSTEMD #================================================= -ynh_script_progression --message="Backing up systemd configuration..." --time --weight=1 ynh_backup --src_path="/etc/systemd/system/$app.service" -#================================================= -# 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" - #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --time --last +ynh_print_info --message="Backup script completed for Meilisearch. (YunoHost will then actually copy those files to the archive)." --time --last diff --git a/scripts/change_url b/scripts/change_url index b291f20..03d0cf4 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -24,8 +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) @@ -33,8 +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 Meilisearch before changing its URL (may take a while)..." --weight=1 # Backup the current version of the app ynh_backup_before_upgrade @@ -69,15 +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=2 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -108,16 +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=2 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=2 ynh_systemd_action --service_name=nginx --action=reload @@ -125,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 Meilisearch" --last diff --git a/scripts/install b/scripts/install index a2d2a71..7ca3884 100644 --- a/scripts/install +++ b/scripts/install @@ -36,7 +36,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 @@ -50,7 +50,7 @@ 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 ynh_app_setting_set --app=$app --key=path --value=$path_url @@ -65,7 +65,7 @@ ynh_app_setting_set --app=$app --key=allow_analyse --value=$allow_analyse # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Configuring firewall..." --time --weight=2 +ynh_script_progression --message="Configuring firewall..." --weight=2 # Find an available port port=$(ynh_find_port --port=8095) @@ -74,8 +74,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port #================================================= # DOWNLOAD AND INSTALL MEILISEARCH #================================================= - -ynh_script_progression --message="Installing meilisearch..." --time --weight=5 +ynh_script_progression --message="Installing meilisearch..." --weight=5 arch=$(ynh_detect_arch) @@ -88,11 +87,10 @@ curl -OL https://github.com/meilisearch/MeiliSearch/releases/download/$latest/me chmod +x "$release_file" mv "$release_file" /usr/bin/meilisearch - #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." --time --weight=1 +ynh_script_progression --message="Configuring NGINX web server..." --weight=8 ### `ynh_add_nginx_config` will use the file conf/nginx.conf @@ -102,7 +100,7 @@ ynh_add_nginx_config #================================================= # 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 @@ -110,7 +108,7 @@ ynh_system_user_create --username=$app #================================================= # SETUP SYSTEMD #================================================= -ynh_script_progression --message="Configuring a systemd service..." --time --weight=2 +ynh_script_progression --message="Configuring a systemd service..." --weight=2 if [ $allow_analyse ]; then ynh_replace_string "__ANALYTICS__" "false" "../conf/systemd.service" @@ -135,7 +133,7 @@ chown -R $app:$app $final_path #================================================= # SETUP LOGROTATE #================================================= -ynh_script_progression --message="Configuring log rotation..." --time --weight=1 +ynh_script_progression --message="Configuring log rotation..." --weight=1 # Use logrotate to manage application logfile(s) ynh_use_logrotate @@ -144,7 +142,7 @@ ynh_use_logrotate # INTEGRATE SERVICE IN YUNOHOST #================================================= -yunohost service add $app --description "A short description of the app" --log "/var/log/$app/$app.log" +yunohost service add $app --description "Opensource next generation search API" --log "/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE @@ -177,7 +175,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=2 ynh_systemd_action --service_name=nginx --action=reload @@ -185,4 +183,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 Meilisearch completed" --last diff --git a/scripts/remove b/scripts/remove index 6587efb..df57f7c 100644 --- 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 @@ -29,14 +29,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 Meilisearch service..." --weight=1 yunohost service remove $app fi #================================================= # STOP AND REMOVE SERVICE #================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --time --weight=1 +ynh_script_progression --message="Stopping and removing the systemd service..." --weight=2 # Remove the dedicated systemd config ynh_remove_systemd_config @@ -45,7 +45,7 @@ ynh_remove_systemd_config # REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= -ynh_script_progression --message="Removing Meilisearch binary" --time --weight=1 +ynh_script_progression --message="Removing Meilisearch binary" --weight=1 ynh_secure_remove --file=/usr/bin/meilisearch ynh_secure_remove --file=$final_path @@ -53,15 +53,15 @@ ynh_secure_remove --file=$final_path #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration..." --time --weight=3 +ynh_script_progression --message="Removing NGINX web server configuration..." --weight=3 -# Remove the dedicated nginx config +# Remove the dedicated NGINX config ynh_remove_nginx_config #================================================= # REMOVE LOGROTATE CONFIGURATION #================================================= -ynh_script_progression --message="Removing logrotate configuration..." --time +ynh_script_progression --message="Removing logrotate configuration..." --weight=2 # Remove the app-specific logrotate config ynh_remove_logrotate @@ -89,7 +89,7 @@ fi #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." --time +ynh_script_progression --message="Removing the dedicated system user..." --weight=1 # Delete a system user ynh_system_user_delete --username=$app @@ -98,4 +98,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 Meilisearch completed" --last diff --git a/scripts/restore b/scripts/restore index 4368323..ac4715b 100644 --- a/scripts/restore +++ b/scripts/restore @@ -24,7 +24,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading settings..." --time --weight=1 +ynh_script_progression --message="Loading settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -36,7 +36,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # 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}" @@ -54,7 +54,7 @@ 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 Meilisearch main directory..." --weight=1 ynh_restore_file --origin_path="$final_path" @@ -62,7 +62,7 @@ ynh_restore_file --origin_path="$final_path" # RESTORE Meilisearch #================================================= -ynh_script_progression --message="Download again binary for the API." --time --weight=1 +ynh_script_progression --message="Download again binary for the API." --time --weight=5 arch=$(ynh_detect_arch) @@ -79,7 +79,7 @@ mv "$release_file" /usr/bin/meilisearch #================================================= # 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 @@ -87,18 +87,18 @@ ynh_system_user_create --username=$app #================================================= # RESTORE FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the fail2ban configuration..." --time --weight=1 +# ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=2 -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 +# 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 #================================================= # RESTORE SYSTEMD #================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --time --weight=1 +ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service @@ -107,12 +107,12 @@ 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" +yunohost service add $app --description "Opensource next generation search API" --log "/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 +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" @@ -127,7 +127,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= # 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 @@ -135,4 +135,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 Meilisearch" --last diff --git a/scripts/upgrade b/scripts/upgrade index 84abc47..ad263f9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -64,7 +64,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port #================================================= # 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 Meilisearch before upgrading (may take a while)..." --time --weight=1 # Backup the current version of the app ynh_backup_before_upgrade @@ -93,15 +93,15 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading NGINX web server configuration..." --time --weight=1 -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= # UPGRADING MEILISEARCH #================================================= -ynh_script_progression --message="upgrading meilisearch..." --time --weight=1 +ynh_script_progression --message="upgrading Meilisearch..." --time --weight=1 arch=$(ynh_detect_arch) @@ -193,7 +193,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -201,4 +201,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 Meilisearch completed" --time --last