1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/searx_ynh.git synced 2024-09-03 20:16:30 +02:00
searx_ynh/scripts/install

81 lines
2.7 KiB
Text
Raw Normal View History

2014-05-10 11:54:15 +02:00
#!/bin/bash
2016-07-04 21:16:34 +02:00
#=================================================
2022-03-06 19:01:21 +01:00
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2016-07-04 21:16:34 +02:00
2018-05-11 22:59:18 +02:00
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
2019-05-18 20:15:36 +02:00
ynh_script_progression --message="Setting up source files..." --weight=2
2017-08-28 03:03:36 +02:00
# Download, check integrity, uncompress and patch the source from app.src
2023-08-18 11:38:35 +02:00
ynh_setup_source --dest_dir="$install_dir"
2014-05-10 11:54:15 +02:00
2023-08-18 11:38:35 +02:00
chmod -R o-rwx "$install_dir"
chown -R $app: "$install_dir"
2022-03-06 19:01:21 +01:00
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
2023-08-18 11:38:35 +02:00
path_no_root=${path%/}
2022-03-06 19:01:21 +01:00
# Create a dedicated NGINX config
ynh_add_nginx_config "path_no_root"
#=================================================
# SPECIFIC SETUP
#=================================================
# INSTALL SEARX IN A VIRTUALENV
#=================================================
2020-12-19 23:34:40 +01:00
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
#=================================================
2019-05-18 20:15:36 +02:00
ynh_script_progression --message="Configuring Searx..." --weight=2
2021-05-03 18:31:05 +02:00
secret_key=$(ynh_string_random)
2023-08-18 11:38:35 +02:00
ynh_add_config --template="../conf/settings.yml" --destination="$install_dir/searx/settings.yml"
#=================================================
# SET PERMISSIONS ON SEARX DIRECTORY
#=================================================
2014-05-10 11:54:15 +02:00
2023-08-18 11:38:35 +02:00
chown -R $app: $install_dir
2014-05-10 11:54:15 +02:00
#=================================================
# CONFIGURE UWSGI FOR SEARX
#=================================================
2020-12-19 23:34:40 +01:00
ynh_script_progression --message="Configuring uWSGI for Searx..." --weight=2
2014-05-27 12:13:54 +02:00
2021-07-20 21:00:24 +02:00
ynh_add_uwsgi_service
2018-05-11 22:59:18 +02:00
#=================================================
2022-03-06 19:01:21 +01:00
# GENERIC FINALIZATION
2018-05-11 22:59:18 +02:00
#=================================================
2022-03-06 19:01:21 +01:00
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=4
2018-05-11 22:59:18 +02:00
2022-03-06 19:01:21 +01:00
# 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"
2018-05-11 22:59:18 +02:00
2019-03-03 20:33:02 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2022-03-06 19:01:21 +01:00
ynh_script_progression --message="Installation of $app completed" --last