mirror of
https://github.com/YunoHost-Apps/weblate_ynh.git
synced 2024-10-01 13:35:04 +02:00
upgrade to 3.5
This commit is contained in:
parent
a20266dcc0
commit
b223178dd7
8 changed files with 86 additions and 92 deletions
|
@ -49,6 +49,9 @@ DATABASES = {
|
|||
'HOST': 'localhost',
|
||||
# Set to empty string for default
|
||||
'PORT': '5432',
|
||||
'OPTIONS': {
|
||||
'sslmode': 'disable'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -647,6 +650,11 @@ ENABLE_HOOKS = True
|
|||
# Number of nearby messages to show in each direction
|
||||
NEARBY_MESSAGES = 5
|
||||
|
||||
# By default the length of a given translation is limited to the length of
|
||||
# the source string * 10 characters. Set this option to False to allow longer
|
||||
# translations (up to 10.000 characters)
|
||||
LIMIT_TRANSLATION_LENGTH_BY_SOURCE_LENGTH = True
|
||||
|
||||
# Use simple language codes for default language/country combinations
|
||||
SIMPLIFY_LANGUAGES = True
|
||||
|
||||
|
@ -667,6 +675,7 @@ CRISPY_TEMPLATE_PACK = 'bootstrap3'
|
|||
# 'weblate.checks.chars.EndEllipsisCheck',
|
||||
# 'weblate.checks.chars.EndSemicolonCheck',
|
||||
# 'weblate.checks.chars.MaxLengthCheck',
|
||||
# 'weblate.checks.chars.KashidaCheck',
|
||||
# 'weblate.checks.format.PythonFormatCheck',
|
||||
# 'weblate.checks.format.PythonBraceFormatCheck',
|
||||
# 'weblate.checks.format.PHPFormatCheck',
|
||||
|
@ -686,6 +695,10 @@ CRISPY_TEMPLATE_PACK = 'bootstrap3'
|
|||
# 'weblate.checks.chars.ZeroWidthSpaceCheck',
|
||||
# 'weblate.checks.markup.XMLValidityCheck',
|
||||
# 'weblate.checks.markup.XMLTagsCheck',
|
||||
# 'weblate.checks.markup.MarkdownRefLinkCheck',
|
||||
# 'weblate.checks.markup.MarkdownLinkCheck',
|
||||
# 'weblate.checks.markup.MarkdownSyntaxCheck',
|
||||
# 'weblate.checks.markup.URLCheck',
|
||||
# 'weblate.checks.source.OptionalPluralCheck',
|
||||
# 'weblate.checks.source.EllipsisCheck',
|
||||
# 'weblate.checks.source.MultipleFailingCheck',
|
||||
|
@ -842,14 +855,13 @@ CELERY_RESULT_BACKEND = CELERY_BROKER_URL
|
|||
|
||||
# Celery settings, it is not recommended to change these
|
||||
CELERY_WORKER_PREFETCH_MULTIPLIER = 0
|
||||
CELERY_WORKER_MAX_MEMORY_PER_CHILD = 200000
|
||||
CELERY_BEAT_SCHEDULE_FILENAME = os.path.join(
|
||||
DATA_DIR, 'celery', 'beat-schedule'
|
||||
)
|
||||
|
||||
CELERY_TASK_ROUTES = {
|
||||
'weblate.trans.search.*': {'queue': 'search'},
|
||||
'weblate.trans.tasks.optimize_fulltext': {'queue': 'search'},
|
||||
'weblate.trans.tasks.cleanup_fulltext': {'queue': 'search'},
|
||||
'weblate.memory.tasks.*': {'queue': 'memory'},
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ virtualenv = __FINALPATH__/venv
|
|||
|
||||
# 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.5/site-packages/weblate/wsgi.py
|
||||
manage-script-name = true
|
||||
|
||||
# Needed for OAuth/OpenID
|
||||
buffer-size = 8192
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
"description": {
|
||||
"en": "A translation platform using Git and Python"
|
||||
},
|
||||
"version": "3.4~ynh1",
|
||||
"version": "3.5~ynh1",
|
||||
"url": "https://weblate.org",
|
||||
"license": "AGPL-3.0",
|
||||
"maintainer": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
current_version="3.4"
|
||||
current_version="3.5"
|
||||
|
||||
|
||||
weblate_fill_settings() {
|
||||
|
|
|
@ -55,7 +55,7 @@ ynh_backup "/etc/cron.d/$app"
|
|||
#=================================================
|
||||
|
||||
ynh_backup "/etc/uwsgi/apps-available/$app.ini"
|
||||
ynh_backup "/etc/systemd/system/uwsgi-app@.service"
|
||||
ynh_backup "/etc/systemd/system/$app.service"
|
||||
ynh_backup "/etc/systemd/system/$app-celery.service"
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -237,6 +237,7 @@ ynh_replace_string "__FINALPATH__" "$final_path/" "/etc/cron.d/$app"
|
|||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum "$final_path/venv/lib/python3.5/site-packages/weblate/settings.py"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP uwsgi
|
||||
#=================================================
|
||||
|
||||
|
@ -306,14 +307,14 @@ fi
|
|||
# ADVERTISE SERVICES IN ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
yunohost service add "$app.service" --log "/var/log/uwsgi/app/$app"
|
||||
yunohost service add "$app-celery.service" --log "/var/log/$app-celery"
|
||||
yunohost service add "$app" --log "/var/log/uwsgi/app/$app/weblate"
|
||||
yunohost service add "$app-celery" --log "/var/log/$app-celery"
|
||||
|
||||
#=================================================
|
||||
# Start weblate
|
||||
#=================================================
|
||||
|
||||
systemctl start "$app.service"
|
||||
systemctl start "$app"
|
||||
systemctl start "$app-celery"
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -81,22 +81,6 @@ ynh_psql_test_if_first_run
|
|||
ynh_psql_create_db "$db_name" "$db_name" "$db_pwd"
|
||||
ynh_psql_execute_file_as_root ./db.sql "$db_name"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE UWSGI MECANICS
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file "/etc/systemd/system/uwsgi-app@.service"
|
||||
|
||||
# make sure the folder for sockets exists and set authorizations
|
||||
mkdir -p /var/run/uwsgi/
|
||||
chown root:www-data /var/run/uwsgi/
|
||||
chmod -R 775 /var/run/uwsgi/
|
||||
|
||||
# make sure the folder for logs exists and set authorizations
|
||||
mkdir -p /var/log/uwsgi/app/
|
||||
chown root:www-data /var/log/uwsgi/app/
|
||||
chmod -R 775 /var/log/uwsgi/app/
|
||||
|
||||
#=================================================
|
||||
# RESTORE Weblate service
|
||||
#=================================================
|
||||
|
@ -104,14 +88,20 @@ chmod -R 775 /var/log/uwsgi/app/
|
|||
usermod --append --groups www-data "$app"
|
||||
|
||||
ynh_restore_file "/etc/uwsgi/apps-available/$app.ini"
|
||||
ynh_restore_file "/etc/systemd/system/$app.service"
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl enable "uwsgi-app@$app.service"
|
||||
|
||||
# Add as a service
|
||||
yunohost service add "uwsgi-app@$app.service" --log "/var/log/uwsgi/app/$app"
|
||||
systemctl enable "$app"
|
||||
|
||||
ynh_restore_file "/etc/systemd/system/$app-celery.service"
|
||||
systemctl enable "$app-celery"
|
||||
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
# Add as a service
|
||||
yunohost service add "$app" --log "/var/log/uwsgi/app/$app"
|
||||
yunohost service add "$app-celery" --log "/var/log/$app-celery"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE CRON FILE
|
||||
|
@ -131,8 +121,8 @@ ynh_restore_file "/usr/bin/hub"
|
|||
# Start weblate
|
||||
#=================================================
|
||||
|
||||
systemctl start "$app-celery.service"
|
||||
systemctl start "uwsgi-app@$app.service"
|
||||
systemctl start "$app"
|
||||
systemctl start "$app-celery"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX & uwsgi
|
||||
|
|
112
scripts/upgrade
112
scripts/upgrade
|
@ -83,37 +83,6 @@ then
|
|||
ynh_app_setting_set "$app" memc_port "$memc_port"
|
||||
fi
|
||||
|
||||
# (<2.18) migrade old uwsgi files if existing
|
||||
if [ -e "/etc/systemd/system/$app.service" ]
|
||||
then
|
||||
systemctl stop "$app.service"
|
||||
systemctl disable "$app.service"
|
||||
yunohost service remove "$app.service"
|
||||
ynh_secure_remove "$final_path/uwsgi.ini"
|
||||
ynh_secure_remove "/etc/systemd/system/$app.service"
|
||||
fi
|
||||
|
||||
# (<2.20) remove your old sockets!
|
||||
if [ -e "/etc/systemd/system/uwsgi-app@$app.socket" ]
|
||||
then
|
||||
systemctl stop "uwsgi-app@$app.socket"
|
||||
yunohost service remove "uwsgi-app@$app.socket"
|
||||
ynh_secure_remove "/etc/systemd/system/uwsgi-app@.socket"
|
||||
systemctl daemon-reload
|
||||
fi
|
||||
|
||||
# (<2.18) move hub to the correct folder
|
||||
if [ -e "$final_path/bin/hub" ]
|
||||
then
|
||||
mv "$final_path/bin/hub" /usr/bin/
|
||||
chown root:root /usr/bin/hub
|
||||
fi
|
||||
|
||||
if [[ -d "$final_path/bin/" ]]
|
||||
then
|
||||
ynh_secure_remove "$final_path/bin/"
|
||||
fi
|
||||
|
||||
# Weblate requires an update to 3.0 before 3.1
|
||||
# the upgrade hook will launch this script again to make sure it works
|
||||
if [[ -z "$migration311" && $previous_version = "2.20" ]]
|
||||
|
@ -136,17 +105,6 @@ then
|
|||
current_version="3.0.1"
|
||||
fi
|
||||
|
||||
# Make sure the uwsgi service is stoped
|
||||
if [[ -e "/var/run/uwsgi/$app.socket" ]]
|
||||
then
|
||||
systemctl stop "uwsgi-app@$app.service"
|
||||
fi
|
||||
|
||||
if [[ -e "/var/run/$app-celery/$app-w1.pid" ]]
|
||||
then
|
||||
systemctl stop "$app-celery.service"
|
||||
fi
|
||||
|
||||
# (<3.2)
|
||||
if [ -z "$redis_db" ]; then
|
||||
redis_db=$(ynh_redis_get_free_db)
|
||||
|
@ -166,6 +124,45 @@ ynh_clean_setup () {
|
|||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY - impacting system
|
||||
#=================================================
|
||||
|
||||
# (<2.20) remove complex uwsgi systemd template
|
||||
if [ -e "/etc/systemd/system/uwsgi-app@.service" ]
|
||||
then
|
||||
systemctl stop "uwsgi-app@$app"
|
||||
yunohost service remove "uwsgi-app@$app.service"
|
||||
ynh_secure_remove "/etc/systemd/system/uwsgi-app@.socket"
|
||||
ynh_secure_remove "/etc/systemd/system/uwsgi-app@.service"
|
||||
# remove old log file (used by the new service file)
|
||||
ynh_secure_remove "/var/log/uwsgi/app/weblate"
|
||||
systemctl daemon-reload
|
||||
fi
|
||||
|
||||
# (<2.18) move hub to the correct folder
|
||||
if [ -e "$final_path/bin/hub" ]
|
||||
then
|
||||
mv "$final_path/bin/hub" /usr/bin/
|
||||
chown root:root /usr/bin/hub
|
||||
fi
|
||||
|
||||
if [[ -d "$final_path/bin/" ]]
|
||||
then
|
||||
ynh_secure_remove "$final_path/bin/"
|
||||
fi
|
||||
|
||||
# Make sure the uwsgi service is stoped
|
||||
if [[ -e "/var/run/$app/socket" ]]
|
||||
then
|
||||
systemctl stop "$app"
|
||||
fi
|
||||
|
||||
if [[ -e "/var/run/$app-celery/$app-w1.pid" ]]
|
||||
then
|
||||
systemctl stop "$app-celery"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# CHECK THE PATH
|
||||
#=================================================
|
||||
|
@ -177,20 +174,6 @@ path_url=$(ynh_normalize_url_path "$path_url")
|
|||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
|
||||
finaluwsgiini="/etc/uwsgi/apps-available/$app.ini"
|
||||
if [ -e "$finaluwsgiini" ]; then
|
||||
systemctl stop "uwsgi-app@$app.service"
|
||||
systemctl disable "uwsgi-app@$app.service"
|
||||
yunohost service remove "uwsgi-app@$app.service"
|
||||
|
||||
ynh_secure_remove "$finaluwsgiini"
|
||||
ynh_secure_remove "/var/log/uwsgi/app/$app"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
|
@ -228,15 +211,24 @@ ynh_install_app_dependencies libxml2-dev libxslt-dev libfreetype6-dev \
|
|||
# SPECIFIC SETUP uwsgi
|
||||
#=================================================
|
||||
|
||||
ynh_add_uwsgi_service
|
||||
finaluwsgiini="/etc/uwsgi/apps-available/$app.ini"
|
||||
cp ../conf/uwsgi.ini "$finaluwsgiini"
|
||||
|
||||
ynh_replace_string "__FINALPATH__" "$final_path" "$finaluwsgiini"
|
||||
ynh_replace_string "__PATH__" "$path_url" "$finaluwsgiini"
|
||||
ynh_replace_string "__APP__" "$app" "$finaluwsgiini"
|
||||
|
||||
|
||||
# root install doesn't require uwsgi to handle script names
|
||||
if [ "$path_url" == "/" ]
|
||||
then
|
||||
ynh_replace_string "manage-script-name = true" "manage-script-name = false" "$finaluwsgiini"
|
||||
ynh_store_file_checksum "$finaluwsgiini"
|
||||
fi
|
||||
|
||||
ynh_add_systemd_config "$app" "weblate.service"
|
||||
|
||||
ynh_store_file_checksum "$finaluwsgiini"
|
||||
|
||||
#=================================================
|
||||
# PIP INSTALLATION
|
||||
#=================================================
|
||||
|
@ -424,8 +416,8 @@ fi
|
|||
# Restart weblate
|
||||
#=================================================
|
||||
|
||||
systemctl start "uwsgi-app@$app.service"
|
||||
systemctl start "$app-celery.service"
|
||||
systemctl start "$app"
|
||||
systemctl start "$app-celery"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
|
Loading…
Reference in a new issue