1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/weblate_ynh.git synced 2024-10-01 13:35:04 +02:00

using PIP because django package is too old

This commit is contained in:
Jean-Baptiste Holcroft 2017-09-14 14:11:48 +02:00
parent 87de11d74c
commit 82b354400d
3 changed files with 33 additions and 25 deletions

View file

@ -1,9 +1,9 @@
# https://docs.weblate.org/en/latest/admin/install.html#production-cron
# Fulltext index updates
10 * * * * www-data cd "__FINALPATH__" && python3 ./manage.py update_index
10 * * * * www-data cd "__FINALPATH__" && source __FINALPATH__/venv/bin/activate && python3 ./manage.py update_index
# Cleanup stale objects
@daily cd "__FINALPATH__" && ./manage.py cleanuptrans
@daily cd "__FINALPATH__" && source __FINALPATH__/venv/bin/activate && ./manage.py cleanuptrans
# Commit pending changes after 96 hours
@hourly cd "__FINALPATH__" && ./manage.py commit_pending --all --age=96 --verbosity=0
@hourly cd "__FINALPATH__" && source __FINALPATH__/venv/bin/activate && ./manage.py commit_pending --all --age=96 --verbosity=0

View file

@ -2,30 +2,33 @@
uid = __NAME__
gid = users
protocol = uwsgi
wsgi-file = __FINALPATH__/weblate/wsgi.py
python-path = __FINALPATH__
# the virtualenv (full path)
home = __FINALPATH__/venv
protocol = uwsgi
wsgi-file = __FINALPATH__/weblate/wsgi.py
python-path = __FINALPATH__
# Needed for OAuth/OpenID
buffer-size = 8192
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
close-on-exec = true
# Avoid default 0000 umask
umask = 0022
umask = 0022
# process-related settings
# master
master = true
master = true
# maximum number of worker processes
processes = 4
processes = 4
# the socket (use the full path to be safe
socket = /opt/__NAME__/uwsgi.sock
socket = /opt/__NAME__/uwsgi.sock
# ... with appropriate permissions - may be needed
chmod-socket = 666
stats = /opt/__NAME__/stats.sock
chmod-socket = 666
stats = /opt/__NAME__/stats.sock
# clear environment on exit
vacuum = true
plugins = python3
vacuum = true
plugins = python

View file

@ -69,12 +69,8 @@ ynh_app_setting_set $app is_public $is_public
# INSTALL DEPENDENCIES
#=================================================
ynh_install_app_dependencies python-django translate-toolkit \
python-whoosh python-pil python-libravatar \
python-babel git mercurial \
python-django-compressor python-django-crispy-forms \
python-djangorestframework python-dateutil \
uwsgi uwsgi-plugin-python
ynh_install_app_dependencies libxml2-dev libxslt-dev libfreetype6-dev \
libjpeg-dev libz-dev libyaml-dev python-dev python-pip python-virtualenv
#=================================================
# CREATE A MYSQL DATABASE
@ -97,6 +93,14 @@ ynh_app_setting_set $app final_path $final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path"
#=================================================
# PIP INSTALLATION
#=================================================
sudo su $app -c "virtualenv ${final_path}/venv"
sudo source ${final_path}/venv/bin/activate
sudo pip install Weblate
sudo pip install pytz python-bidi PyYaML Babel pyuca pylibravatar pydns
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -130,6 +134,7 @@ sudo cp ../conf/uwsgi_service /etc/systemd/system/$app.uwsgi.service
ynh_replace_string "__NAME__" "$app" /etc/systemd/system/$app.uwsgi.service
ynh_replace_string "__FINALPATH__" "$final_path" /etc/systemd/system/$app.uwsgi.service
# Start service
sudo systemctl enable $app.uwsgi.service
sudo systemctl restart $app.uwsgi.service
@ -149,7 +154,7 @@ key=$(ynh_string_random 64)
sudo cp $final_path/weblate/settings_example.py $final_path/weblate/settings.py
sudo cp ../conf/settings.py $final_path/weblate/settings.py
ynh_replace_string "__NAME__" "$app" $final_path/settings.py
ynh_replace_string "__NAME__" "$app" $final_path/weblate/settings.py
ynh_replace_string "__DB_PWD__" "$db_pwd" $final_path/weblate/settings.py
ynh_replace_string "__ADMIN__" "$admin" $final_path/weblate/settings.py
ynh_replace_string "__ADMINMAIL__" "$admin_mail" $final_path/weblate/settings.py
@ -171,7 +176,7 @@ sudo $final_path/manage.py collectstatic --noinput
# SETUP CRON
#=================================================
cp ../conf/cron_weblate /etc/cron.d/$app
sudo cp ../conf/cron_weblate /etc/cron.d/$app
ynh_replace_string "__FINALPATH__" "$final_path/" /etc/cron.d/$app
#=================================================
@ -188,7 +193,7 @@ ynh_store_file_checksum "$final_path/CONFIG_FILE"
#=================================================
# Set permissions to app files
chown -R root: $final_path
sudo chown -R root: $final_path
#=================================================
# SETUP LOGROTATE