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 6237901425 fix
2023-04-18 09:42:01 +02:00

67 lines
2.2 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
# Create a dedicated systemd config
ynh_add_systemd_config
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
yunohost service add $app --description="Opensource next generation search API" --log="/var/log/$app/$app.log"
#=================================================
# APP INITIAL CONFIGURATION
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
key=$(ynh_string_random --length=16)
ynh_add_config --template="../conf/config.toml" --destination="$install_dir/config.toml"
chmod 400 "$install_dir/config.toml"
chown $app:$app "$install_dir/config.toml"
#=================================================
# 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"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of Meilisearch completed" --last