Merge branch 'add_ynh_check_starting' into origin/add_ynh_check_starting
This commit is contained in:
commit
44f28430b6
|
@ -11,6 +11,7 @@
|
|||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
upgrade=1 from_commit=f59da0dcbc1f35f98fbe32001e0a695171328001
|
||||
backup_restore=1
|
||||
multi_instance=0
|
||||
incorrect_path=1
|
||||
|
@ -31,3 +32,7 @@
|
|||
;;; Options
|
||||
Email=
|
||||
Notification=none
|
||||
;;; Upgrade options
|
||||
; commit=f59da0dcbc1f35f98fbe32001e0a695171328001
|
||||
name=Fix install and upgrade
|
||||
manifest_arg=domain=DOMAIN&path=PATH&is_public=1&
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://github.com/asciimoo/searx/archive/v0.13.1.tar.gz
|
||||
SOURCE_SUM=aefa314c7d6d75a2f76cf1aa1e8002d1
|
||||
SOURCE_URL=https://github.com/asciimoo/searx/archive/v0.14.0.tar.gz
|
||||
SOURCE_SUM=002c7f9ceeafc5ada2f1fd30b5d5f6c9
|
||||
SOURCE_SUM_PRG=md5sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
||||
# Start or restart a service and follow its booting
|
||||
#
|
||||
# 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}"
|
||||
|
||||
ynh_clean_check_starting () {
|
||||
# Stop the execution of tail.
|
||||
kill -s 15 $pid_tail 2>&1
|
||||
ynh_secure_remove "$templog" 2>&1
|
||||
}
|
||||
|
||||
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 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
|
||||
|
||||
echo ""
|
||||
ynh_clean_check_starting
|
||||
}
|
|
@ -6,7 +6,7 @@
|
|||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
# source _common.sh
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
|
@ -147,6 +147,13 @@ systemctl restart uwsgi
|
|||
# Ajoute le service au monitoring de Yunohost.
|
||||
yunohost service add uwsgi --log "/var/log/uwsgi/app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# CHECK SEARX STARTING
|
||||
#=================================================
|
||||
|
||||
# Wait for searx to be fully started
|
||||
ynh_check_starting "spawned uWSGI master process" "/var/log/uwsgi/app/$app.log" "300" "uwsgi"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
|
|
|
@ -13,12 +13,12 @@ set -eu
|
|||
# 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
|
||||
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 /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
|
@ -93,8 +93,14 @@ ln -s /etc/uwsgi/apps-available/$app.ini /etc/uwsgi/apps-enabled/$app.ini
|
|||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
# RELOAD NGINX AND UWSGI
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
||||
systemctl restart uwsgi
|
||||
systemctl reload nginx
|
||||
|
||||
#=================================================
|
||||
# CHECK SEARX STARTING
|
||||
#=================================================
|
||||
|
||||
# Wait for searx to be fully started
|
||||
ynh_check_starting "spawned uWSGI master process" "/var/log/uwsgi/app/$app.log" "300" "uwsgi"
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
# source _common.sh
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
|
@ -25,10 +25,10 @@ final_path=$(ynh_app_setting_get $app final_path)
|
|||
#=================================================
|
||||
|
||||
# Fix is_public as a boolean value
|
||||
if [ "$is_public" = "Yes" ]; then
|
||||
if [ "${is_public,,}" = "yes" ]; then
|
||||
ynh_app_setting_set $app is_public 1
|
||||
is_public=1
|
||||
elif [ "$is_public" = "No" ]; then
|
||||
elif [ "${is_public,,}" = "no" ]; then
|
||||
ynh_app_setting_set $app is_public 0
|
||||
is_public=0
|
||||
fi
|
||||
|
@ -102,8 +102,6 @@ ynh_system_user_create $app
|
|||
# UPGRADE SEARX IN ITS VIRTUALENV
|
||||
#=================================================
|
||||
|
||||
virtualenv "$final_path"
|
||||
|
||||
#run source in a 'sub shell'
|
||||
(
|
||||
set +o nounset
|
||||
|
@ -115,7 +113,6 @@ virtualenv "$final_path"
|
|||
pip install lxml babel
|
||||
)
|
||||
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE SEARX
|
||||
#=================================================
|
||||
|
@ -150,7 +147,13 @@ chown $app: --recursive "$final_path"
|
|||
cp ../conf/searx.ini /etc/uwsgi/apps-available/$app.ini
|
||||
ynh_replace_string "__APP__" "$app" /etc/uwsgi/apps-available/$app.ini
|
||||
ynh_replace_string "__FINALPATH__" "$final_path" /etc/uwsgi/apps-available/$app.ini
|
||||
systemctl restart uwsgi
|
||||
|
||||
#=================================================
|
||||
# CHECK SEARX STARTING
|
||||
#=================================================
|
||||
|
||||
# Wait for searx to be fully started
|
||||
ynh_check_starting "spawned uWSGI master process" "/var/log/uwsgi/app/$app.log" "300" "uwsgi"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
certifi==2016.9.26
|
||||
flask==0.12
|
||||
flask-babel==0.11.1
|
||||
# lxml==3.7.1
|
||||
markupsafe==0.23
|
||||
ndg-httpsclient==0.4.2
|
||||
pyasn1==0.1.9
|
||||
pyasn1-modules==0.0.8
|
||||
# Have a look to https://github.com/asciimoo/searx/blob/master/requirements.txt for each upgrade of Searx
|
||||
certifi==2017.11.5
|
||||
flask==0.12.2
|
||||
flask-babel==0.11.2
|
||||
# lxml==4.1.1
|
||||
idna==2.5
|
||||
pygments==2.1.3
|
||||
pyopenssl==16.2.0
|
||||
python-dateutil==2.5.3
|
||||
pyyaml==3.11
|
||||
requests[socks]==2.12.4
|
||||
cffi>=1.6
|
||||
pyopenssl==17.4.0
|
||||
python-dateutil==2.6.1
|
||||
pyyaml==3.12
|
||||
requests[socks]==2.18.4
|
||||
|
||||
# Additionnals requirements
|
||||
markupsafe>=0.23
|
||||
ndg-httpsclient>=0.4.2
|
||||
pyasn1>=0.1.9
|
||||
pyasn1-modules>=0.0.8
|
||||
cffi>=1.6
|
||||
|
|
Loading…
Reference in New Issue