From 32ab0327972f9b86481d8a9fc6066792d35d02f1 Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Mon, 30 Mar 2026 13:12:38 +0200 Subject: [PATCH] fix(tubearchivist): fix celery beat race condition on first boot Beat service starts before manage.py migrate creates the django_celery_beat tables, causing 'no such table' error. Add ExecStartPre that waits for migration to complete by polling the SQLite DB for the crontab table. --- install/tubearchivist-install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install/tubearchivist-install.sh b/install/tubearchivist-install.sh index 48771fa8..3cdca92b 100644 --- a/install/tubearchivist-install.sh +++ b/install/tubearchivist-install.sh @@ -24,6 +24,7 @@ $STD apt install -y \ libldap2-dev \ libsasl2-dev \ libssl-dev \ + sqlite3 \ ffmpeg msg_ok "Installed Dependencies" @@ -259,6 +260,7 @@ User=root WorkingDirectory=/opt/tubearchivist/backend EnvironmentFile=/opt/tubearchivist/.env Environment=PATH=/opt/tubearchivist/.venv/bin:/usr/local/bin:/usr/bin:/bin +ExecStartPre=/bin/bash -c 'for i in \$(seq 1 60); do sqlite3 /opt/tubearchivist/cache/db.sqlite3 "SELECT 1 FROM django_celery_beat_crontabschedule LIMIT 1" 2>/dev/null && exit 0; sleep 2; done; exit 1' ExecStart=/opt/tubearchivist/.venv/bin/celery -A task beat --loglevel=error --scheduler django_celery_beat.schedulers:DatabaseScheduler Restart=always RestartSec=5