1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/searxng_ynh.git synced 2024-09-03 20:26:00 +02:00
searxng_ynh/scripts/install
ewilly 2b0ee5f860 Major update
-  Move to manifest v2
-  Move to /var/www
-  Create a data dir to use user settings that overwrite default
up-to-date settings
-  Fix version info on main page
-  Fix some typo
-  Fix updater script with base = testing branch
2023-09-18 18:10:55 +02:00

80 lines
2.9 KiB
Bash
Executable file

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC)
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=1
ynh_exec_fully_quiet git clone -n "$repo_fullpath" "$install_dir/searxng-src"
pushd "$install_dir/searxng-src"
ynh_exec_fully_quiet git checkout "$commit_sha"
popd
ynh_script_progression --message="Installing SearXNG..." --weight=2
python3 -m venv --system-site-packages "$install_dir/searxng-pyenv"
set +u; source "$install_dir/searxng-pyenv/bin/activate"; set -u
pip3 install -U pip setuptools wheel pyyaml --no-cache-dir
ynh_exec_fully_quiet pip3 install -e "$install_dir/searxng-src"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app: "$install_dir"
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
ynh_add_nginx_config
#=================================================
# APP INITIAL CONFIGURATION
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
secret_key=$(ynh_string_random)
ynh_add_config --template="../conf/settings.yml" --destination="$data_dir/settings.yml"
chmod 400 "$data_dir/settings.yml"
chown $app: "$data_dir"
#=================================================
# CONFIGURE UWSGI FOR SEARX
#=================================================
ynh_script_progression --message="Configuring uWSGI for SearXNG..." --weight=2
ynh_add_uwsgi_service
#=================================================
# GENERIC FINALIZATION
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name="uwsgi-app@$app.service" --action="start" --line_match="WSGI app 0 \(mountpoint='[/[:alnum:]_-]*'\) ready in [[:digit:]]* seconds on interpreter" --log_path="/var/log/uwsgi/$app/$app.log"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last