BenoitAnastay / paperless-home-assistant-addon

Paperless Home Assistant Addon
MIT License
31 stars 6 forks source link

Migrating to your addon from a different addon on HAOS #116

Closed Valve90210 closed 3 months ago

Valve90210 commented 3 months ago

Hi

I've been pointed in the direction of your Paperless-ngx addon, as I am currently using a different one (link) which is being deprecated. This is currently on a box running HAOS, so is what I believe is a bare metal install.

I have the best part of 500 documents currently added to my instance and I've really rather like to avoid having to start over with adding them.

I tried copying my database files and media etc into the new folder for your add on, and when I started the addon, all my files were listed with all their tags etc. However none of the thumbnails or original files would display as the addon couldn't find them. Are you able to give any guidance on how I can migrate from the other addon into yours?

I've seen mention of The Exporter but I have no idea how I go about using that?

In addition, I'd like to know if it's possible to mount a shared folder on a NAS box for the files to be stored on, I thought I done this in the current addon I'm using but it seems like all I've actually done is created a new folder within the Media folder for the addon.

Any help you can give would be much appreciated.

Thanks

BenoitAnastay commented 3 months ago

@alexbelgium moves all directories to addon_config folder but for my addon media and consume folders goes into /share/paperless directory.

I'll maybe add a migration script for people who just copy past addon_config folder contents

Valve90210 commented 3 months ago

Ah I see, that makes sense and should be easy enough.

Is there anyway I can mount a folder on one of NAS boxes for my media to be stored in? I don't have a huge drive in the thin client I run HAOS, so if this was possible that would be great.

BenoitAnastay commented 3 months ago

Is there anyway I can mount a folder on one of NAS boxes

It's why I use share folder, it let you mount a share named papeless handled by HAOS

Open your Home Assistant instance and show storage information. NAS

Valve90210 commented 3 months ago

I see, that makes sense (I think)

Can I just run through how I think I set it up to see if I've understood properly

1) I create the share called paperless on my NAS

2) Add the network share within HAOS

3) Install your addon

4) Copy my existing database files etc into your addon folder and my existing media from the other addon into the media folder within the Share>paperless folder in HAOS?

I'm guessing then I need to do something in your addon to get it to store things on the mounted network share?

Sorry for being so dumb, it's all bit confusing as I'm not really used to this sort of stuff.

Thanks

BenoitAnastay commented 3 months ago

I'm guessing then I need to do something in your addon to get it to store things

You'll just have to enable pooling for consume folder because inotify doesn't work on shared folders

Everything else should work fine

Valve90210 commented 3 months ago

Probably me being dumb, but I have no idea what that means?

I've done the rest of the setup as above but am getting a 502 bad gateway error when trying to load the webUI and am getting the below error in the log:

ERRORS

?: PAPERLESS_CONSUMPTION_DIR is not writeable
    HINT: Set the permissions of 
drwxr-xr-x root root /share/paperless/consume
 to be writeable by the user running the Paperless services
?: PAPERLESS_MEDIA_ROOT is not writeable
    HINT: Set the permissions of 
drwxr-xr-x root root /share/paperless/media
 to be writeable by the user running the Paperless services

I've not got a user or password set on the samba share on my NAS, and the folder permissions are set to allow all users to read/write.

I think HAOS is able to write to the folder because when I installed your add on it created the Consume and Media folders in the paperless folder I'd created in Share by adding the network folder

BenoitAnastay commented 3 months ago

Within the container paperless is run in userspace.

There is a chown prior paperless running, but maybe your share is ignoring this.

chown -R paperless:paperless /share/paperless

On your setup the ACL is set for only root write access

