1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/meilisearch_ynh.git synced 2024-09-03 19:45:59 +02:00

Some corrections

This commit is contained in:
frju365 2020-05-16 14:03:24 +02:00
parent 480b6c02a7
commit 9c200a3b80
No known key found for this signature in database
GPG key ID: C892BE847FF5635A
5 changed files with 26 additions and 21 deletions

View file

@ -7,7 +7,7 @@ Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
WorkingDirectory=__FINALPATH__/ WorkingDirectory=__FINALPATH__/
ExecStart=/usr/bin/mailisearch --http-addr 127.0.0.1:__PORT__ --env production --master-key __API_KEY__ ExecStart=/usr/bin/mailisearch --http-addr 127.0.0.1:__PORT__ --env production --master-key __API_KEY__ --no-analytics __ANALYTICS__
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View file

@ -60,14 +60,13 @@
"example": "API-key245678635248795" "example": "API-key245678635248795"
}, },
{ {
"name": "data_path", "name": "allow_analyse",
"type": "path", "type": "boolean",
"ask": { "ask": {
"en": "Choose a path (existing or not) for Meilisearch data files (absolute path)", "en": "Allow Meilisearch to get data from usage of the application",
"fr": "Choisissez un dossier existant ou non pour les fichiers de données de Meilisearch (chemin absolu)" "fr": "Autoriser Meilisearch à analyser les données d'usage de l'application"
}, },
"example": "/var/www/mailisearch", "default": false
"default": "/var/www/mailisearch"
} }
] ]
} }

View file

@ -28,7 +28,7 @@ domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
master_key=$YNH_APP_ARG_MASTER_KEY master_key=$YNH_APP_ARG_MASTER_KEY
data_path=$YNH_APP_ARG_DATA_PATH allow_analyse=$YNH_APP_ARG_ALLOW_ANALYSE
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -41,15 +41,8 @@ ynh_script_progression --message="Validating installation parameters..." --time
final_path=/var/www/$app final_path=/var/www/$app
if [ $data_path != "" ];then test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
test ! -e "$final_path" || ynh_die --message="This path already contains a folder" mkdir -p $final_path
mkdir -p $final_path
else
test ! -e "$data_path" || mkdir "$data_path"
final_path=$data_path
fi
# Register (book) web path # Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
@ -64,6 +57,7 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=master_key --value=$master_key ynh_app_setting_set --app=$app --key=master_key --value=$master_key
ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
ynh_app_setting_set --app=$app --key=allow_analyse --value=$allow_analyse
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
@ -89,9 +83,10 @@ if [ "$arch" != "amd64" ] && [ "$arch" != "armv8" ]
then then
ynh_die --message="Your OS Architecture is not supported" ynh_die --message="Your OS Architecture is not supported"
fi fi
$release_file=meilisearch-linux-$arch
curl https://github.com/meilisearch/MeiliSearch/releases/download/$latest/mailisearch-linux-$arch -o mailisearch curl -OL https://github.com/meilisearch/MeiliSearch/releases/download/$latest/meilisearch-linux-$arch
mv mailisearch /usr/bin/mailisearch chmod +x "$release_file"
mv "$release_file" /usr/bin/mailisearch
#================================================= #=================================================
@ -117,6 +112,11 @@ ynh_system_user_create --username=$app
#================================================= #=================================================
ynh_script_progression --message="Configuring a systemd service..." --time --weight=1 ynh_script_progression --message="Configuring a systemd service..." --time --weight=1
if [ $allow_analyse ]; then
ynh_replace_string "__ANALYTICS__" "false" "../conf/systemd.service"
else
ynh_replace_string "__ANALYTICS__" "true" "../conf/systemd.service"
fi
ynh_replace_string "__PORT__" "$port" "../conf/systemd.service" ynh_replace_string "__PORT__" "$port" "../conf/systemd.service"
ynh_replace_string "__API_KEY__" "$master_key" "../conf/systemd.service" ynh_replace_string "__API_KEY__" "$master_key" "../conf/systemd.service"

View file

@ -48,6 +48,7 @@ ynh_remove_systemd_config
ynh_script_progression --message="Removing Meilisearch binary" --time --weight=1 ynh_script_progression --message="Removing Meilisearch binary" --time --weight=1
ynh_secure_remove --file=/usr/bin/meilisearch ynh_secure_remove --file=/usr/bin/meilisearch
ynh_secure_remove --file=$final_path
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION

View file

@ -22,7 +22,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
is_public=$(ynh_app_setting_get --app=$app --key=is_public) is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
master_key=$(ynh_app_setting_get --app=$app --key=master_key) master_key=$(ynh_app_setting_get --app=$app --key=master_key)
$port=$(ynh_app_setting_get --app=$app --key=final_path) allow_analyse=$(ynh_app_setting_get --app=$app --key=allow_analyse)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -134,6 +134,11 @@ ynh_use_logrotate --non-append
#================================================= #=================================================
ynh_script_progression --message="Configuring a systemd service..." --time --weight=1 ynh_script_progression --message="Configuring a systemd service..." --time --weight=1
if [ $allow_analyse ]; then
ynh_replace_string "__ANALYTICS__" "false" "../conf/systemd.service"
else
ynh_replace_string "__ANALYTICS__" "true" "../conf/systemd.service"
fi
ynh_replace_string "__PORT__" "$port" "conf/systemd.service" ynh_replace_string "__PORT__" "$port" "conf/systemd.service"
ynh_replace_string "__API_KEY__" "$master_key" "conf/systemd.service" ynh_replace_string "__API_KEY__" "$master_key" "conf/systemd.service"