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

Merge pull request #44 from YunoHost-Apps/package_upgrade

Package upgrade
This commit is contained in:
Maniack Crudelis 2019-03-09 13:04:08 +01:00 committed by GitHub
commit 812707590d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 269 additions and 108 deletions

View file

@ -1,10 +1,62 @@
Searx for YunoHost
==================
# Searx for YunoHost
[Yunohost project](https://yunohost.org/#/)
[![Integration level](https://dash.yunohost.org/integration/searx.svg)](https://dash.yunohost.org/appci/app/searx)
[![Install Searx with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=searx)
Searx is a privacy-respecting, hackable metasearch engine.
For more information ,visit [Searx homepage](https://asciimoo.github.io/searx/).
> *This package allow you to install Searx quickly and simply on a YunoHost server.
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
This package is the [YunoHost](https://yunohost.org) application that ease
Searx installation on your YunoHost server.
## Overview
Searx is a privacy-respecting, hackable metasearch engine.
**Shipped version:** 0.14.0
## Screenshots
## Demo
* [YunoHost demo](https://demo.yunohost.org/searx/)
## Configuration
## Documentation
* Official documentation: https://github.com/asciimoo/searx/wiki
## YunoHost specific features
#### Multi-users support
#### Supported architectures
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/searx%20%28Community%29.svg)](https://ci-apps.yunohost.org/ci/apps/searx/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/searx%20%28Community%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/searx/)
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/searx%20%28Community%29.svg)](https://ci-stretch.nohost.me/ci/apps/searx/)
## Limitations
## Additional information
- [Search syntax](https://asciimoo.github.io/searx/user/search_syntax.html)
## Links
* Report a bug: https://github.com/YunoHost-Apps/searx_ynh/issues
* Searx website: https://asciimoo.github.io/searx/
* YunoHost website: https://yunohost.org/
---
Developers info
----------------
**Only if you want to use a testing branch for coding, instead of merging directly into master.**
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/searx_ynh/tree/testing).
To try the testing branch, please proceed like that.
```
sudo yunohost app install https://github.com/YunoHost-Apps/searx_ynh/tree/testing --debug
or
sudo yunohost app upgrade searx -u https://github.com/YunoHost-Apps/searx_ynh/tree/testing --debug
```

View file

@ -1,6 +1,7 @@
#noroot location = __PATH__ { rewrite ^ __PATH__/; }
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
location __PATH__ {
# Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}

View file

@ -7,7 +7,7 @@
"fr": "Un méta-moteur de recherche respectueux de la vie privée et bidouillable",
"de": "Eine Meta-Suchmaschine, die den Privatsphäre wahrt und 'hackable' ist."
},
"version": "0.14.0~ynh1",
"version": "0.14.0~ynh2",
"url": "https://asciimoo.github.io/searx/",
"license": "AGPL-3.0-or-later",
"maintainer": {
@ -15,7 +15,7 @@
"email": "opi@zeropi.net"
},
"requirements": {
"yunohost": ">= 2.7.2"
"yunohost": ">= 3.2.0"
},
"multi_instance": false,
"services": [

View file

@ -1,56 +1,105 @@
#!/bin/bash
#=================================================
# EXPERIMENTAL HELPERS
# FUTURE OFFICIAL HELPERS
#=================================================
# Start or restart a service and follow its booting
# Start (or other actions) a service, print a log in case of failure and optionnaly wait until the service is completely started
#
# usage: ynh_check_starting "Line to match" [Log file] [Timeout] [Service name]
#
# | arg: Line to match - The line to find in the log to attest the service have finished to boot.
# | arg: Log file - The log file to watch
# | arg: Timeout - The maximum time to wait before ending the watching. Defaut 300 seconds.
# | arg: Service name
# /var/log/$app/$app.log will be used if no other log is defined.
ynh_check_starting () {
local line_to_match="$1"
local app_log="${2:-/var/log/$service_name/$service_name.log}"
local timeout=${3:-300}
local service_name="${4:-$app}"
# usage: ynh_systemd_action [-n service_name] [-a action] [ [-l "line to match"] [-p log_path] [-t timeout] [-e length] ]
# | arg: -n, --service_name= - Name of the service to reload. Default : $app
# | arg: -a, --action= - Action to perform with systemctl. Default: start
# | arg: -l, --line_match= - Line to match - The line to find in the log to attest the service have finished to boot.
# If not defined it don't wait until the service is completely started.
# WARNING: When using --line_match, you should always add `ynh_clean_check_starting` into your
# `ynh_clean_setup` at the beginning of the script. Otherwise, tail will not stop in case of failure
# of the script. The script will then hang forever.
# | arg: -p, --log_path= - Log file - Path to the log file. Default : /var/log/$app/$app.log
# | arg: -t, --timeout= - Timeout - The maximum time to wait before ending the watching. Default : 300 seconds.
# | arg: -e, --length= - Length of the error log : Default : 20
ynh_systemd_action() {
# Declare an array to define the options of this helper.
declare -Ar args_array=( [n]=service_name= [a]=action= [l]=line_match= [p]=log_path= [t]=timeout= [e]=length= )
local service_name
local action
local line_match
local length
local log_path
local timeout
ynh_clean_check_starting () {
# Stop the execution of tail.
kill -s 15 $pid_tail 2>&1
ynh_secure_remove "$templog" 2>&1
}
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
echo "Starting of $service_name" >&2
systemctl stop $service_name
local templog="$(mktemp)"
# Following the starting of the app in its log
tail -F -n0 "$app_log" > "$templog" &
# Get the PID of the tail command
local pid_tail=$!
systemctl start $service_name
local service_name="${service_name:-$app}"
local action=${action:-start}
local log_path="${log_path:-/var/log/$service_name/$service_name.log}"
local length=${length:-20}
local timeout=${timeout:-300}
local i=0
for i in `seq 1 $timeout`
do
# Read the log until the sentence is found, that means the app finished to start. Or run until the timeout
if grep --quiet "$line_to_match" "$templog"
then
echo "The service $service_name has correctly started." >&2
break
fi
echo -n "." >&2
sleep 1
done
if [ $i -eq $timeout ]
then
echo "The service $service_name didn't fully started before the timeout." >&2
fi
# Start to read the log
if [[ -n "${line_match:-}" ]]
then
local templog="$(mktemp)"
# Following the starting of the app in its log
if [ "$log_path" == "systemd" ] ; then
# Read the systemd journal
journalctl --unit=$service_name --follow --since=-0 --quiet > "$templog" &
# Get the PID of the journalctl command
local pid_tail=$!
else
# Read the specified log file
tail -F -n0 "$log_path" 2>&1 > "$templog" &
# Get the PID of the tail command
local pid_tail=$!
fi
fi
echo ""
ynh_clean_check_starting
ynh_print_info "${action^} the service $service_name"
systemctl $action $service_name \
|| ( journalctl --no-pager --lines=$length -u $service_name >&2 \
; test -e "$log_path" && echo "--" >&2 && tail --lines=$length "$log_path" >&2 \
; false )
# Start the timeout and try to find line_match
if [[ -n "${line_match:-}" ]]
then
local i=0
for i in $(seq 1 $timeout)
do
# Read the log until the sentence is found, that means the app finished to start. Or run until the timeout
if grep --quiet "$line_match" "$templog"
then
ynh_print_info "The service $service_name has correctly started."
break
fi
if [ $i -eq 3 ]; then
echo -n "Please wait, the service $service_name is ${action}ing" >&2
fi
if [ $i -ge 3 ]; then
echo -n "." >&2
fi
sleep 1
done
if [ $i -ge 3 ]; then
echo "" >&2
fi
if [ $i -eq $timeout ]
then
ynh_print_warn "The service $service_name didn't fully started before the timeout."
ynh_print_warn "Please find here an extract of the end of the log of the service $service_name:"
journalctl --no-pager --lines=$length -u $service_name >&2
test -e "$log_path" && echo "--" >&2 && tail --lines=$length "$log_path" >&2
fi
ynh_clean_check_starting
fi
}
# Clean temporary process and file used by ynh_check_starting
# (usually used in ynh_clean_setup scripts)
#
# usage: ynh_clean_check_starting
ynh_clean_check_starting () {
# Stop the execution of tail.
kill -s 15 $pid_tail 2>&1
ynh_secure_remove "$templog" 2>&1
}

View file

@ -6,12 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
# if [ ! -e _common.sh ]; then
# # Rapatrie le fichier de fonctions si il n'est pas dans le dossier courant
# cp ../settings/scripts/_common.sh ./_common.sh
# chmod a+rx _common.sh
# fi
# source _common.sh
# source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
@ -24,24 +19,26 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Loading installation settings..."
# Récupère les infos de l'application.
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get $app final_path)
domain=$(ynh_app_setting_get $app domain)
final_path=$(ynh_app_setting_get $app final_path)
#=================================================
# STANDARD BACKUP STEPS
#=================================================
# BACKUP OF THE MAIN DIR OF THE APP
#=================================================
ynh_print_info "Backing up the main app directory..."
ynh_backup "$final_path"
#=================================================
# BACKUP OF THE NGINX CONFIGURATION
#=================================================
ynh_print_info "Backing up nginx web server configuration..."
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
@ -50,5 +47,12 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP OF THE UWSGI CONFIG
#=================================================
ynh_print_info "Backing up uWSGI configuration..."
ynh_backup "/etc/uwsgi/apps-available/$app.ini"
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -13,6 +13,9 @@ source /usr/share/yunohost/helpers
# MANAGE FAILURE OF THE SCRIPT
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -29,6 +32,7 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
#=================================================
ynh_print_info "Validating installation parameters..."
final_path="/opt/yunohost/$app"
test ! -e "$final_path" || ynh_die "This path already contains a folder"
@ -36,14 +40,13 @@ test ! -e "$final_path" || ynh_die "This path already contains a folder"
# Normalize the url path syntax
path_url=$(ynh_normalize_url_path $path_url)
# Check web path availability
ynh_webpath_available $domain $path_url
# Register (book) web path
ynh_webpath_register $app $domain $path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_print_info "Storing installation settings..."
ynh_app_setting_set $app domain $domain
ynh_app_setting_set $app path $path_url
@ -54,27 +57,23 @@ ynh_app_setting_set $app is_public $is_public
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_print_info "Installing dependencies..."
ynh_install_app_dependencies git build-essential libxslt-dev python-dev python-virtualenv virtualenv python-babel zlib1g-dev libffi-dev libssl-dev python-lxml uwsgi uwsgi-plugin-python
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_print_info "Configuring nginx web server..."
ynh_add_nginx_config
if [ "$path_url" = "/" ]
then
ynh_replace_string "__PATH_NO_ROOT__" "" /etc/nginx/conf.d/$domain.d/$app.conf
sed --in-place '/#noroot*/d' /etc/nginx/conf.d/$domain.d/$app.conf
else
ynh_replace_string "#noroot" "" /etc/nginx/conf.d/$domain.d/$app.conf
ynh_replace_string "__PATH_NO_ROOT__" "$path_url" /etc/nginx/conf.d/$domain.d/$app.conf
fi
ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf"
path_no_root=${path_url%/}
# Create a dedicated nginx config
ynh_add_nginx_config "path_no_root"
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_print_info "Configuring system user..."
# Create a system user
ynh_system_user_create $app
@ -82,6 +81,7 @@ ynh_system_user_create $app
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_print_info "Setting up source files..."
ynh_app_setting_set $app final_path $final_path
# Download, check integrity, uncompress and patch the source from app.src
@ -92,6 +92,7 @@ ynh_setup_source "$final_path"
#=================================================
# INSTALL SEARX IN A VIRTUALENV
#=================================================
ynh_print_info "Installing Searx..."
virtualenv --system-site-packages "$final_path"
set +u; source $final_path/bin/activate; set -u
@ -101,6 +102,7 @@ pip install --requirement $final_path/requirements-ynh.txt
#=================================================
# CONFIGURE SEARX
#=================================================
ynh_print_info "Configuring Searx..."
# Change instance name
ynh_replace_string "instance_name : \"searx\"" "instance_name : \"YunoSearx\"" "$final_path/searx/settings.yml"
@ -126,6 +128,7 @@ chown $app: --recursive "$final_path"
#=================================================
# CONFIGURE UWSGI FOR SEARX
#=================================================
ynh_print_info "Configuring uWSGI for Searx..."
cp ../conf/searx.ini /etc/uwsgi/apps-available/$app.ini
ynh_replace_string "__APP__" "$app" /etc/uwsgi/apps-available/$app.ini
@ -133,25 +136,26 @@ ynh_replace_string "__FINALPATH__" "$final_path" /etc/uwsgi/apps-available/$app.
ln -s /etc/uwsgi/apps-available/$app.ini /etc/uwsgi/apps-enabled/$app.ini
#=================================================
# ENABLE UWSGI SERVICE IN ADMIN PANEL
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
systemctl restart uwsgi
# Ajoute le service au monitoring de Yunohost.
yunohost service add uwsgi --log "/var/log/uwsgi/app/$app.log"
#=================================================
# CHECK SEARX STARTING
#=================================================
ynh_print_info "Starting Searx..."
# Wait for searx to be fully started
ynh_check_starting "spawned uWSGI master process" "/var/log/uwsgi/app/$app.log" "300" "uwsgi"
ynh_systemd_action --service_name=uwsgi --action=restart --line_match="spawned uWSGI master process" --log_path="/var/log/uwsgi/app/$app.log"
#=================================================
# GENERIC FINALISATION
#=================================================
# SETUP SSOWAT
#=================================================
ynh_print_info "Configuring SSOwat..."
# Make app public if necessary
if [ $is_public -eq 1 ]
@ -162,5 +166,12 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info "Reloading nginx web server..."
systemctl reload nginx
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Installation of $app completed"

View file

@ -6,27 +6,31 @@
# IMPORT GENERIC HELPERS
#=================================================
# source _common.sh
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
final_path=$(ynh_app_setting_get $app final_path)
#=================================================
# STANDARD REMOVE
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_print_info "Stopping and removing the systemd service"
# Remove the uwsgi configuration
systemctl stop uwsgi
if [ -h "/etc/uwsgi/apps-enabled/$app.ini" ]; then
echo "Delete uwsgi config"
ynh_systemd_action --service_name=uwsgi --action=stop
if [ -h "/etc/uwsgi/apps-enabled/$app.ini" ]
then
ynh_print_info "Delete uwsgi config for $app"
ynh_secure_remove "/etc/uwsgi/apps-enabled/$app.ini"
fi
ynh_secure_remove "/etc/uwsgi/apps-available/$app.ini"
@ -34,43 +38,53 @@ ynh_secure_remove "/etc/uwsgi/apps-available/$app.ini"
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_print_info "Removing dependencies"
ynh_remove_app_dependencies
#=================================================
# REMOVE THE MAIN DIR OF THE APP
#=================================================
ynh_print_info "Removing app main directory"
ynh_secure_remove "/opt/yunohost/$app"
ynh_secure_remove "$final_path"
#=================================================
# REMOVE THE NGINX CONFIGURATION
#=================================================
ynh_print_info "Removing nginx web server configuration"
# Remove the dedicated nginx config
ynh_remove_nginx_config
#=================================================
# DISABLE SERVICE IN ADMIN PANEL
# REMOVE SERVICE FROM ADMIN PANEL
#=================================================
if [ -e /etc/init.d/uwsgi ]
then
# Redémarre le service uwsgi si il n'est pas désinstallé.
systemctl start uwsgi
ynh_systemd_action --service_name=uwsgi --action=start
else
if yunohost service status | grep -q uwsgi # Test l'existence du service dans Yunohost
if yunohost service status | grep -q uwsgi
then
echo "Remove uwsgi service"
ynh_print_info "Remove uwsgi service"
yunohost service remove uwsgi
fi
fi
#=================================================
# GENERIC FINALISATION
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_print_info "Removing the dedicated system user"
# Delete a system user
ynh_system_user_delete $app
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Removal of $app completed"

View file

@ -13,6 +13,9 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -22,13 +25,14 @@ ynh_abort_if_errors
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get $app final_path)
domain=$(ynh_app_setting_get $app domain)
path_url=$(ynh_app_setting_get $app path)
final_path=$(ynh_app_setting_get $app final_path)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_print_info "Validating restoration parameters..."
ynh_webpath_available $domain $path_url \
|| ynh_die "Path not available: ${domain}${path_url}"
@ -46,19 +50,22 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE OF THE MAIN DIR OF THE APP
#=================================================
ynh_print_info "Restoring the app main directory..."
mkdir -p /opt/yunohost
mkdir -p "$(dirname "$final_path")"
ynh_restore_file "$final_path"
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_print_info "Reinstalling dependencies..."
ynh_install_app_dependencies git build-essential libxslt-dev python-dev python-virtualenv virtualenv python-babel zlib1g-dev libffi-dev libssl-dev python-lxml uwsgi uwsgi-plugin-python
#=================================================
# RECREATE OF THE DEDICATED USER
#=================================================
ynh_print_info "Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create $app
@ -83,12 +90,20 @@ ln -s /etc/uwsgi/apps-available/$app.ini /etc/uwsgi/apps-enabled/$app.ini
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info "Reloading nginx web server..."
systemctl reload nginx
#=================================================
# CHECK SEARX STARTING
#=================================================
ynh_print_info "Starting Searx..."
# Wait for searx to be fully started
ynh_check_starting "spawned uWSGI master process" "/var/log/uwsgi/app/$app.log" "300" "uwsgi"
ynh_systemd_action --service_name=uwsgi --action=restart --line_match="spawned uWSGI master process" --log_path="/var/log/uwsgi/app/$app.log"
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Restoration completed for $app"

View file

@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -21,8 +22,9 @@ is_public=$(ynh_app_setting_get $app is_public)
final_path=$(ynh_app_setting_get $app final_path)
#=================================================
# FIX OLD THINGS
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_print_info "Ensuring downward compatibility..."
# Fix is_public as a boolean value
if [ "${is_public,,}" = "yes" ]; then
@ -42,12 +44,16 @@ fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_print_info "Backing up the app before upgrading (may take a while)..."
ynh_backup_before_upgrade # Backup the current version of the app
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_restore_upgradebackup # restore it if the upgrade fails
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
ynh_abort_if_errors # Exit if an error occurs during the execution of the script
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK THE PATH
@ -61,12 +67,14 @@ path_url=$(ynh_normalize_url_path $path_url)
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_print_info "Upgrading dependencies..."
ynh_install_app_dependencies git build-essential libxslt-dev python-dev python-virtualenv virtualenv python-babel zlib1g-dev libffi-dev libssl-dev python-lxml uwsgi uwsgi-plugin-python
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_print_info "Upgrading source files..."
# Verify the checksum and backup the file if it's different
ynh_backup_if_checksum_is_different "$final_path/searx/settings.yml"
@ -77,23 +85,18 @@ ynh_setup_source "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_print_info "Upgrading nginx web server configuration..."
ynh_add_nginx_config
if [ "$path_url" = "/" ]
then
ynh_replace_string "__PATH_NO_ROOT__" "" /etc/nginx/conf.d/$domain.d/$app.conf
sed --in-place '/#noroot*/d' /etc/nginx/conf.d/$domain.d/$app.conf
else
ynh_replace_string "#noroot" "" /etc/nginx/conf.d/$domain.d/$app.conf
ynh_replace_string "__PATH_NO_ROOT__" "$path_url" /etc/nginx/conf.d/$domain.d/$app.conf
fi
ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf"
path_no_root=${path_url%/}
# Create a dedicated nginx config
ynh_add_nginx_config "path_no_root"
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_print_info "Making sure dedicated system user exists..."
# Create a system user
# Create a dedicated user (if not existing)
ynh_system_user_create $app
#=================================================
@ -101,6 +104,7 @@ ynh_system_user_create $app
#=================================================
# UPGRADE SEARX IN ITS VIRTUALENV
#=================================================
ynh_print_info "Upgrading Searx..."
rm -r $final_path/lib/python2.7/site-packages/setuptools $final_path/lib/python2.7/site-packages/setuptools-*
virtualenv --system-site-packages "$final_path"
@ -111,6 +115,7 @@ pip install --requirement $final_path/requirements-ynh.txt --upgrade
#=================================================
# CONFIGURE SEARX
#=================================================
ynh_print_info "Reconfiguring Searx..."
# Change instance name
ynh_replace_string "instance_name : \"searx\"" "instance_name : \"YunoSearx\"" "$final_path/searx/settings.yml"
@ -138,6 +143,7 @@ chown $app: --recursive "$final_path"
#=================================================
# CONFIGURE UWSGI FOR SEARX
#=================================================
ynh_print_info "Reconfiguring uWSGI for Searx..."
cp ../conf/searx.ini /etc/uwsgi/apps-available/$app.ini
ynh_replace_string "__APP__" "$app" /etc/uwsgi/apps-available/$app.ini
@ -146,13 +152,15 @@ ynh_replace_string "__FINALPATH__" "$final_path" /etc/uwsgi/apps-available/$app.
#=================================================
# CHECK SEARX STARTING
#=================================================
ynh_print_info "Restarting Searx..."
# Wait for searx to be fully started
ynh_check_starting "spawned uWSGI master process" "/var/log/uwsgi/app/$app.log" "300" "uwsgi"
ynh_systemd_action --service_name=uwsgi --action=restart --line_match="spawned uWSGI master process" --log_path="/var/log/uwsgi/app/$app.log"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_print_info "Upgrading SSOwat configuration..."
# Make app public if necessary
if [ $is_public -eq 1 ]
@ -163,5 +171,12 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info "Reloading nginx web server..."
systemctl reload nginx
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Upgrade of $app completed"