Paperless-ngx backup and restore process

Hi,

I am currently running paperless-ngx on a separate machine as a docker-compose container. Backup and restore works like this:

$ cd /path/to/paperless
$ docker compose exec webserver <command> <arguments>

where command is either “document_exporter” or “document_importer” and argument is either the path where the backup is going to be stored or the zipfile containing the backup.
How can I do this within the truenas app? I have understood that truenas apps are launched via docker-compose, as in my stand-alone server. However, I would like to know where I can find the docker-compose yaml files within the truenas directory tree so that I can try to run the commands from there.
I am running truenas scale 24.10.1.
Thanks for any hint!

I had problems with apps with postges under TrueNAS, so I installed the dockge app an run immich, nextcloud and paperless under dockge, where I can easily edit my yml- and env-files.

The only think I miss is the update-notification for the apps.

Ok, the solution is easy.
Go to the apps page, and there to the tile named “Workload”. There you can access the paperless docker shell. Start the shell and start the backup/restore using the commands document_exporter / document importer directly.

Is there a way to backup the entire docker containers? I have tried this method, but it keeps the backup inside the container, I need to get the backup outside of the container itself, so either the Cloud Sync and get it on the TrueNAS Scale OR I can send to a Windows Share to be backed up off-site via 3rd party.

I have linked the export directory to a nfs share. From there I can move / copy the backup zip file to another storage facility.

I have paperless running under dockge, where can I find on my TrueNAS the path, where paperless is installed, so I can use the exporter:

sudo docker-compose exec webserver document_exporter [zielverzeichnis]

How can a backup (export) be done automatical?

Okay, got it, and run the exporter from the shell:
Get the container name:

docker ps | grep 'paperless'

Then run the exporter:

docker exec paperless-ngx-webserver-1 document_exporter ../export/ -z

Now this just needs to be run automaticly

You can run it as a cron job in TrueNAS (System → Advanced Settings → Cron Jobs)

Thanks, that’s what I did now.
Have just to firgue out now why the user and group changed.

When you ran this to export paperless you have …/export/ -z on the end. Where is this saved to?

I just tried it and cannot find the export ziped file.

You can find it in the folder “export” under the PATH_DATA_LOCATION off your paperless docker installation.
I have it under /mnt/diskpool-1/Apps_Data/paperless-ngx/export/

OK, it’s the root user.

Hi,

a manual backup with “sudo docker exec ix-paperless-ngx-paperless-1 document_exporter …/media/backup/ -z” works.

How can i ran it as a cron job. Which user i have to use?

The export did suceed but the export folder hasnt been generated. any ideas

truenas_admin@truenas[/mnt/ssd-pool/paperless/data]$ sudo docker exec ix-paperless-ngx-paperless-1 document_exporter ../export -z
100%|██████████| 274/274 [00:01<00:00, 228.32it/s]
truenas_admin@truenas[/mnt/ssd-pool/paperless/data]$ ll
total 221910
drwxrwx--- 4 apps         8 Sep  8 16:11 ./
drwxrwx--- 7 root         7 Jan 28  2025 ../
-rwxrwx--- 1 apps         2 Jan 28  2025 .index_version*
-rwxrwx--- 1 apps    524288 Sep  8 16:09 celerybeat-schedule.db*
-rwxrwx--- 1 apps 227149405 Sep  2 16:06 classification_model.pickle*
drwxrwx--- 2 apps         5 Sep  8 00:00 index/
drwxrwx--- 2 apps        28 Sep  7 20:00 log/
-rwxrwx--- 1 apps         0 Apr  1 16:05 migration_lock*

Did you added export under volumes in your yaml-file?

    volumes:
      - ${PATH_DATA_LOCATION}/data:/usr/src/paperless/data
      - ${PATH_DATA_LOCATION}/media:/usr/src/paperless/media
      - ${PATH_DATA_LOCATION}/export:/usr/src/paperless/export
      - ${PATH_DATA_LOCATION}/consume:/usr/src/paperless/consume

i guess not. set up per default via truenas, so no export created. what yaml file is this specifically?

I hab problems with my DB with the TrueNAS app, so I set it up via dockge.
I used the yamls from paperless:

Here are the installation steps:
https://docs.paperless-ngx.com/setup/#docker

1 Like

Ok. Since this was setup via TrueNas and in the current version there is no exporter Path … i helped myself and redirected it temp. into another dataset (media) create a export folder assigned permissions. not nice but did work. will look into dockge once i tested a full restore

Hi, I am in the same position, with papaerless-ngx as a truenas app. Unfortunately I did not set up datasets, but the app uses the ixVolumes for Data, Media…
@MRi Can you explain what you did in more detail? I am relatively new to truenas and don’t want to mess up my paperless app since I already have it configured. I think it would have been better to create host paths for the media and data in the first place but since I have to figure out how to migrate from ixVolume to a host path, I want to save my data first

Best

Hi @fabianmuehlberger, i documented this for myself here: Paperless-ngx Backup and Restore – Infrastructure Blog its in german. let me know if this article helps you or if it needs more clarification.

Cheers

Hi and thank you for the guide. (I am Austrian btw, German isn’t a problem :wink:) When following, I have some questions about this part:
truenas[~]$ sudo mkdir /mnt/ssd-pool/paperless/media/export
truenas[~]$ sudo chown apps:apps /mnt/ssd-pool/paperless/media/export
truenas[~]$ sudo docker exec ix-paperless-ngx-paperless-1 document_exporter ../media/export

You state that we need a bind mount for paperless instead of the .ix volume, where do you actually change that bind? We only created the export folder in a dataset, but don’t we need to bind this to the destination inside the docker container?