Compare commits
1 Commits
testing
...
add_ynh_ch
Author | SHA1 | Date |
---|---|---|
![]() |
60bd920a2a |
|
@ -2,7 +2,7 @@
|
|||
|
||||
location __PATH__ {
|
||||
if ($scheme = http) {
|
||||
# rewrite ^ https://$server_name$request_uri? permanent;
|
||||
rewrite ^ https://$server_name$request_uri? permanent;
|
||||
}
|
||||
try_files $uri @searx;
|
||||
}
|
||||
|
@ -15,4 +15,4 @@ location @searx {
|
|||
}
|
||||
|
||||
# Include SSOWAT user panel.
|
||||
#include conf.d/yunohost_panel.conf.inc;
|
||||
include conf.d/yunohost_panel.conf.inc;
|
||||
|
|
|
@ -4,7 +4,7 @@ uid = __APP__
|
|||
gid = __APP__
|
||||
|
||||
# Number of workers
|
||||
workers = 2
|
||||
workers = 4
|
||||
|
||||
# The right granted on the created socket
|
||||
chmod-socket = 666
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
## Problem
|
||||
- *Description of why you made this PR*
|
||||
|
||||
## Solution
|
||||
- *And how you fix that*
|
||||
|
||||
## PR Status
|
||||
- [ ] Code finished.
|
||||
- [ ] Tested with Package_check.
|
||||
- [ ] Fix or enhancement tested.
|
||||
- [ ] Upgrade from last version tested.
|
||||
- [ ] Can be reviewed and tested.
|
||||
|
||||
## Validation
|
||||
---
|
||||
*Minor decision*
|
||||
- **Upgrade previous version** :
|
||||
- [ ] **Code review** :
|
||||
- [ ] **Approval (LGTM)** :
|
||||
- [ ] **Approval (LGTM)** :
|
||||
- **CI succeeded** :
|
||||
[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/searx_ynh%20-BRANCH-%20(Official)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/searx_ynh%20-BRANCH-%20(Official)/) *Please replace '-BRANCH-' in this link for a PR from a local branch.*
|
||||
or
|
||||
[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/searx_ynh%20PR-NUM-%20(Official_fork)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/searx_ynh%20PR-NUM-%20(Official_fork)/) *Replace '-NUM-' by the PR number in this link for a PR from a forked repository.*
|
||||
When the PR is marked as ready to merge, you have to wait for 3 days before really merging it.
|
|
@ -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
|
||||
}
|
|
@ -1,13 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
#
|
||||
GENERIC STARTING
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
# source _common.sh
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
|
@ -56,9 +55,7 @@ ynh_app_setting_set $app is_public $is_public
|
|||
# INSTALL 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
|
||||
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
|
||||
|
@ -67,13 +64,11 @@ libssl-dev python-lxml uwsgi uwsgi-plugin-python
|
|||
ynh_add_nginx_config
|
||||
if [ "$path_url" = "/" ]
|
||||
then
|
||||
ynh_replace_string "__PATH_NO_ROOT__" ""
|
||||
/etc/nginx/conf.d/$domain.d/$app.conf
|
||||
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
|
||||
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"
|
||||
|
||||
|
@ -89,8 +84,7 @@ ynh_system_user_create $app
|
|||
#=================================================
|
||||
|
||||
ynh_app_setting_set $app final_path $final_path
|
||||
# Download, check integrity, uncompress and patch the source from
|
||||
app.src
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source "$final_path"
|
||||
|
||||
#=================================================
|
||||
|
@ -100,30 +94,24 @@ ynh_setup_source "$final_path"
|
|||
#=================================================
|
||||
|
||||
virtualenv --system-site-packages "$final_path"
|
||||
bash -c "source $final_path/bin/activate && pip install -U
|
||||
setuptools && pip install --requirement
|
||||
$final_path/requirements-ynh.txt"
|
||||
bash -c "source $final_path/bin/activate && pip install -U setuptools && pip install --requirement $final_path/requirements-ynh.txt"
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE SEARX
|
||||
#=================================================
|
||||
|
||||
# Change instance name
|
||||
ynh_replace_string "instance_name : \"searx\"" "instance_name :
|
||||
\"YunoSearx\"" "$final_path/searx/settings.yml"
|
||||
ynh_replace_string "instance_name : \"searx\"" "instance_name : \"YunoSearx\"" "$final_path/searx/settings.yml"
|
||||
|
||||
# Generate a secret key
|
||||
ynh_replace_string "secret_key : \"ultrasecretkey\"" "secret_key :
|
||||
\"$(ynh_string_random)\"" "$final_path/searx/settings.yml"
|
||||
ynh_replace_string "secret_key : \"ultrasecretkey\"" "secret_key : \"$(ynh_string_random)\"" "$final_path/searx/settings.yml"
|
||||
|
||||
# Modify the base_url parameter, if it's installed in a subpath
|
||||
if [ "$path_url" != "/" ]
|
||||
then
|
||||
ynh_replace_string "base_url : False" "base_url :
|
||||
http://${domain}${path_url}/" "$final_path/searx/settings.yml"
|
||||
ynh_replace_string "base_url : False" "base_url : https://${domain}${path_url}/" "$final_path/searx/settings.yml"
|
||||
else
|
||||
ynh_replace_string "base_url : False" "base_url : False"
|
||||
"$final_path/searx/settings.yml"
|
||||
ynh_replace_string "base_url : False" "base_url : False" "$final_path/searx/settings.yml"
|
||||
fi
|
||||
ynh_store_file_checksum "$final_path/searx/settings.yml"
|
||||
|
||||
|
@ -139,10 +127,8 @@ 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
|
||||
ln -s /etc/uwsgi/apps-available/$app.ini
|
||||
/etc/uwsgi/apps-enabled/$app.ini
|
||||
ynh_replace_string "__FINALPATH__" "$final_path" /etc/uwsgi/apps-available/$app.ini
|
||||
ln -s /etc/uwsgi/apps-available/$app.ini /etc/uwsgi/apps-enabled/$app.ini
|
||||
|
||||
#=================================================
|
||||
# ENABLE UWSGI SERVICE IN ADMIN PANEL
|
||||
|
@ -152,6 +138,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
|
||||
|
||||
#=================================================
|
||||
|
@ -86,8 +86,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"
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
#
|
||||
GENERIC STARTING
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
# source _common.sh
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
|
@ -48,8 +47,7 @@ ynh_backup_before_upgrade # Backup the current version of the app
|
|||
ynh_clean_setup () {
|
||||
ynh_restore_upgradebackup # restore it if the upgrade fails
|
||||
}
|
||||
ynh_abort_if_errors # Exit if an error occurs during the execution of
|
||||
the script
|
||||
ynh_abort_if_errors # Exit if an error occurs during the execution of the script
|
||||
|
||||
#=================================================
|
||||
# CHECK THE PATH
|
||||
|
@ -67,8 +65,7 @@ path_url=$(ynh_normalize_url_path $path_url)
|
|||
# Verify the checksum and backup the file if it's different
|
||||
ynh_backup_if_checksum_is_different "$final_path/searx/settings.yml"
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from
|
||||
app.src
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source "$final_path"
|
||||
|
||||
#=================================================
|
||||
|
@ -78,13 +75,11 @@ ynh_setup_source "$final_path"
|
|||
ynh_add_nginx_config
|
||||
if [ "$path_url" = "/" ]
|
||||
then
|
||||
ynh_replace_string "__PATH_NO_ROOT__" ""
|
||||
/etc/nginx/conf.d/$domain.d/$app.conf
|
||||
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
|
||||
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"
|
||||
|
||||
|
@ -101,33 +96,26 @@ ynh_system_user_create $app
|
|||
# UPGRADE SEARX IN ITS VIRTUALENV
|
||||
#=================================================
|
||||
|
||||
rm -r $final_path/lib/python2.7/site-packages/setuptools
|
||||
$final_path/lib/python2.7/site-packages/setuptools-*
|
||||
rm -r $final_path/lib/python2.7/site-packages/setuptools $final_path/lib/python2.7/site-packages/setuptools-*
|
||||
virtualenv --system-site-packages "$final_path"
|
||||
bash -c "source $final_path/bin/activate && pip install -U
|
||||
setuptools && pip install --requirement
|
||||
$final_path/requirements-ynh.txt --upgrade"
|
||||
bash -c "source $final_path/bin/activate && pip install -U setuptools && pip install --requirement $final_path/requirements-ynh.txt --upgrade"
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE SEARX
|
||||
#=================================================
|
||||
|
||||
# Change instance name
|
||||
ynh_replace_string "instance_name : \"searx\"" "instance_name :
|
||||
\"YunoSearx\"" "$final_path/searx/settings.yml"
|
||||
ynh_replace_string "instance_name : \"searx\"" "instance_name : \"YunoSearx\"" "$final_path/searx/settings.yml"
|
||||
|
||||
# Generate a secret key
|
||||
ynh_replace_string "secret_key : \"ultrasecretkey\"" "secret_key :
|
||||
\"$(ynh_string_random)\"" "$final_path/searx/settings.yml"
|
||||
ynh_replace_string "secret_key : \"ultrasecretkey\"" "secret_key : \"$(ynh_string_random)\"" "$final_path/searx/settings.yml"
|
||||
|
||||
# Modify the base_url parameter, if it's installed in a subpath
|
||||
if [ "$path_url" != "/" ]
|
||||
then
|
||||
ynh_replace_string "base_url : False" "base_url :
|
||||
http://${domain}${path_url}/" "$final_path/searx/settings.yml"
|
||||
ynh_replace_string "base_url : False" "base_url : https://${domain}${path_url}/" "$final_path/searx/settings.yml"
|
||||
else
|
||||
ynh_replace_string "base_url : False" "base_url : False"
|
||||
"$final_path/searx/settings.yml"
|
||||
ynh_replace_string "base_url : False" "base_url : False" "$final_path/searx/settings.yml"
|
||||
fi
|
||||
ynh_store_file_checksum "$final_path/searx/settings.yml"
|
||||
|
||||
|
@ -145,9 +133,14 @@ 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
|
||||
ynh_replace_string "__FINALPATH__" "$final_path" /etc/uwsgi/apps-available/$app.ini
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
|
|
Loading…
Reference in New Issue