1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/meilisearch_ynh.git synced 2024-09-03 19:45:59 +02:00
meilisearch_ynh/scripts/install
Éric Gaspar 753982a22f v2
2023-04-17 15:50:57 +02:00

93 lines
3.1 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# DOWNLOAD AND INSTALL MEILISEARCH
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=1
# 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
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=8
# Create a dedicated nginx config
ynh_add_nginx_config
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=2
if [ $allow_analyse ]; then
ynh_replace_string "__ANALYTICS__" "false" "../conf/systemd.service"
else
ynh_replace_string "__ANALYTICS__" "true" "../conf/systemd.service"
fi
# Create a dedicated systemd config
ynh_add_systemd_config
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
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..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# SETUP SSOWAT
#=================================================
#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary or protect it
#REMOVEME? if [ $is_public -eq 1 ]
then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
#REMOVEME? ynh_permission_update --permission="main" --add="visitors"
fi
#=================================================
# RELOAD NGINX
#=================================================
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=2
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of Meilisearch completed" --last