diff --git a/conf/nginx.conf b/conf/nginx.conf index 96cad12..61d60d3 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -6,8 +6,6 @@ location __PATH__ { include uwsgi_params; # Needed for long running operations in admin interface uwsgi_read_timeout 3600; - uwsgi_param SCRIPT_NAME __PATH__; - uwsgi_modifier1 30; uwsgi_pass unix:///var/run/uwsgi/__NAME__.socket; # Include SSOWAT user panel. diff --git a/conf/uwsgi.ini b/conf/uwsgi.ini index d332168..6694559 100644 --- a/conf/uwsgi.ini +++ b/conf/uwsgi.ini @@ -4,14 +4,15 @@ master = true protocol = uwsgi socket = /var/run/uwsgi/__APP__.socket virtualenv = __FINALPATH__/venv -wsgi-file = __FINALPATH__/venv/lib/python3.4/site-packages/weblate/wsgi.py + +# http://uwsgi-docs.readthedocs.io/en/latest/Nginx.html#hosting-multiple-apps-in-the-same-process-aka-managing-script-name-and-path-info +mount = __PATH__=__FINALPATH__/venv/lib/python3.4/site-packages/weblate/wsgi.py +manage-script-name = true + # Needed for OAuth/OpenID buffer-size = 8192 # Increase number of workers for heavily loaded sites -#workers = 6 # Needed for background processing enable-threads = true # Child processes do not need file descriptors close-on-exec = true -# Avoid default 0000 umask -umask = 0022 diff --git a/scripts/_common.sh b/scripts/_common.sh index efc6dd9..fe5e956 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -33,9 +33,12 @@ ynh_check_global_uwsgi_config () { # this helper : # # __APP__ by $app +# __PATH__ by $path_url # __FINALPATH__ by $final_path # # usage: ynh_add_systemd_config +# +# to interact with your service: `systemctl uwsgi-app@app` ynh_add_uwsgi_service () { ynh_check_global_uwsgi_config @@ -51,6 +54,9 @@ ynh_add_uwsgi_service () { if test -n "${final_path:-}"; then ynh_replace_string "__FINALPATH__" "$final_path" "$finaluwsgiini" fi + if test -n "${path_url:-}"; then + ynh_replace_string "__PATH__" "$path_url" "$finaluwsgiini" + fi if test -n "${app:-}"; then ynh_replace_string "__APP__" "$app" "$finaluwsgiini" fi diff --git a/scripts/change_url b/scripts/change_url index ce467c8..9ba67e8 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -93,10 +93,6 @@ settings="$final_path/venv/lib/python2.7/site-packages/weblate/settings.py" if [ "$old_path" == "/" ] && [ "$new_path" != "/" ] then - # uwsgi_param is only needed for non-root installation - ynh_replace_string "#uwsgi_param " "uwsgi_param " "$finalnginxconf" - ynh_replace_string "#uwsgi_modifier1 " "uwsgi_modifier1 " "$finalnginxconf" - if [ "$is_public" -eq 0 ] then # ynh panel is only comptable with non-root installation @@ -111,9 +107,6 @@ fi if [ "$old_path" != "/" ] && [ "$new_path" == "/" ] then - # uwsgi_param is only needed for non-root installation - ynh_replace_string "uwsgi_param " "#uwsgi_param " "$finalnginxconf" - ynh_replace_string "uwsgi_modifier1 " "#uwsgi_modifier1 " "$finalnginxconf" # ynh panel is only comptable with non-root installation ynh_replace_string " include conf.d/" " #include conf.d/" "$finalnginxconf" diff --git a/scripts/install b/scripts/install index 50f8094..8e6d436 100755 --- a/scripts/install +++ b/scripts/install @@ -105,9 +105,6 @@ ynh_add_nginx_config if [ "$path_url" == "/" ] then # $finalnginxconf comes from ynh_add_nginx_config - # uwsgi_param is only needed for non-root installation - ynh_replace_string "uwsgi_param " "#uwsgi_param " "$finalnginxconf" - ynh_replace_string "uwsgi_modifier1 " "#uwsgi_modifier1 " "$finalnginxconf" ynh_replace_string "location //" "location /" "$finalnginxconf" # ynh panel is only comptable with non-root installation @@ -188,11 +185,11 @@ virtualenv --python=python3 "${final_path}/venv" set +o nounset source "${final_path}/venv/bin/activate" set -o nounset - "${final_path}/venv/bin/pip" install --upgrade pip - "${final_path}/venv/bin/pip" install Weblate=="$current_version" - "${final_path}/venv/bin/pip" install python-bidi PyYaML Babel pyuca pylibravatar py3dns psycopg2 python-memcached + pip install --upgrade pip + pip install Weblate=="$current_version" + pip install python-bidi PyYaML Babel pyuca pylibravatar py3dns psycopg2 python-memcached # specific to YunoHost package: - "${final_path}/venv/bin/pip" install django_sendmail_backend + pip install django_sendmail_backend ) #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index bb91a2c..cb5519b 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -44,10 +44,11 @@ fi #================================================= ( - set +eu + set +o nounset source "${final_path}/venv/bin/activate" - "${final_path}/venv/bin/pip" install --upgrade pip - "${final_path}/venv/bin/pip" freeze --local > freeze.pip + set -o nounset + pip install --upgrade pip + pip freeze --local > freeze.pip ) previous_version=$(cat freeze.pip | grep "Weblate==" | sed "s|Weblate==||") @@ -101,9 +102,6 @@ ynh_add_nginx_config if [ "$path_url" == "/" ] then # $finalnginxconf comes from ynh_add_nginx_config - # uwsgi_param is only needed for non-root installation - ynh_replace_string "uwsgi_param " "#uwsgi_param " "$finalnginxconf" - ynh_replace_string "uwsgi_modifier1 " "#uwsgi_modifier1 " "$finalnginxconf" ynh_replace_string "location //" "location /" "$finalnginxconf" # ynh panel is only comptable with non-root installation @@ -136,12 +134,13 @@ old_settings="./settings.$previous_version.old.py" settings_diff="$final_path/settings.${previous_version}_${current_version}.diff" ( - set +eu + set +o nounset source "${final_path}/venv/bin/activate" - "${final_path}/venv/bin/pip" install Weblate=="$current_version" - "${final_path}/venv/bin/pip" install pytz python-bidi PyYaML Babel pyuca pylibravatar pydns psycopg2 python-memcached + set -o nounset + pip install Weblate=="$current_version" + pip install pytz python-bidi PyYaML Babel pyuca pylibravatar pydns psycopg2 python-memcached # specific to YunoHost package: - "${final_path}/venv/bin/pip" install django_sendmail_backend + pip install django_sendmail_backend ) check=$(ynh_check_if_checksum_is_different "$settings") @@ -205,8 +204,9 @@ fi #================================================= ( - set +eu - source ${final_path}/venv/bin/activate + set +o nounset + source "${final_path}/venv/bin/activate" + set -o nounset export DJANGO_SETTINGS_MODULE="weblate.settings" cd "${final_path}" weblate migrate --noinput