truenas / charts

TrueNAS SCALE Apps Catalogs & Charts
BSD 3-Clause "New" or "Revised" License
306 stars 293 forks source link

Paperless-ngx with postgres 16 Database #2227

Closed haldi4803 closed 6 months ago

haldi4803 commented 8 months ago

Hello,

i wanted to migrate all my data from my previous system to TrueNas. So i've setup the app according the same settings as on the old system.

Everything seemed to work fine:

Related Kubernetes Events
2024-02-26 15:03:39
Container image "postgres:15.2" already present on machine
2024-02-26 15:03:39
Created container paperless-ngx-init-03-postgres-wait
2024-02-26 15:03:39
Started container paperless-ngx-init-03-postgres-wait
2024-02-26 15:03:14
Back-off restarting failed container paperless-ngx in pod paperless-ngx-postgres-56dfbdbffc-tg5wv_ix-paperless-ngx(100f3627-22e2-46b0-8f13-f3daca45eca3)
2024-02-26 15:03:09
Container image "postgres:15.2" already present on machine
2024-02-26 15:03:03
Successfully pulled image "postgres:15.2" in 2.93942603s (2.939430449s including waiting)
2024-02-26 15:03:03
Created container paperless-ngx
2024-02-26 15:03:03
Started container paperless-ngx
2024-02-26 15:03:00
Pulling image "postgres:15.2"
2024-02-26 15:03:00
Container image "bitnami/redis:7.0.11" already present on machine
2024-02-26 15:03:00
Created container paperless-ngx-init-02-redis-wait
2024-02-26 15:03:00
Started container paperless-ngx-init-02-redis-wait
2024-02-26 15:02:58
Started container paperless-ngx
2024-02-26 15:02:58
Add eth0 [172.16.1.113/16] from ix-net
2024-02-26 15:02:58
Add eth0 [172.16.1.114/16] from ix-net
2024-02-26 15:02:58
Container image "bash:4.4.23" already present on machine
2024-02-26 15:02:58
Container image "bash:4.4.23" already present on machine
2024-02-26 15:02:58
Created container paperless-ngx-install-permissions
2024-02-26 15:02:58
Created container paperless-ngx-install-01-permissions
2024-02-26 15:02:58
Started container paperless-ngx-install-permissions
2024-02-26 15:02:58
Started container paperless-ngx-install-01-permissions
2024-02-26 15:02:57
Scaled up replica set paperless-ngx-redis-f655f58cb to 1
2024-02-26 15:02:57
Scaled up replica set paperless-ngx-postgres-56dfbdbffc to 1
2024-02-26 15:02:57
Scaled up replica set paperless-ngx-54f497b8f7 to 1
2024-02-26 15:02:57
Created pod: paperless-ngx-postgres-56dfbdbffc-tg5wv
2024-02-26 15:02:57
Created pod: paperless-ngx-redis-f655f58cb-ldcpx
2024-02-26 15:02:57
Successfully assigned ix-paperless-ngx/paperless-ngx-redis-f655f58cb-ldcpx to ix-truenas
2024-02-26 15:02:57
Created pod: paperless-ngx-54f497b8f7-dw79p
2024-02-26 15:02:57
Successfully assigned ix-paperless-ngx/paperless-ngx-54f497b8f7-dw79p to ix-truenas
2024-02-26 15:02:57
Successfully assigned ix-paperless-ngx/paperless-ngx-postgres-56dfbdbffc-tg5wv to ix-truenas
2024-02-26 15:02:57
Add eth0 [172.16.1.112/16] from ix-net
2024-02-26 15:02:57
Container image "bitnami/redis:7.0.11" already present on machine
2024-02-26 15:02:57
Created container paperless-ngx

but didn't start at all, thats when i checked the log from the postgres container and found this:

2024-02-26 15:04:37.751733+01:002024-02-26T15:04:37.751733327+01:00
2024-02-26 15:04:37.751754+01:00PostgreSQL Database directory appears to contain a database; Skipping initialization
2024-02-26 15:04:37.751760+01:002024-02-26T15:04:37.751760689+01:00
2024-02-26 15:04:37.758140+01:002024-02-26 14:04:37.758 UTC [1] FATAL:  database files are incompatible with server
2024-02-26 15:04:37.758156+01:002024-02-26 14:04:37.758 UTC [1] DETAIL:  The data directory was initialized by PostgreSQL version 16, which is not compatible with this version 15.2 (Debian 15.2-1.pgdg110+1).

Is there any way i can switch the psotgres:15.2 to version 16 ?

pabloeisenhut commented 8 months ago

You can create a dump of your database and then upload it to the database backup directory. Then start the container and import the dump using the postgres container shell. You can also try importing the database from the Truenas Scale apps catalog using the pgadmin tool.

I hope I could help. Please let me know :)

stavros-k commented 8 months ago

Hello, currently there isn't an easy way to persistently change the version. I'll have to look into that, but will be probably in a bigger change/context (eg upgrades etc)

What @pabloeisenhut said should work fine for now!

haldi4803 commented 6 months ago

Installed Docker on windows, moved all files over, started a working instance, used the document_exporter. Installed Paperless-ngx on TrueNAS, moved exported files over, ran document_importer. Everything works as before.