fix: handle read-only SQLite gracefully in viewer containers#69
Merged
fix: handle read-only SQLite gracefully in viewer containers#69
Conversation
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
|
🐳 Dev images published!
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PRAGMA journal_mode=WALandcreate_allin try/except so the viewer container degrades gracefully instead of crashing when SQLite is read-only:rofrom viewer volume indocker-compose.ymlsince SQLite WAL needs write access for.db-wal/.db-shmsidecar filesFixes #61
Test plan