From c40fc21709cc0d27a028c977c8147b0d7e4332f4 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Fri, 1 May 2020 21:05:04 +0200 Subject: [PATCH 1/5] Fix python3.5 not existing --- scripts/change_url | 3 ++- scripts/install | 3 ++- scripts/upgrade | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 40996aa..faca535 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -85,7 +85,8 @@ fi #================================================= # Edit specific content from nginx configuration #================================================= -settings="$final_path/venv/lib/python3.5/site-packages/weblate/settings.py" +python_version=$(ls -1 $final_path/venv/lib | grep python) +settings="$final_path/venv/lib/$python_version/site-packages/weblate/settings.py" if [ "$old_path" == "/" ] && [ "$new_path" != "/" ] then diff --git a/scripts/install b/scripts/install index 98bd281..64dcdc2 100755 --- a/scripts/install +++ b/scripts/install @@ -207,7 +207,8 @@ admin_mail=$(ynh_user_get_info "$admin" mail) key=$(ynh_string_random 24)$(ynh_string_random 24)$(ynh_string_random 2) redis_db=$(ynh_redis_get_free_db) -settings="$final_path/venv/lib/python3.5/site-packages/weblate/settings.py" +python_version=$(ls -1 $final_path/venv/lib | grep python) +settings="$final_path/venv/lib/$python_version/site-packages/weblate/settings.py" cp "../conf/settings_history/settings.$current_version.py" "$settings" weblate_fill_settings "$settings" diff --git a/scripts/upgrade b/scripts/upgrade index cc50c78..713a056 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -190,7 +190,8 @@ ynh_script_progression --message="Install weblate using PIP..." --time --weight= #================================================= ynh_script_progression --message="Create weblate configuration file..." --time --weight=1 # save old settings file -settings="$final_path/venv/lib/python3.5/site-packages/weblate/settings.py" +python_version=$(ls -1 $final_path/venv/lib | grep python) +settings="$final_path/venv/lib/$python_version/site-packages/weblate/settings.py" old_settings="$final_path/settings.$previous_version.old.py" From be5bdc2f2fcad8d787384ed8133ca44a639d465a Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sun, 3 May 2020 01:44:16 +0200 Subject: [PATCH 2/5] Force usage of Django version lower than 3 Django versions after 3 drop the support for python_2_unicode_compatible --- scripts/install | 1 + scripts/upgrade | 1 + 2 files changed, 2 insertions(+) diff --git a/scripts/install b/scripts/install index 1993684..5a34320 100755 --- a/scripts/install +++ b/scripts/install @@ -188,6 +188,7 @@ virtualenv --python=python3 "${final_path}/venv" pip install --upgrade pip # prevent error: "command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers" pip install --upgrade setuptools + pip install Django==2.2.* pip install Weblate=="$current_version" pip install pytz python-bidi PyYaML Babel pyuca pylibravatar py3dns psycopg2-binary phply django-redis hiredis aeidon ruamel.yaml # specific to YunoHost package: diff --git a/scripts/upgrade b/scripts/upgrade index 17f36a3..72b96b7 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -181,6 +181,7 @@ ynh_script_progression --message="Install weblate using PIP..." --weight=10 pip install --upgrade pip # prevent error: "command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers" pip install --upgrade setuptools + pip install Django==2.2.* pip install Weblate=="$current_version" pip install pytz python-bidi PyYaML Babel pyuca pylibravatar py3dns psycopg2-binary phply django-redis hiredis aeidon ruamel.yaml # specific to YunoHost package: From 4448de373c4bdc54624a584559a98791e48bc714 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sun, 3 May 2020 02:04:07 +0200 Subject: [PATCH 3/5] Set uid,gid on the socket for nginx --- conf/weblate.service | 2 ++ 1 file changed, 2 insertions(+) diff --git a/conf/weblate.service b/conf/weblate.service index 16e6b43..b9d657a 100644 --- a/conf/weblate.service +++ b/conf/weblate.service @@ -20,6 +20,8 @@ ExecStart=/usr/bin/uwsgi \ --chmod-socket=775 \ --logto /var/log/__APP__/weblate.log \ --processes 4 + --uid=__APP__ + --gid=www-data Restart=on-failure From 3bcabc03b3c01cd631e7038f230a7d8b057b6a1a Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sun, 3 May 2020 02:26:16 +0200 Subject: [PATCH 4/5] Fix mistake in the systemd config --- conf/weblate.service | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/weblate.service b/conf/weblate.service index b9d657a..813ac9e 100644 --- a/conf/weblate.service +++ b/conf/weblate.service @@ -19,8 +19,8 @@ ExecStart=/usr/bin/uwsgi \ --socket /var/run/__APP__/socket \ --chmod-socket=775 \ --logto /var/log/__APP__/weblate.log \ - --processes 4 - --uid=__APP__ + --processes 4 \ + --uid=__APP__ \ --gid=www-data From 09e51fc7b2cf2d8f9ba1429bc26a3e757815dafe Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Mon, 4 May 2020 00:34:25 +0200 Subject: [PATCH 5/5] celery service set the permission on the socket --- conf/celery-weblate.service | 2 +- conf/weblate.service | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/conf/celery-weblate.service b/conf/celery-weblate.service index 337cf35..a033ad6 100644 --- a/conf/celery-weblate.service +++ b/conf/celery-weblate.service @@ -5,7 +5,7 @@ After=network.target [Service] Type=forking User=__APP__ -Group=__APP__ +Group=www-data PermissionsStartOnly=true EnvironmentFile=__FINALPATH__/celery-weblate WorkingDirectory=__FINALPATH__/ diff --git a/conf/weblate.service b/conf/weblate.service index 813ac9e..16e6b43 100644 --- a/conf/weblate.service +++ b/conf/weblate.service @@ -19,9 +19,7 @@ ExecStart=/usr/bin/uwsgi \ --socket /var/run/__APP__/socket \ --chmod-socket=775 \ --logto /var/log/__APP__/weblate.log \ - --processes 4 \ - --uid=__APP__ \ - --gid=www-data + --processes 4 Restart=on-failure