From 21ceb093187f01446297d71da0ccecbe4f0e407a Mon Sep 17 00:00:00 2001 From: moson-mo <mo-son@mailbox.org> Date: Sat, 24 Jun 2023 10:12:40 +0200 Subject: [PATCH] fix: run aurweb ssh commands and git scripts in virtualenv Adjust bash wrapper scripts to activate our python virtualenv: Script execution is triggered from ssh / git. These wrapper scripts then call python scripts created by poetry. We should make sure that this happens within our venv. Previously this was done by using "poetry run...". However, using poetry is costly and adds some delay. Instead of using poetry, we can just activate our venv and then execute our scripts. Fixes: b15ac83821ae ("aurweb: Make SSH faster by avoiding slow Poetry (~2,5 sec faster)") Signed-off-by: moson-mo <mo-son@mailbox.org> --- roles/aurweb/templates/aurweb-git-auth.sh.j2 | 4 +++- roles/aurweb/templates/aurweb-git-serve.sh.j2 | 4 +++- roles/aurweb/templates/aurweb-git-update.sh.j2 | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/roles/aurweb/templates/aurweb-git-auth.sh.j2 b/roles/aurweb/templates/aurweb-git-auth.sh.j2 index 14feaa875..42c169872 100644 --- a/roles/aurweb/templates/aurweb-git-auth.sh.j2 +++ b/roles/aurweb/templates/aurweb-git-auth.sh.j2 @@ -1,2 +1,4 @@ #!/bin/bash -exec "{{ aurweb_dir }}/.venv/bin/aurweb-git-auth" "$@" +cd "{{ aurweb_dir }}" +source .venv/bin/activate +exec aurweb-git-auth "$@" diff --git a/roles/aurweb/templates/aurweb-git-serve.sh.j2 b/roles/aurweb/templates/aurweb-git-serve.sh.j2 index 25cf719f9..794914e1e 100644 --- a/roles/aurweb/templates/aurweb-git-serve.sh.j2 +++ b/roles/aurweb/templates/aurweb-git-serve.sh.j2 @@ -1,2 +1,4 @@ #!/bin/bash -exec "{{ aurweb_dir }}/.venv/bin/aurweb-git-serve" "$@" +cd "{{ aurweb_dir }}" +source .venv/bin/activate +exec aurweb-git-serve "$@" diff --git a/roles/aurweb/templates/aurweb-git-update.sh.j2 b/roles/aurweb/templates/aurweb-git-update.sh.j2 index ea02763cb..3b13d7d48 100644 --- a/roles/aurweb/templates/aurweb-git-update.sh.j2 +++ b/roles/aurweb/templates/aurweb-git-update.sh.j2 @@ -1,3 +1,4 @@ #!/bin/bash cd "{{ aurweb_dir }}" -exec poetry run aurweb-git-update "$@" +source .venv/bin/activate +exec aurweb-git-update "$@" -- GitLab