fix(paperless-ngx): keep SQLite database and index on local disk

Only media/consume/export/trash stay on the UNAS share; SQLite over
NFS risks lock contention and corruption.
This commit is contained in:
Brian Pooe 2026-07-03 18:38:50 +02:00
parent d20500c5be
commit cc6cdebba2
2 changed files with 21 additions and 19 deletions

View file

@ -6,19 +6,22 @@ task broker.
## Persistent Data ## Persistent Data
All document state lives on the UNAS `paperless_data` share (see Split between local disk and the UNAS `paperless_data` share (see
[nfs-mounts](../../docs/unas/nfs-mounts.md)), NFS-mounted on the Proxmox host [nfs-mounts](../../docs/unas/nfs-mounts.md)):
and bind-mounted into the LXC at `PAPERLESS_DATA_ROOT`:
- `data/` — database, search index, classification model. - `paperless_data` named volume (local disk) — SQLite database, search index,
- `media/` — original and archived documents. and classification model. Kept off NFS because SQLite file locking over NFS
- `consume/` — watched for new documents; safe to empty once ingested. risks corruption and slow queries.
- `export/` — target for `document_exporter` backups. - Share dirs, NFS-mounted on the Proxmox host and bind-mounted into the LXC
- `trash/` — deleted documents until emptied. at `PAPERLESS_DATA_ROOT`:
- `media/` — original and archived documents.
- `consume/` — watched for new documents; safe to empty once ingested.
- `export/` — target for `document_exporter` backups.
- `trash/` — deleted documents until emptied.
The compose binds use `create_host_path: false`, so the stack refuses to start The share binds use `create_host_path: false`, so the stack refuses to start
if the share is not mounted. Only the Redis broker state is in a Docker named if the share is not mounted. Redis broker state is in the
volume (`paperless_redis_data`). `paperless_redis_data` named volume.
## Installation ## Installation

View file

@ -51,17 +51,15 @@ services:
# `createsuperuser` manually instead). # `createsuperuser` manually instead).
PAPERLESS_ADMIN_USER: "{{PAPERLESS_ADMIN_USER:-}}" PAPERLESS_ADMIN_USER: "{{PAPERLESS_ADMIN_USER:-}}"
PAPERLESS_ADMIN_PASSWORD: "{{PAPERLESS_ADMIN_PASSWORD:-}}" PAPERLESS_ADMIN_PASSWORD: "{{PAPERLESS_ADMIN_PASSWORD:-}}"
# Database, search index, and classifier live in the paperless_data named
# volume on local disk — SQLite over NFS risks lock/corruption issues.
# PAPERLESS_DATA_ROOT is the UNAS paperless_data share (bind-mounted into # PAPERLESS_DATA_ROOT is the UNAS paperless_data share (bind-mounted into
# the LXC) holding data/, media/, consume/, export/, and trash/. # the LXC) holding only the document dirs: media/, consume/, export/, and
# create_host_path: false refuses to start if the share is not mounted, # trash/. create_host_path: false refuses to start if the share is not
# instead of silently writing to an empty directory. # mounted, instead of silently writing to an empty directory.
volumes: volumes:
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro
- type: bind - paperless_data:/usr/src/paperless/data
source: {{PAPERLESS_DATA_ROOT}}/data
target: /usr/src/paperless/data
bind:
create_host_path: false
- type: bind - type: bind
source: {{PAPERLESS_DATA_ROOT}}/media source: {{PAPERLESS_DATA_ROOT}}/media
target: /usr/src/paperless/media target: /usr/src/paperless/media
@ -114,3 +112,4 @@ networks:
volumes: volumes:
paperless_redis_data: paperless_redis_data:
paperless_data: