Skip to content

fix: handle read-only SQLite gracefully in viewer containers#69

Merged
GeiserX merged 2 commits intomasterfrom
fix/sqlite-readonly-viewer
Feb 7, 2026
Merged

fix: handle read-only SQLite gracefully in viewer containers#69
GeiserX merged 2 commits intomasterfrom
fix/sqlite-readonly-viewer

Conversation

@GeiserX
Copy link
Owner

@GeiserX GeiserX commented Feb 7, 2026

Summary

  • Wrap PRAGMA journal_mode=WAL and create_all in try/except so the viewer container degrades gracefully instead of crashing when SQLite is read-only
  • Remove :ro from viewer volume in docker-compose.yml since SQLite WAL needs write access for .db-wal/.db-shm sidecar files

Fixes #61

Test plan

  • Start viewer container with SQLite backend — should boot without errors
  • Verify viewer still serves pages correctly in default journal mode when WAL fails

The viewer Dockerfile runs as non-root (UID 1000), and the default
docker-compose mounts ./data:/data:ro. SQLite WAL mode requires write
access to create .db-wal and .db-shm files alongside the database,
which fails in both scenarios.

Changes:
- Wrap PRAGMA journal_mode=WAL in try/except — if WAL fails, the viewer
  still works in the default journal mode (read-only is fine for viewing)
- Wrap create_all in try/except — the viewer doesn't need to create
  tables, the backup container handles that
- Remove :ro from viewer volume in docker-compose.yml since SQLite WAL
  needs write access (add comment explaining this)

Fixes #61
@GeiserX GeiserX merged commit cd449de into master Feb 7, 2026
6 checks passed
@GeiserX GeiserX deleted the fix/sqlite-readonly-viewer branch February 7, 2026 16:23
@github-actions
Copy link

github-actions bot commented Feb 7, 2026

🐳 Dev images published!

  • drumsergio/telegram-archive:dev
  • drumsergio/telegram-archive-viewer:dev

The dev/test instance will pick up these changes automatically (Portainer GitOps).

To test locally:

docker pull drumsergio/telegram-archive:dev
docker pull drumsergio/telegram-archive-viewer:dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: sqlite error

1 participant