Can you give me more informations on your share host and its configuration ? (so I can figure out what's the best way to fix the error)

Valve90210 commented 3 months ago

Erm I don't know a huge amount about the NAS and it's config, as it's all done from within it's own software, it's a Drobo 5N. Shares are simply setup by clicking add Share, giving it a name and selecting the permissions, which for the share for paperless are set to read/write for admin, everyone and guests.

Would this also be what is giving me the bad gateway error?

BenoitAnastay commented 3 months ago

It seems that your NAS do not handle ACL correctly.

I'll add an option to run paperless as root

Valve90210 commented 3 months ago

Awesome cheers.

kolossboss commented 3 months ago

Hi, I'm running into the same issue. I had no permission problems with Paperless Addon from alexbelgium. I mounted the network drive with home assistant to share/paperless. And now got this issues.

ERRORS:
?: PAPERLESS_CONSUMPTION_DIR is not writeable
    HINT: Set the permissions of 
drwxr-xr-x root root /share/paperless/consume
 to be writeable by the user running the Paperless services
?: PAPERLESS_MEDIA_ROOT is not writeable
    HINT: Set the permissions of 
drwxr-xr-x root root /share/paperless/media
 to be writeable by the user running the Paperless services

how to run this addon as root?

I added

PGID: 1000
PUID: 1000

to the configuration but its also not working :-(

Valve90210 commented 3 months ago

When I originally added this addon, I could open the webUI without any issues. Then I tried copying the database files etc into the addon folder which worked to add my tags etc etc, and the only issue was the lack of my documents and thumbnails which I now know was due to the different media folder location.

Having added network shares into the shares folder and getting the permissions errors mentioned above. For some reason I now can't get into the webUI, I just get a 502 Bad Gateway error and I don't really know what to do about it?

BenoitAnastay commented 3 months ago

PGID: 1000 PUID: 1000

This is only on the last edge release, I had issues with virtualisation on my desktop computer thus I wasn't able to do testing.

But you're free to check the edge version of the add-on https://github.com/BenoitAnastay/home-assistant-addons-repository-edge

For some reason I now can't get into the webUI, I just get a 502 Bad Gateway error and I don't really know what to do about it?

Check the logs

kolossboss commented 3 months ago

PGID: 1000 PUID: 1000

This is only on the last edge release, I had issues with virtualisation on my desktop computer thus I wasn't able to do testing.

But you're free to check the edge version of the add-on https://github.com/BenoitAnastay/home-assistant-addons-repository-edge

Hi, with the Edge Version and PGID 0 and PUID 0 I get no permission errors. The Paperless start fine and I can Login. But my old config and documents and Tags are not there.

My old configuration looks like this.

networkdisks: //192.168.2.2/Daten/PaperlessNX/
PAPERLESS_MEDIA_ROOT: /mnt/PaperlessNX/Dokumente
PAPERLESS_DATA_DIR: /mnt/PaperlessNX/Data
PAPERLESS_CONSUMPTION_DIR: /mnt/PaperlessNX/Consumption
PAPERLESS_CONSUMER_POLLING: 5

and with your addon I mounted via HA

Bildschirm­foto 2024-03-10 um 20 24 17

Sorry I did not complete understand the migration process....

BenoitAnastay commented 3 months ago

Data folder go into addon_config/repo_paperless folder

Valve90210 commented 3 months ago

For some reason I now can't get into the webUI, I just get a 502 Bad Gateway error and I don't really know what to do about it?

Check the logs

Here is my log from your addon:

ERRORS:
?: PAPERLESS_CONSUMPTION_DIR is not writeable
    HINT: Set the permissions of 
drwxr-xr-x root root /share/paperless/consume
 to be writeable by the user running the Paperless services
?: PAPERLESS_MEDIA_ROOT is not writeable
    HINT: Set the permissions of 
drwxr-xr-x root root /share/paperless/media
 to be writeable by the user running the Paperless services

System check identified 2 issues (0 silenced).
Paperless-ngx docker container starting...
Installing languages...
Hit:1 http://deb.debian.org/debian bookworm InRelease
Hit:2 http://deb.debian.org/debian bookworm-updates InRelease
Hit:3 http://deb.debian.org/debian-security bookworm-security InRelease
Reading package lists...
Package tesseract-ocr-eng already installed!
Package tesseract-ocr-deu already installed!
Package tesseract-ocr-fra already installed!
Package tesseract-ocr-ita already installed!
Package tesseract-ocr-spa already installed!
Creating directory scratch directory /tmp/paperless
Adjusting permissions of paperless files. This may take a while.
Waiting for Redis...
Connected to Redis broker.
Apply database migrations...
Operations to perform:
  Apply all migrations: account, admin, auth, authtoken, contenttypes, django_celery_results, documents, guardian, paperless, paperless_mail, sessions, socialaccount
Running migrations:
  No migrations to apply.
Running Django checks
SystemCheckError: System check identified some issues:

ERRORS:
?: PAPERLESS_CONSUMPTION_DIR is not writeable
    HINT: Set the permissions of 
drwxr-xr-x root root /share/paperless/consume
 to be writeable by the user running the Paperless services
?: PAPERLESS_MEDIA_ROOT is not writeable
    HINT: Set the permissions of 
drwxr-xr-x root root /share/paperless/media
 to be writeable by the user running the Paperless services

System check identified 2 issues (0 silenced).
Paperless-ngx docker container starting...
Installing languages...
Hit:1 http://deb.debian.org/debian bookworm InRelease
Hit:2 http://deb.debian.org/debian bookworm-updates InRelease
Hit:3 http://deb.debian.org/debian-security bookworm-security InRelease
Reading package lists...
Package tesseract-ocr-eng already installed!
Package tesseract-ocr-deu already installed!
Package tesseract-ocr-fra already installed!
Package tesseract-ocr-ita already installed!
Package tesseract-ocr-spa already installed!
Creating directory scratch directory /tmp/paperless
Adjusting permissions of paperless files. This may take a while.
Waiting for Redis...
Connected to Redis broker.
Apply database migrations...
Operations to perform:
  Apply all migrations: account, admin, auth, authtoken, contenttypes, django_celery_results, documents, guardian, paperless, paperless_mail, sessions, socialaccount
Running migrations:
  No migrations to apply.
Running Django checks
SystemCheckError: System check identified some issues:

ERRORS:
?: PAPERLESS_CONSUMPTION_DIR is not writeable
    HINT: Set the permissions of 
drwxr-xr-x root root /share/paperless/consume
 to be writeable by the user running the Paperless services
?: PAPERLESS_MEDIA_ROOT is not writeable
    HINT: Set the permissions of 
drwxr-xr-x root root /share/paperless/media
 to be writeable by the user running the Paperless services

System check identified 2 issues (0 silenced).
Paperless-ngx docker container starting...
Installing languages...
Hit:1 http://deb.debian.org/debian bookworm InRelease
Hit:2 http://deb.debian.org/debian bookworm-updates InRelease
Hit:3 http://deb.debian.org/debian-security bookworm-security InRelease
Reading package lists...
Package tesseract-ocr-eng already installed!
Package tesseract-ocr-deu already installed!
Package tesseract-ocr-fra already installed!
Package tesseract-ocr-ita already installed!
Package tesseract-ocr-spa already installed!
Creating directory scratch directory /tmp/paperless
Adjusting permissions of paperless files. This may take a while.
Waiting for Redis...
Connected to Redis broker.
Apply database migrations...
Operations to perform:
  Apply all migrations: account, admin, auth, authtoken, contenttypes, django_celery_results, documents, guardian, paperless, paperless_mail, sessions, socialaccount
Running migrations:
  No migrations to apply.
Running Django checks

This seems to cycle over and over, so I'm guessing it's not properly starting and hence the 502 error?

kolossboss commented 3 months ago

Data folder go into addon_config/repo_paperless folder

Thanks a lot. For any reasons, during the migration process, the Data Folder an my NAS was empty. Thanks got I had a Backup on a second NAS!! Now everything is working with the edge version. Thanks a lot

@Valve90210 The UI is not starting because of the permission error. You can also try to use the "edge" Version and set PGID: 0and PUID: 0

Valve90210 commented 3 months ago

@Valve90210 The UI is not starting because of the permission error. You can also try to use the "edge" Version and set PGID: 0and PUID: 0

That's what I wondered. How do I use the 'edge' version?

kolossboss commented 3 months ago

Add this repo

https://github.com/BenoitAnastay/home-assistant-addons-repository-edge

Valve90210 commented 3 months ago

Thanks all. I had to remove the stable repository to be able to add the edge one for some reason but now I have managed to get the edge version of the addon installed, I've set PGID: 0 and PUID: 0 and it now starts, and I've managed to migrate everything from the old addon and have the new one up and running nicely. :)

BenoitAnastay commented 3 months ago

Thanks for you feedbacks it helps me with testing