fix(web-app-bookwyrm): use explicit /venv/bin paths and drop bash -l

`bash -lc` triggers a login shell that sources /etc/profile, which
resets PATH to /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
and strips the Dockerfile's `ENV PATH=/venv/bin:$PATH`. The bookwyrm
app then crashes with `ModuleNotFoundError: No module named 'environs'`
and the celery worker dies with `celery: command not found`, both
containers restart-loop, the bookwyrm vhost returns 502 and the deploy
times out on the playwright readiness probe (CI run 26005522256 / job
76437356563 reproduces the same symptom).

Switch the app command to `bash -c` (non-login) and address `python`
and `celery` via their absolute /venv/bin/ paths so the venv is used
regardless of PATH state. The worker now invokes celery directly,
skipping the bash wrapper entirely.

Empirically verified inside the running infinito stack by patching
the rendered compose.yml + compose.ca.override.yml in place and
recreating bookwyrm + bookwyrm-worker via `compose up -d --force-recreate`:
- migrations run cleanly (oauth2_provider, sessions, ...)
- gunicorn boots on 0.0.0.0:8000
- bookwyrm reports healthy via the curl healthcheck
- worker stays Up (previously stuck Restarting (127))

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 4.7 committed 2026-05-18 08:47:33 +02:00
1 parent 69f5435359
commit 0700aaf6d7
1 file changed
+6 -6
@@ -3,11 +3,11 @@
application:
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
command: >-
bash -lc '
python manage.py migrate --noinput &&
python manage.py collectstatic --noinput &&
(python manage.py initdb || true) &&
python -m gunicorn bookwyrm.wsgi:application --bind 0.0.0.0:{{ container_port }}
bash -c '
/venv/bin/python manage.py migrate --noinput &&
/venv/bin/python manage.py collectstatic --noinput &&
(/venv/bin/python manage.py initdb || true) &&
/venv/bin/python -m gunicorn bookwyrm.wsgi:application --bind 0.0.0.0:{{ container_port }}
'
{{ lookup('template', 'roles/sys-svc-container/templates/build.yml.j2') | indent(4) }}
args:
@@ -31,7 +31,7 @@
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
image: "{{ BOOKWYRM_CUSTOM_IMAGE }}"
container_name: "{{ BOOKWYRM_WORKER_CONTAINER }}"
command: "bash -lc 'celery -A celerywyrm worker -l INFO'"
command: "/venv/bin/celery -A celerywyrm worker -l INFO"
pull_policy: never
volumes:
- 'data:/app/data'