Spaces:
Running
Running
Hermes Agent commited on
Commit ·
a5f2ff4
1
Parent(s): 316c073
fix(open-webui): add SQLite PRAGMA quick_check integrity check and prevent malformed webui.db creation
Browse files- entrypoint.sh +8 -3
entrypoint.sh
CHANGED
|
@@ -451,12 +451,17 @@ for path in ['/root/.open-webui/webui.db', '/root/.open-webui/data/webui.db', '/
|
|
| 451 |
export WEBUI_AUTH="true"
|
| 452 |
export ENABLE_SIGNUP="true"
|
| 453 |
mkdir -p /root/.cache /data/cache /data/open-webui /root/.open-webui 2>/dev/null || true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 454 |
if [ -d "/data/open-webui/webui.db" ]; then
|
| 455 |
rm -rf "/data/open-webui/webui.db" 2>/dev/null || true
|
| 456 |
fi
|
| 457 |
-
if [ ! -f "/data/open-webui/webui.db" ]; then
|
| 458 |
-
touch "/data/open-webui/webui.db" 2>/dev/null || true
|
| 459 |
-
fi
|
| 460 |
chmod -R 777 /data/open-webui /root/.open-webui 2>/dev/null || true
|
| 461 |
export CORS_ALLOW_ORIGIN="https://jishnupg-opencode-cli.hf.space"
|
| 462 |
open-webui serve --port 8098 &
|
|
|
|
| 451 |
export WEBUI_AUTH="true"
|
| 452 |
export ENABLE_SIGNUP="true"
|
| 453 |
mkdir -p /root/.cache /data/cache /data/open-webui /root/.open-webui 2>/dev/null || true
|
| 454 |
+
if [ -f "/data/open-webui/webui.db" ]; then
|
| 455 |
+
if command -v sqlite3 >/dev/null 2>&1; then
|
| 456 |
+
if ! sqlite3 "/data/open-webui/webui.db" "PRAGMA quick_check;" >/dev/null 2>&1; then
|
| 457 |
+
echo "[FIX] Corrupt Open WebUI database detected! Resetting /data/open-webui/webui.db..."
|
| 458 |
+
rm -f /data/open-webui/webui.db* /root/.open-webui/webui.db* 2>/dev/null || true
|
| 459 |
+
fi
|
| 460 |
+
fi
|
| 461 |
+
fi
|
| 462 |
if [ -d "/data/open-webui/webui.db" ]; then
|
| 463 |
rm -rf "/data/open-webui/webui.db" 2>/dev/null || true
|
| 464 |
fi
|
|
|
|
|
|
|
|
|
|
| 465 |
chmod -R 777 /data/open-webui /root/.open-webui 2>/dev/null || true
|
| 466 |
export CORS_ALLOW_ORIGIN="https://jishnupg-opencode-cli.hf.space"
|
| 467 |
open-webui serve --port 8098 &
|