mirror of
https://github.com/YunoHost-Apps/searx_ynh.git
synced 2024-09-03 20:16:30 +02:00
80 lines
2.8 KiB
Bash
80 lines
2.8 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
ynh_script_progression --message="Setting up source files..." --weight=2
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
|
ynh_setup_source --dest_dir="$install_dir/source"
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
chown -R "$app:" "$install_dir"
|
|
|
|
#=================================================
|
|
# NGINX CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
|
|
|
path_no_root=${path%/}
|
|
# Create a dedicated NGINX config
|
|
ynh_add_nginx_config "path_no_root"
|
|
|
|
#=================================================
|
|
# SPECIFIC SETUP
|
|
#=================================================
|
|
# INSTALL SEARX IN A VIRTUALENV
|
|
#=================================================
|
|
ynh_script_progression --message="Installing Searx..." --weight=2
|
|
|
|
_searx_venv_install
|
|
|
|
ynh_add_config --template="requirements-ynh.txt" --destination="$install_dir/requirements-ynh.txt"
|
|
|
|
ynh_exec_as "$app" "$venvpy" -m pip install --requirement "$install_dir/requirements-ynh.txt" --no-cache-dir
|
|
|
|
#=================================================
|
|
# CONFIGURE SEARX
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring Searx..." --weight=2
|
|
|
|
secret_key=$(ynh_string_random)
|
|
ynh_add_config --template="settings.yml" --destination="$install_dir/source/searx/settings.yml"
|
|
|
|
#=================================================
|
|
# SET PERMISSIONS ON SEARX DIRECTORY
|
|
#=================================================
|
|
|
|
chown -R "$app:" "$install_dir"
|
|
|
|
#=================================================
|
|
# CONFIGURE UWSGI FOR SEARX
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring uWSGI for Searx..." --weight=2
|
|
|
|
ynh_add_uwsgi_service
|
|
|
|
#=================================================
|
|
# GENERIC FINALIZATION
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=4
|
|
|
|
# Start a systemd service
|
|
ynh_systemd_action --service_name="uwsgi-app@$app.service" --action=start --line_match="spawned uWSGI master process" --log_path="/var/log/uwsgi/$app/$app.log"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|