mirror of
https://github.com/YunoHost-Apps/weblate_ynh.git
synced 2024-10-01 13:35:04 +02:00
Improve uwsgi helper (path, mount, mask) and fix installation
This commit is contained in:
parent
3af0b44f7e
commit
0c36004d03
6 changed files with 27 additions and 32 deletions
|
@ -6,8 +6,6 @@ location __PATH__ {
|
||||||
include uwsgi_params;
|
include uwsgi_params;
|
||||||
# Needed for long running operations in admin interface
|
# Needed for long running operations in admin interface
|
||||||
uwsgi_read_timeout 3600;
|
uwsgi_read_timeout 3600;
|
||||||
uwsgi_param SCRIPT_NAME __PATH__;
|
|
||||||
uwsgi_modifier1 30;
|
|
||||||
uwsgi_pass unix:///var/run/uwsgi/__NAME__.socket;
|
uwsgi_pass unix:///var/run/uwsgi/__NAME__.socket;
|
||||||
|
|
||||||
# Include SSOWAT user panel.
|
# Include SSOWAT user panel.
|
||||||
|
|
|
@ -4,14 +4,15 @@ master = true
|
||||||
protocol = uwsgi
|
protocol = uwsgi
|
||||||
socket = /var/run/uwsgi/__APP__.socket
|
socket = /var/run/uwsgi/__APP__.socket
|
||||||
virtualenv = __FINALPATH__/venv
|
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
|
# Needed for OAuth/OpenID
|
||||||
buffer-size = 8192
|
buffer-size = 8192
|
||||||
# Increase number of workers for heavily loaded sites
|
# Increase number of workers for heavily loaded sites
|
||||||
#workers = 6
|
|
||||||
# Needed for background processing
|
# Needed for background processing
|
||||||
enable-threads = true
|
enable-threads = true
|
||||||
# Child processes do not need file descriptors
|
# Child processes do not need file descriptors
|
||||||
close-on-exec = true
|
close-on-exec = true
|
||||||
# Avoid default 0000 umask
|
|
||||||
umask = 0022
|
|
||||||
|
|
|
@ -33,9 +33,12 @@ ynh_check_global_uwsgi_config () {
|
||||||
# this helper :
|
# this helper :
|
||||||
#
|
#
|
||||||
# __APP__ by $app
|
# __APP__ by $app
|
||||||
|
# __PATH__ by $path_url
|
||||||
# __FINALPATH__ by $final_path
|
# __FINALPATH__ by $final_path
|
||||||
#
|
#
|
||||||
# usage: ynh_add_systemd_config
|
# usage: ynh_add_systemd_config
|
||||||
|
#
|
||||||
|
# to interact with your service: `systemctl <action> uwsgi-app@app`
|
||||||
ynh_add_uwsgi_service () {
|
ynh_add_uwsgi_service () {
|
||||||
ynh_check_global_uwsgi_config
|
ynh_check_global_uwsgi_config
|
||||||
|
|
||||||
|
@ -51,6 +54,9 @@ ynh_add_uwsgi_service () {
|
||||||
if test -n "${final_path:-}"; then
|
if test -n "${final_path:-}"; then
|
||||||
ynh_replace_string "__FINALPATH__" "$final_path" "$finaluwsgiini"
|
ynh_replace_string "__FINALPATH__" "$final_path" "$finaluwsgiini"
|
||||||
fi
|
fi
|
||||||
|
if test -n "${path_url:-}"; then
|
||||||
|
ynh_replace_string "__PATH__" "$path_url" "$finaluwsgiini"
|
||||||
|
fi
|
||||||
if test -n "${app:-}"; then
|
if test -n "${app:-}"; then
|
||||||
ynh_replace_string "__APP__" "$app" "$finaluwsgiini"
|
ynh_replace_string "__APP__" "$app" "$finaluwsgiini"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -93,10 +93,6 @@ settings="$final_path/venv/lib/python2.7/site-packages/weblate/settings.py"
|
||||||
|
|
||||||
if [ "$old_path" == "/" ] && [ "$new_path" != "/" ]
|
if [ "$old_path" == "/" ] && [ "$new_path" != "/" ]
|
||||||
then
|
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 ]
|
if [ "$is_public" -eq 0 ]
|
||||||
then
|
then
|
||||||
# ynh panel is only comptable with non-root installation
|
# ynh panel is only comptable with non-root installation
|
||||||
|
@ -111,9 +107,6 @@ fi
|
||||||
|
|
||||||
if [ "$old_path" != "/" ] && [ "$new_path" == "/" ]
|
if [ "$old_path" != "/" ] && [ "$new_path" == "/" ]
|
||||||
then
|
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 panel is only comptable with non-root installation
|
||||||
ynh_replace_string " include conf.d/" " #include conf.d/" "$finalnginxconf"
|
ynh_replace_string " include conf.d/" " #include conf.d/" "$finalnginxconf"
|
||||||
|
|
|
@ -105,9 +105,6 @@ ynh_add_nginx_config
|
||||||
if [ "$path_url" == "/" ]
|
if [ "$path_url" == "/" ]
|
||||||
then
|
then
|
||||||
# $finalnginxconf comes from ynh_add_nginx_config
|
# $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_replace_string "location //" "location /" "$finalnginxconf"
|
||||||
|
|
||||||
# ynh panel is only comptable with non-root installation
|
# ynh panel is only comptable with non-root installation
|
||||||
|
@ -188,11 +185,11 @@ virtualenv --python=python3 "${final_path}/venv"
|
||||||
set +o nounset
|
set +o nounset
|
||||||
source "${final_path}/venv/bin/activate"
|
source "${final_path}/venv/bin/activate"
|
||||||
set -o nounset
|
set -o nounset
|
||||||
"${final_path}/venv/bin/pip" install --upgrade pip
|
pip install --upgrade pip
|
||||||
"${final_path}/venv/bin/pip" install Weblate=="$current_version"
|
pip install Weblate=="$current_version"
|
||||||
"${final_path}/venv/bin/pip" install python-bidi PyYaML Babel pyuca pylibravatar py3dns psycopg2 python-memcached
|
pip install python-bidi PyYaML Babel pyuca pylibravatar py3dns psycopg2 python-memcached
|
||||||
# specific to YunoHost package:
|
# specific to YunoHost package:
|
||||||
"${final_path}/venv/bin/pip" install django_sendmail_backend
|
pip install django_sendmail_backend
|
||||||
)
|
)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -44,10 +44,11 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
(
|
(
|
||||||
set +eu
|
set +o nounset
|
||||||
source "${final_path}/venv/bin/activate"
|
source "${final_path}/venv/bin/activate"
|
||||||
"${final_path}/venv/bin/pip" install --upgrade pip
|
set -o nounset
|
||||||
"${final_path}/venv/bin/pip" freeze --local > freeze.pip
|
pip install --upgrade pip
|
||||||
|
pip freeze --local > freeze.pip
|
||||||
)
|
)
|
||||||
previous_version=$(cat freeze.pip | grep "Weblate==" | sed "s|Weblate==||")
|
previous_version=$(cat freeze.pip | grep "Weblate==" | sed "s|Weblate==||")
|
||||||
|
|
||||||
|
@ -101,9 +102,6 @@ ynh_add_nginx_config
|
||||||
if [ "$path_url" == "/" ]
|
if [ "$path_url" == "/" ]
|
||||||
then
|
then
|
||||||
# $finalnginxconf comes from ynh_add_nginx_config
|
# $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_replace_string "location //" "location /" "$finalnginxconf"
|
||||||
|
|
||||||
# ynh panel is only comptable with non-root installation
|
# 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"
|
settings_diff="$final_path/settings.${previous_version}_${current_version}.diff"
|
||||||
|
|
||||||
(
|
(
|
||||||
set +eu
|
set +o nounset
|
||||||
source "${final_path}/venv/bin/activate"
|
source "${final_path}/venv/bin/activate"
|
||||||
"${final_path}/venv/bin/pip" install Weblate=="$current_version"
|
set -o nounset
|
||||||
"${final_path}/venv/bin/pip" install pytz python-bidi PyYaML Babel pyuca pylibravatar pydns psycopg2 python-memcached
|
pip install Weblate=="$current_version"
|
||||||
|
pip install pytz python-bidi PyYaML Babel pyuca pylibravatar pydns psycopg2 python-memcached
|
||||||
# specific to YunoHost package:
|
# 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")
|
check=$(ynh_check_if_checksum_is_different "$settings")
|
||||||
|
@ -205,8 +204,9 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
(
|
(
|
||||||
set +eu
|
set +o nounset
|
||||||
source ${final_path}/venv/bin/activate
|
source "${final_path}/venv/bin/activate"
|
||||||
|
set -o nounset
|
||||||
export DJANGO_SETTINGS_MODULE="weblate.settings"
|
export DJANGO_SETTINGS_MODULE="weblate.settings"
|
||||||
cd "${final_path}"
|
cd "${final_path}"
|
||||||
weblate migrate --noinput
|
weblate migrate --noinput
|
||||||
|
|
Loading…
Add table
Reference in a new issue