diff --git a/check_process b/check_process deleted file mode 100644 index 93378bf..0000000 --- a/check_process +++ /dev/null @@ -1,43 +0,0 @@ -;; Test name -# Comment ignored - ; pre-install - echo -n "Here your commands to execute in the container" - echo ", before each installation of the app." - ; Manifest - domain="domain.tld" - path="/path" - master_key="YUNOHOST-API-KEY-202020201456452135" - is_public=1 - port="3500" - data_path="" - ; Actions - action_argument=arg1|arg2 - is_public=1|0 - ; Config_panel - main.categorie.config_example=arg1|arg2 - main.overwrite_files.overwrite_phpfpm=1|0 - main.php_fpm_config.footprint=low|medium|high|specific - main.php_fpm_config.free_footprint=20 - main.php_fpm_config.usage=low|medium|high - ; Checks - pkg_linter=1 - setup_sub_dir=0 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - upgrade=1 from_commit=30d48110ea0c820c89ab8ade34e415f07b5b0b86 - backup_restore=1 - multi_instance=1 - port_already_use=1 (3500) - change_url=1 - actions=0 - config_panel=0 -;;; Options -Email= -Notification=none -;;; Upgrade options - ; 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"& diff --git a/conf/nginx.conf b/conf/nginx.conf index c3415b0..3ff63c5 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -10,13 +10,7 @@ location __PATH__/ { proxy_pass http://127.0.0.1:__PORT__; # Path to source - alias __INSTALL_DIR__/ ; - - # Force usage of https - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - + alias __INSTALL_DIR__/; # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; diff --git a/conf/systemd.service b/conf/systemd.service index 1ad1b67..959fd97 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,7 +7,7 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/ -ExecStart=/usr/bin/meilisearch --http-addr 127.0.0.1:__PORT__ --env production --master-key __MASTER_KEY__ --no-analytics __ANALYTICS__ +ExecStart=__INSTALL_DIR__/meilisearch --http-addr 127.0.0.1:__PORT__ --env production --master-key __MASTER_KEY__ --no-analytics __ANALYTICS__ [Install] WantedBy=multi-user.target diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..6b19004 --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1 @@ +Lightning Fast, Ultra Relevant, and Typo-Tolerant Search Engine \ No newline at end of file diff --git a/movies-web-demo.gif b/doc/screenshots/movies-web-demo.gif similarity index 100% rename from movies-web-demo.gif rename to doc/screenshots/movies-web-demo.gif diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 0382b67..0000000 --- a/manifest.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "MeiliSearch", - "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" - }, - "version": "0.22.0~ynh1", - "url": "https://www.meilisearch.com/", - "license": "GPL-3.0", - "maintainer": { - "name": "Julien Gomes Dias", - "email": "abld@abld.info", - "url": "https://julien.gomes-dias.dev" - }, - "requirements": { - "yunohost": ">= 4.2.0" - }, - "multi_instance": true, - "services": [ - "nginx" - ], - "arguments": { - "install" : [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "is_public", - "type": "boolean", - "default": true - }, - { - "name": "master_key", - "type": "string", - "ask": { - "en": "Choose a master API key for Meilisearch", - "fr": "Choisissez une clef d'API pour Meilisearch" - }, - "example": "API-key245678635248795" - }, - { - "name": "allow_analyse", - "type": "boolean", - "ask": { - "en": "Allow Meilisearch to get data from usage of the application", - "fr": "Autoriser Meilisearch à analyser les données d'usage de l'application" - }, - "default": false - } - ] - } -} diff --git a/manifest.toml b/manifest.toml index 7874995..32f7bd5 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,29 +5,26 @@ name = "MeiliSearch" description.en = "Lightning Fast, Ultra Relevant, and Typo-Tolerant Search Engine" description.fr = "Moteur de recherche rapide, ultra-performant et tolérant aux fautes de frappe" -version = "0.22.0~ynh1" +version = "1.1.0~ynh1" maintainers = ["Julien Gomes Dias"] [upstream] license = "GPL-3.0" website = "https://www.meilisearch.com/" -cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) -fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. [integration] -yunohost = ">= 4.2.0" -architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +yunohost = ">= 11.1.17" +architectures = "all" multi_instance = true -ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. -sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. -disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... -ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... -ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ldap = false +sso = false +disk = "50M" +ram.build = "50M" +ram.runtime = "50M" [install] [install.domain] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "domain" full_domain = true @@ -48,10 +45,19 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen default = false [resources] - [resources.sources.main] - url = "__SRC__" - sha256 = "__SUM__" + [resources.sources] + + [resources.sources.main] + amd64.url = "https://github.com/meilisearch/meilisearch/releases/download/v1.1.0/meilisearch-linux-amd64" + amd64.sha256 = "41674391290246cbb4175289ded653e815aec32a6c91b4b090de1166a3adbb66" + arm64.url = "https://github.com/meilisearch/meilisearch/releases/download/v1.1.0/meilisearch-linux-aarch64" + arm64.sha256 = "b203d556078b805dc13f4252e434f119f96c651a1a3587d10caa163f5c125a3b" + rename = "meilisearch" + in_subdir = false + extract = false + + [resources.ports] [resources.system_user] diff --git a/scripts/_common.sh b/scripts/_common.sh index 181233f..944a65e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,19 +1,17 @@ #!/bin/bash -latest="v0.22.0" +#================================================= +# COMMON VARIABLES +#================================================= -ynh_detect_arch() { - local architecture - if [ -n "$(uname -m | grep arm64)" ] || [ -n "$(uname -m | grep arm)" ]; then - architecture="armv8" - elif [ -n "$(uname -m | grep 64)" ]; then - architecture="amd64" - elif [ -n "$(uname -m | grep 86)" ]; then - architecture="i386" - elif [ -n "$(uname -m | grep arm)" ]; then - architecture="arm" - else - architecture="unknown" - fi - echo $architecture -} +#================================================= +# PERSONAL HELPERS +#================================================= + +#================================================= +# EXPERIMENTAL HELPERS +#================================================= + +#================================================= +# FUTURE OFFICIAL HELPERS +#================================================= diff --git a/scripts/backup b/scripts/backup index 03fe0da..76244a7 100644 --- a/scripts/backup +++ b/scripts/backup @@ -10,26 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - true -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_print_info --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= @@ -47,13 +27,6 @@ ynh_backup --src_path="$install_dir" ynh_backup --src_path="/etc/nginx/conf.d/$domain.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" - #================================================= # BACKUP LOGROTATE #================================================= @@ -70,4 +43,4 @@ ynh_backup --src_path="/etc/systemd/system/$app.service" # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for Meilisearch. (YunoHost will then actually copy those files to the archive)." +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index c6a489f..7318697 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,59 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN -#REMOVEME? old_path=$YNH_APP_OLD_PATH - -#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN -#REMOVEME? new_path=$YNH_APP_NEW_PATH - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? # Needed for helper "ynh_add_nginx_config" -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up Meilisearch before changing its URL (may take a while)..." --weight=1 - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. -#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" - - # restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# CHECK WHICH PARTS SHOULD BE CHANGED -#================================================= - -#REMOVEME? change_domain=0 -#REMOVEME? if [ "$old_domain" != "$new_domain" ] -then - #REMOVEME? change_domain=1 -fi - -#REMOVEME? change_path=0 -#REMOVEME? if [ "$old_path" != "$new_path" ] -then - #REMOVEME? change_path=1 -fi - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -78,30 +25,6 @@ ynh_script_progression --message="Updating NGINX web server configuration..." -- ynh_change_url_nginx_config -#REMOVEME? nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf - -#REMOVEME? # Change the path in the nginx config file -if [ $change_path -eq 1 ] -then -#REMOVEME? # Make a backup of the original nginx config file if modified -#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path" -#REMOVEME? # Set global variables for nginx helper -#REMOVEME? domain="$old_domain" -#REMOVEME? path="$new_path" -#REMOVEME? # Create a dedicated nginx config -#REMOVEME? ynh_add_nginx_config -fi - -#REMOVEME? # Change the domain for nginx -if [ $change_domain -eq 1 ] -then - # Delete file checksum for the old conf file location -#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path" -#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf - # Store file checksum for the new config file location -#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" -fi - #================================================= # GENERIC FINALISATION #================================================= @@ -111,13 +34,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" -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=2 - -#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index d2492ec..bb8d10e 100644 --- a/scripts/install +++ b/scripts/install @@ -9,91 +9,18 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? 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 -#REMOVEME? ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST -#================================================= - -#REMOVEME? domain=$YNH_APP_ARG_DOMAIN -path="/" -#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC -#REMOVEME? master_key=$YNH_APP_ARG_MASTER_KEY -#REMOVEME? allow_analyse=$YNH_APP_ARG_ALLOW_ANALYSE - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1 - -#REMOVEME? install_dir=/var/www/$app - -#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" -mkdir -p $install_dir - -# Register (book) web path -#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path - -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= -#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=1 - -#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain -#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path -ynh_app_setting_set --app=$app --key=master_key --value=$master_key -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir -ynh_app_setting_set --app=$app --key=allow_analyse --value=$allow_analyse - -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=2 - -# Find an available port -#REMOVEME? port=$(ynh_find_port --port=8095) -#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port - -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1 - -# Create a system user -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - #================================================= # DOWNLOAD AND INSTALL MEILISEARCH #================================================= -ynh_script_progression --message="Installing Meilisearch..." --weight=5 +ynh_script_progression --message="Setting up source files..." --weight=1 -arch=$(ynh_detect_arch) - -if [ "$arch" != "amd64" ] && [ "$arch" != "armv8" ] -then - ynh_die --message="Your OS Architecture is not supported" -fi -release_file=meilisearch-linux-$arch -curl -sOL https://github.com/meilisearch/MeiliSearch/releases/download/$latest/meilisearch-linux-$arch -chmod +x "$release_file" -mv "$release_file" /usr/bin/meilisearch +# Download, check integrity, uncompress and patch the source from app.src +ynh_setup_source --dest_dir="$install_dir" chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" +chmod +x "$install_dir/meilisearch" #================================================= # NGINX CONFIGURATION diff --git a/scripts/remove b/scripts/remove index d016bf0..801613a 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,17 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - #================================================= # STANDARD REMOVE #================================================= @@ -41,14 +30,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config 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 -#REMOVEME? ynh_secure_remove --file=$install_dir - #================================================= # REMOVE NGINX CONFIGURATION #================================================= @@ -65,26 +46,8 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight= # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# REMOVE FAIL2BAN CONFIGURATION -#================================================= -#ynh_script_progression --message="Removing fail2ban configuration..." --time --weight=1 - -# Remove the dedicated fail2ban config -#ynh_remove_fail2ban_config - -#================================================= -# GENERIC FINALIZATION -#================================================= -# REMOVE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1 - -# Delete a system user -#REMOVEME? ynh_system_user_delete --username=$app - #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of Meilisearch completed" --last +ynh_script_progression --message="Removal of $app completed" --last diff --git a/scripts/restore b/scripts/restore index a9a1f70..5dcfd88 100644 --- a/scripts/restore +++ b/scripts/restore @@ -10,36 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? 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 -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1 - -#REMOVEME? test ! -d $install_dir \ - || ynh_die --message="There is already a directory: $install_dir " - #================================================= # STANDARD RESTORATION STEPS #================================================= @@ -48,14 +18,6 @@ ynh_script_progression --message="Loading settings..." --weight=1 ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 - -# Create the dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -67,32 +29,6 @@ chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" -#================================================= -# RESTORE Meilisearch -#================================================= -ynh_script_progression --message="Download again binary for the API." --weight=5 - -arch=$(ynh_detect_arch) - -if [ "$arch" != "amd64" ] && [ "$arch" != "armv8" ] -then - ynh_die --message="Your OS Architecture is not supported" -fi - -release_file=meilisearch-linux-$arch -curl -sOL https://github.com/meilisearch/MeiliSearch/releases/download/$latest/meilisearch-linux-$arch -chmod +x "$release_file" -mv "$release_file" /usr/bin/meilisearch - -#================================================= -# RESTORE FAIL2BAN CONFIGURATION -#================================================= -# 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 - #================================================= # SPECIFIC RESTORATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 9c62334..8ae4834 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,66 +9,12 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? master_key=$(ynh_app_setting_get --app=$app --key=master_key) -#REMOVEME? allow_analyse=$(ynh_app_setting_get --app=$app --key=allow_analyse) - #================================================= # CHECK VERSION #================================================= 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 -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - # restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 - -# If install_dir doesn't exist, create it -if [ -z "$install_dir" ]; then -#REMOVEME? install_dir=/var/www/$app -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir -fi - -# Cleaning legacy permissions -#REMOVEME? if ynh_legacy_permissions_exists; then -#REMOVEME? ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - -#================================================= -# FIND AND OPEN A PORT -#================================================= -#REMOVEME? ynh_script_progression --message="Finding an available port.." --weight=2 - -# Find an available port -#REMOVEME? port=$(ynh_find_port --port=8095) -#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -86,42 +32,20 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 - -# Create a dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - #================================================= # UPGRADING MEILISEARCH #================================================= -ynh_script_progression --message="upgrading Meilisearch..." --weight=5 -arch=$(ynh_detect_arch) - -if [ "$arch" != "amd64" ] && [ "$arch" != "armv8" ] +if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_die --message="Your OS Architecture is not supported" + 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="$install_dir" fi -release_file=meilisearch-linux-$arch -curl -sOL https://github.com/meilisearch/MeiliSearch/releases/download/$latest/meilisearch-linux-$arch -chmod +x "$release_file" -mv "$release_file" /usr/bin/meilisearch -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" -#================================================= -# STORE THE CONFIG FILE CHECKSUM -#================================================= - -ynh_backup_if_checksum_is_different --file="$install_dir/CONFIG_FILE" -# Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum --file="$install_dir/CONFIG_FILE" - #================================================= # SETUP SYSTEMD #================================================= @@ -157,13 +81,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=3 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..1cfc3cb --- /dev/null +++ b/tests.toml @@ -0,0 +1,15 @@ +test_format = 1.0 + +[default] + + # ------------------------------- + # Default args to use for install + # ------------------------------- + + args.master_key="YUNOHOST-API-KEY-202020201456452135" + + # ------------------------------- + # Commits to test upgrade from + # ------------------------------- + + test_upgrade_from.30d48110ea0c820c89ab8ade34e415f07b5b0b86.name = "Upgrade from #13" \ No newline at end of file