[Fix]: Wizarr DB error during install (#9415)

* test skip scheduler during install & not running migration

- migration is run by the start script anyway, I think

* restore db upgrade during install/update; add new env vars; patch start.sh
This commit is contained in:
Chris 2025-11-24 16:03:19 -05:00 committed by GitHub
parent cf89b17b0d
commit e54f372079
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 6 deletions

View File

@ -52,11 +52,21 @@ function update_script() {
$STD npm --prefix app/static run build:css $STD npm --prefix app/static run build:css
mkdir -p ./.cache mkdir -p ./.cache
$STD tar -xf "$BACKUP_FILE" --directory=/ $STD tar -xf "$BACKUP_FILE" --directory=/
$STD /usr/local/bin/uv run --frozen flask db upgrade if grep -q 'workers' /opt/wizarr/start.sh; then
if ! grep -q 'frozen' /opt/wizarr/start.sh; then sed -i 's/--workers 4//' /opt/wizarr/start.sh
sed -i 's/run/& --frozen/' /opt/wizarr/start.sh fi
if ! grep -qE 'FLASK|WORKERS|VERSION' /opt/wizarr/.env; then
{
echo "FLASK_ENV=production"
echo "GUNICORN_WORKERS=4"
echo "APP_VERSION=$(sed 's/^20/v&/' ~/.wizarr)"
} >>/opt/wizarr/.env
else
sed -i "s/_VERSION=v.*$/_VERSION=v$(cat ~/.wizarr)/" /opt/wizarr/.env
fi fi
rm -rf "$BACKUP_FILE" rm -rf "$BACKUP_FILE"
export FLASK_SKIP_SCHEDULER=true
$STD /usr/local/bin/uv run --frozen flask db upgrade
msg_ok "Updated Wizarr" msg_ok "Updated Wizarr"
msg_info "Starting Service" msg_info "Starting Service"

View File

@ -28,13 +28,16 @@ $STD /usr/local/bin/uv run --frozen pybabel compile -d app/translations
$STD npm --prefix app/static install $STD npm --prefix app/static install
$STD npm --prefix app/static run build:css $STD npm --prefix app/static run build:css
mkdir -p ./.cache mkdir -p ./.cache
$STD /usr/local/bin/uv run --frozen flask db upgrade
LOCAL_IP="$(hostname -I | awk '{print $1}')" LOCAL_IP="$(hostname -I | awk '{print $1}')"
VERSION="$(sed 's/^20/v&/' ~/.wizarr)"
cat <<EOF >/opt/wizarr/.env cat <<EOF >/opt/wizarr/.env
FLASK_ENV=production
GUNICORN_WORKERS=4
APP_URL=http://${LOCAL_IP} APP_URL=http://${LOCAL_IP}
DISABLE_BUILTIN_AUTH=false DISABLE_BUILTIN_AUTH=false
LOG_LEVEL=INFO LOG_LEVEL=INFO
APP_VERSION=${VERSION}
EOF EOF
cat <<EOF >/opt/wizarr/start.sh cat <<EOF >/opt/wizarr/start.sh
@ -43,7 +46,6 @@ cat <<EOF >/opt/wizarr/start.sh
uv run --frozen gunicorn \ uv run --frozen gunicorn \
--config gunicorn.conf.py \ --config gunicorn.conf.py \
--preload \ --preload \
--workers 4 \
--bind 0.0.0.0:5690 \ --bind 0.0.0.0:5690 \
--umask 007 \ --umask 007 \
run:app run:app
@ -67,9 +69,15 @@ Restart=on-abnormal
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF
systemctl enable -q --now wizarr
msg_ok "Created Service" msg_ok "Created Service"
msg_info "Running DB upgrade"
export FLASK_SKIP_SCHEDULER=true
$STD /usr/local/bin/uv run --frozen flask db upgrade
msg_ok "DB upgrade complete"
systemctl enable -q --now wizarr
motd_ssh motd_ssh
customize customize
cleanup_lxc cleanup_lxc