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 052d6926ff cleaning
2023-12-20 18:38:31 +01:00

66 lines
2.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 -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="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