paperless icon indicating copy to clipboard operation
paperless copied to clipboard

Synology: Container stopped unexpectedly

Open torbengb opened this issue 6 years ago • 19 comments

I'm trying to get Paperless to run on my DS916+ and I though I did everything right and the container starts ... and after ~30 seconds it just terminates. --> How can I troubleshoot this?

Here is a listing of the terminal output: pastebin.com

Steps to reproduce:

  • using Synology DS916+
  • using Synology app "Docker" > section "Registry" > search for "paperless" and download "thepaperlessproject/paperless".
  • app "Docker" > section "Images" > image "thepaperlessproject:paperless" > button "Launch" > button "Advanced settings" > tab "Volume" > button "Add Folder" > (see below) > tab "Environment" > button "+" > (see below)
  • Launch the container
  • app "Docker" > section "Container" > my new image > button "Details" > tab "Terminal" > it is outputting lots of text, and suddenly stops > see pastebin.com
  • Synology raises a notification: "system event: Docker container paperless-20191020-gui stopped unexpectedly"
  • last log lines read:
    [staticfiles]
    collectstatic
    findstatic

Volumes:

  • /path/to/consume = /consume
  • /path/to/data = /data
  • /path/to/media = /media
  • /path/to/data = /export

Environment:

  • PAPERLESS_OCR_LANGUAGES = deu dan eng

torbengb avatar Oct 20 '19 21:10 torbengb

Just a hunch: did you set the command for the container to run? By default the container doesn't actually do anything. To change it you export the configuration for the container, modify the cmd entry and then import the settings again.

For the consumer it should read: "cmd" : "document_consumer",

For the webserver: "cmd" : "gunicorn -b 0.0.0.0:8000",

ddddavidmartin avatar Oct 20 '19 22:10 ddddavidmartin

Thank you; I didn't have those commands. I added them and now the container stays running - but it's not reachable. I feel like I'm one step closer, but I can't see what the next hurdle actually is?

What I did, and what I get:

  1. In the Synology Docker app, I exported the configuration to a JSON file.
  2. I added two "cmd" lines to the JSON file: pastebin.com.
    I hope it's allowed to have 2 "cmd" lines?

{ "cap_add" : null, "cap_drop" : null, "cmd" : "document_consumer", "cmd" : "gunicorn -b 0.0.0.0:8000", "cpu_priority" : 50, "devices" : null, ... etc. ...

  1. In the Synology Docker app, I imported the edited configuration as a new container and started it. It is running: screenshot
  2. Type the Synology's IP address with port 8000 but there is no response: screenshot

I had the same result if I used "127.0.0.1", and when I tried the actual IP "192.168.1.11" it said "invalid address".

torbengb avatar Oct 21 '19 07:10 torbengb

You should bind the container port 8000 to a local port can be the same: 8000.

sbrunner avatar Oct 21 '19 07:10 sbrunner

Hey, that did the trick! Thank you! Now I see the login screen but I haven't been asked for a user. Is there a default username&password? I didn't see one specified on readthedocs.io.

If there isn't, how do I add a user?

torbengb avatar Oct 21 '19 13:10 torbengb

You should set the PAPERLESS_PASSPHRASE or PAPERLESS_DISABLE_LOGIN=true environment variable :-)

sbrunner avatar Oct 21 '19 14:10 sbrunner

Aaand - I'm in! :-) I don't need a password on my home network anyway.

Can you also help me figure out why it's not taking any PDF's from the mapped "/consume" directory? Here is my updated JSON file.


I promise to write up some step-by-step instructions for future Paperless users on Synology.

torbengb avatar Oct 21 '19 15:10 torbengb

Here you create a container for the web server, you should create an other container for the consumer. You can copy your current container and change the command to be document_consumer.

sbrunner avatar Oct 22 '19 07:10 sbrunner

create an other container for the consumer

Wow, that's a revelation!! I had no idea; I don't think that's mentioned anywhere in the documentation - have I overlooked it? Anyway, I will test this when I get home.

torbengb avatar Oct 22 '19 12:10 torbengb

Fantastic! That worked -- sort of :-)

  • as per this comment I had to adjust the access permissions of my mapped directories (maybe only the mapped "consume" directory but I applied the same to all mapped paths just to err on the safe side). I'll add the keys "USER_ID" and "GROUP_ID" to the JSON files (once for the consume and same for the web front-end).
  • With these permissions, my test PDF files have been consumed from my mapped "consume" directory.
  • But they didn't show up in the web front-end, nor in my mapped "media" or "data" directories.
  • Admittedly they didn't follow the naming conventions, but something like "manual.pdf" should still be accepted.

Here is the processing log: pastebin.com

-- Where did the PDFs get consumed to? Where can I see them?

torbengb avatar Oct 22 '19 19:10 torbengb

Admittedly they didn't follow the naming conventions, but something like "manual.pdf" should still be accepted.

That's right, the naming convention only matters if you want Paperless to parse dates, correspondent and so on from the file name itself.

I'm wondering whether your bindings in the container config are not quite right yet. It took me ages to work it out as it is not obvious at all how it is meant to be. This is what it looks like in my settings:

   "volume_bindings" : [
      {
         "host_volume_file" : "/Paperless/media",
         "mount_point" : "/usr/src/paperless/media",
         "type" : "rw"
      },
      {
         "host_volume_file" : "/Paperless/data",
         "mount_point" : "/usr/src/paperless/data",
         "type" : "rw"
      }
   ]

