mirror of
https://github.com/YunoHost-Apps/searx_ynh.git
synced 2024-09-03 20:16:30 +02:00
80 lines
2.7 KiB
Bash
80 lines
2.7 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"
|
|
|
|
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
|
|
|
|
pushd $install_dir
|
|
python3 -m venv venv
|
|
venv/bin/pip3 install -U pip setuptools wheel pyyaml --no-cache-dir
|
|
venv/bin/pip3 install --requirement $install_dir/requirements-ynh.txt --no-cache-dir
|
|
popd
|
|
|
|
#=================================================
|
|
# CONFIGURE SEARX
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring Searx..." --weight=2
|
|
|
|
secret_key=$(ynh_string_random)
|
|
ynh_add_config --template="../conf/settings.yml" --destination="$install_dir/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
|