For me Paperless/data and Paperless/media sit at /volume1/Paperless/data and /volume1/Paperless/media in the NAS filesystem respectively.

Note how the mount_points are set to /usr/src/paperless/. I'm thinking Paperless might expect that for the Docker container. In your case I would try this:

   "volume_bindings" : [
      {
         "host_volume_file" : "/billund/docker/paperless-20191021/media",
         "mount_point" : "/usr/src/paperless/media",
         "type" : "rw"
      },
      {
         "host_volume_file" : "/billund/docker/paperless-20191021/export",
         "mount_point" : "/export",
         "type" : "rw"
      },
      {
         "host_volume_file" : "/billund/docker/paperless-20191021/data",
         "mount_point" : "/usr/src/paperless/data",
         "type" : "rw"
      },
      {
         "host_volume_file" : "/billund/docker/paperless-20191021/consume",
         "mount_point" : "/consume",
         "type" : "rw"
      }

Maybe that will work.

ddddavidmartin avatar Oct 30 '19 08:10 ddddavidmartin

I have attached my configs as well in case it helps. paperless-consumer.json.txt paperless-webserver.json.txt

ddddavidmartin avatar Oct 30 '19 08:10 ddddavidmartin

@torbengb I promise to write up some step-by-step instructions for future Paperless users on Synology.

Catching you by your words there, any chance of the tutorial write-up for the rest of us on Synology? I read this whole thread and it confused me quite a bit. Tutorial would be definitely appreciated!

No pressure wink wink :)

AllienWorks avatar Dec 02 '19 15:12 AllienWorks

Great that you keep me to my word! Unfortunately I have not yet been able to make it work...! It does consume the input PDF files but they are not output anywhere. I wonder where they go. Haven't had time to look into this for a while, but I still want to get this working. And THEN I WILL post a write-up.

On Mon, Dec 2, 2019 at 4:40 PM Martin Allien [email protected] wrote:

@torbengb https://github.com/torbengb I promise to write up some step-by-step instructions for future Paperless users on Synology.

Catching you by your words there, any chance of the tutorial write-up for the rest of us on Synology? I read this whole thread and it confused me quite a bit. Tutorial would be definitely appreciated!

No pressure wink wink :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/the-paperless-project/paperless/issues/573?email_source=notifications&email_token=AAGF4XRHSQWF7QBHWHALH7LQWUT6HA5CNFSM4JCWFQ7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFT4XHQ#issuecomment-560450462, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGF4XQRR477LBDPCYYYOA3QWUT6HANCNFSM4JCWFQ7A .

-- Mit freundlichen Grüßen | Med venlig hilsen | Best Regards Torben Gundtofte-Bruun, M.Sc. +43-650-495-3929 | [email protected] | http://torben.g-b.dk | Jägersteig 15 | 2100 Korneuburg | Austria

torbengb avatar Dec 02 '19 18:12 torbengb

Just a hunch: did you set the command for the container to run? By default the container doesn't actually do anything. To change it you export the configuration for the container, modify the cmd entry and then import the settings again.

For the consumer it should read: "cmd" : "document_consumer",

For the webserver: "cmd" : "gunicorn -b 0.0.0.0:8000",

Hi, I was wondering: to use Paperless via docker on Synology, you will end up with two containers running, right? One for the consumer, one for the webserver. There is no way to have both in one container?

mikkelnl avatar Dec 04 '19 16:12 mikkelnl

to use Paperless via docker on Synology, you will end up with two containers running, right? One for the consumer, one for the webserver. There is no way to have both in one container?

That is correct. It doesn't seem to affect resource usage much though. See for example both idling on my end:

containers

ddddavidmartin avatar Dec 05 '19 06:12 ddddavidmartin

Right now I'm trying to setup the latest paperless container on my synology NAS and ... I fail. Reading this issue leads me to believe, that the docker install descibed in the docks has nothing to do with the docker container provided on the docker hub.

Changing the cmd to gunicorn -b 0.0.0.0:8000 stops the container with Unknown command: 'gunicorn'.

And the config files from @ddddavidmartin point to another docker repository as the official one. So how can I get this thing running my NAS?

Any help is apreciated.

hrvylein avatar Apr 12 '20 16:04 hrvylein

@hrvylein I ended up changing the command to /usr/bin/gunicron -b 0.0.0.0:8000 paperless.wsgi and it finally worked for me.

chainsawsalad avatar May 16 '20 23:05 chainsawsalad

@hrvylein just wanted to follow up one more time to elaborate on the premise of this issue. I ended up changing the command entirely to runserver 0.0.0.0:8000. I don't think it is intended to call gunicorn directly.

I also ran into #248, so I changed the command one additional time to runserver --insecure 0.0.0.0:8000. But if you're using SSL, you probably wouldn't need to do that.

chainsawsalad avatar May 16 '20 23:05 chainsawsalad

@chainsawsalad thank you. I could fix the issue myself after I came up with the problem. Unfortunately paperless wasn't too stable on my side and is really lacking most of the basic features I think a EDMS should have. I then switched over to https://github.com/sismics/docs which works the moment you fire the container up, is rock solid and offers a RESTful API over which I added hundreds of documents in seconds and the project is mantained.

hrvylein avatar May 17 '20 18:05 hrvylein