jonaswinkler / paperless-ng

A supercharged version of paperless: scan, index and archive all your physical documents
https://paperless-ng.readthedocs.io/en/latest/
GNU General Public License v3.0
5.37k stars 355 forks source link

Logging in for the first time stuck on "Loading..." #158

Closed Sup3rlativ3 closed 3 years ago

Sup3rlativ3 commented 3 years ago

So after deploying with docker-compose and then running docker-compose run --rm webserver createsuperuser and then trying to log in with the user created from the above command, I find that the page gets stuck on "Loading..." regardless on the browser (tried chrome, firefox and the new chrome edge)

I have checked the "Troubleshooting" page on RTD.

I've had a look at the docker logs for the paperless webserver but I don't see any errors.

192.168.1.118 - - [19/Dec/2020:21:41:46 +1100] "GET /accounts/login/?next=/ HTTP/1.1" 200 1725 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4346.0 Safari/537.36 Edg/89.0.731.0"

192.168.1.118 - - [19/Dec/2020:21:41:46 +1100] "GET /static/signin.css HTTP/1.1" 200 0 "http://192.168.1.111:8000/accounts/login/?next=/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4346.0 Safari/537.36 Edg/89.0.731.0"

192.168.1.118 - - [19/Dec/2020:21:41:46 +1100] "GET /static/bootstrap.min.css HTTP/1.1" 200 0 "http://192.168.1.111:8000/accounts/login/?next=/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4346.0 Safari/537.36 Edg/89.0.731.0"

192.168.1.118 - - [19/Dec/2020:21:41:46 +1100] "GET /static/frontend/assets/logo.svg HTTP/1.1" 302 0 "http://192.168.1.111:8000/accounts/login/?next=/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4346.0 Safari/537.36 Edg/89.0.731.0"

192.168.1.118 - - [19/Dec/2020:21:41:47 +1100] "GET /accounts/login/?next=/static/frontend/assets/logo.svg HTTP/1.1" 200 1725 "http://192.168.1.111:8000/accounts/login/?next=/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4346.0 Safari/537.36 Edg/89.0.731.0"

192.168.1.118 - - [19/Dec/2020:21:41:47 +1100] "GET /favicon.ico HTTP/1.1" 200 111014 "http://192.168.1.111:8000/accounts/login/?next=/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4346.0 Safari/537.36 Edg/89.0.731.0"

192.168.1.118 - - [19/Dec/2020:21:41:59 +1100] "POST /accounts/login/?next=/ HTTP/1.1" 302 0 "http://192.168.1.111:8000/accounts/login/?next=/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4346.0 Safari/537.36 Edg/89.0.731.0"

192.168.1.118 - - [19/Dec/2020:21:41:59 +1100] "GET / HTTP/1.1" 200 544 "http://192.168.1.111:8000/accounts/login/?next=/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4346.0 Safari/537.36 Edg/89.0.731.0"

192.168.1.118 - - [19/Dec/2020:21:41:59 +1100] "GET /static/frontend/styles.css HTTP/1.1" 200 544 "http://192.168.1.111:8000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4346.0 Safari/537.36 Edg/89.0.731.0"

192.168.1.118 - - [19/Dec/2020:21:41:59 +1100] "GET /static/frontend/runtime.js HTTP/1.1" 200 544 "http://192.168.1.111:8000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4346.0 Safari/537.36 Edg/89.0.731.0"

192.168.1.118 - - [19/Dec/2020:21:41:59 +1100] "GET /static/frontend/polyfills.js HTTP/1.1" 200 544 "http://192.168.1.111:8000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4346.0 Safari/537.36 Edg/89.0.731.0"

192.168.1.118 - - [19/Dec/2020:21:41:59 +1100] "GET /static/frontend/main.js HTTP/1.1" 200 544 "http://192.168.1.111:8000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4346.0 Safari/537.36 Edg/89.0.731.0"

127.0.0.1 - - [19/Dec/2020:21:42:02 +1100] "GET / HTTP/1.1" 302 0 "-" "curl/7.64.0"

I must be missing something obvious so I would be happy to be pointed in the right direction.

Sup3rlativ3 commented 3 years ago

I can see that there is action happening in the backend as if I put a document into the watch folder it gets processed almost instantly.

127.0.0.1 - - [19/Dec/2020:21:47:36 +1100] "GET / HTTP/1.1" 302 0 "-" "curl/7.64.0" 127.0.0.1 - - [19/Dec/2020:21:48:06 +1100] "GET / HTTP/1.1" 302 0 "-" "curl/7.64.0" 21:48:32 [Q] INFO Enqueued 1 21:48:32 [Q] INFO Process-1:1 processing [Emillie.pdf] INFO 2020-12-19 21:48:33,856 loggers Consuming Emillie.pdf INFO 2020-12-19 21:48:35,076 pdfdocument xref found: pos=b'15561941' INFO 2020-12-19 21:48:35,077 pdfdocument read_xref_from: start=15561941, token=/b'xref' INFO 2020-12-19 21:48:35,079 pdfdocument xref objects: {1: (None, 15561857, 0), 2: (None, 15561701, 0), 3: (None, 36, 0), 4: (None, 244, 0), 5: (None, 1910, 0), 6: (None, 1946, 0), 7: (None, 25896, 0), 8: (None, 1532214, 0), 9: (None, 1532237, 0), 10: (None, 1532263, 0), 11: (None, 1532373, 0), 12: (None, 1532592, 0), 13: (None, 3195365, 0), 14: (None, 3195389, 0), 15: (None, 3195416, 0), 16: (None, 3195526, 0), 17: (None, 3195746, 0), 18: (None, 4145879, 0), 19: (None, 4145903, 0), 20: (None, 4145929, 0), 21: (None, 4146039, 0), 22: (None, 4146259, 0), 23: (None, 5104067, 0), 24: (None, 5104091, 0), 25: (None, 5104117, 0), 26: (None, 5104227, 0), 27: (None, 5104447, 0), 28: (None, 6277790, 0), 29: (None, 6277814, 0), 30: (None, 6277841, 0), 31: (None, 6277951, 0), 32: (None, 6278171, 0), 33: (None, 7200952, 0), 34: (None, 7200976, 0), 35: (None, 7201002, 0), 36: (None, 7201112, 0), 37: (None, 7201332, 0), 38: (None, 8333812, 0), 39: (None, 8333836, 0), 40: (None, 8333863, 0), 41: (None, 8333973, 0), 42: (None, 8334193, 0), 43: (None, 9991742, 0), 44: (None, 9991766, 0), 45: (None, 9991793, 0), 46: (None, 9991903, 0), 47: (None, 9992123, 0), 48: (None, 11554878, 0), 49: (None, 11554902, 0), 50: (None, 11554929, 0), 51: (None, 11555039, 0), 52: (None, 11555259, 0), 53: (None, 12836922, 0), 54: (None, 12836946, 0), 55: (None, 12836973, 0), 56: (None, 12837083, 0), 57: (None, 12837303, 0), 58: (None, 14133041, 0), 59: (None, 14133065, 0), 60: (None, 14133092, 0), 61: (None, 14133202, 0), 62: (None, 14133422, 0), 63: (None, 15561320, 0), 64: (None, 15561344, 0), 65: (None, 15561371, 0), 66: (None, 15561481, 0)} INFO 2020-12-19 21:48:35,081 pdfdocument trailer: {'Size': 67, 'Root': <PDFObjRef:1>, 'Info': <PDFObjRef:3>, 'ID': [b'\xde\xd8\xce\xda\xa8Gc>\xedM\x7f\xf4\xb7L\x8dp', b'\xde\xd8\xce\xda\xa8Gc>\xedM\x7f\xf4\xb7L\x8dp']} 127.0.0.1 - - [19/Dec/2020:21:48:36 +1100] "GET / HTTP/1.1" 302 0 "-" "curl/7.64.0" INFO 2020-12-19 21:48:41,941 pdfdocument trailer: {'Size': 67, 'Root': <PDFObjRef:1>, 'Info': <PDFObjRef:3>, 'ID': [b'\xde\xd8\xce\xda\xa8Gc>\xedM\x7f\xf4\xb7L\x8dp', b'\xde\xd8\xce\xda\xa8Gc>\xedM\x7f\xf4\xb7L\x8dp']}

jonaswinkler commented 3 years ago

Hello!

Could you please try and open http://192.168.1.111:8000/static/frontend/styles.css in your browser and see where that takes you? It should display some text file that starts like this:

@charset "UTF-8";
/*!
 * Bootstrap v4.5.2 (https://getbootstrap.com/)
Sup3rlativ3 commented 3 years ago

I just get the "Loading..." displayed. I tried opening an incognito window and got the same error.

I checked the browser console and got the following

Refused to apply style from 'http://192.168.1.111:8000/static/frontend/styles.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled. styles.css:1 Refused to execute script from 'http://192.168.1.111:8000/static/frontend/runtime.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled. styles.css:1 Refused to execute script from 'http://192.168.1.111:8000/static/frontend/polyfills.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled. styles.css:1 Refused to execute script from 'http://192.168.1.111:8000/static/frontend/main.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

Sup3rlativ3 commented 3 years ago

The page source is:

<html lang="en">
<head>
  <meta charset="utf-8">
  <title>PaperlessUi</title>
  <base href="/">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="/static/frontend/styles.css"></head>
<body>
  <app-root>Loading...</app-root>
    <script src="/static/frontend/runtime.js" defer></script>
    <script src="/static/frontend/polyfills.js" defer></script>
    <script src="/static/frontend/main.js" defer></script>
</body>
</html>
jonaswinkler commented 3 years ago

After logging in and getting to the "Loading..." page, could you try to open http://l192.168.1.111:8000/admin/ and see if that displays anything meaningful (A page that allows you to see and edit various things in paperless)?

Sup3rlativ3 commented 3 years ago

Yes, that gives me a page

image

jonaswinkler commented 3 years ago

Any non-standard configuration options used?

Sup3rlativ3 commented 3 years ago

Looking in the logs I see there are some errors when it's trying to consume documents about directories that dont exist

The following error occured while consuming Emillie.pdf: [Errno 13] Permission denied: '/usr/src/paperless/src/../consume/Emillie.pdf'

I tried creating the folder /usr/src/paperless (EDIT: on the host because I'm a numpty) but that doesn't seem to help.

The only thing I changed was the consumption directory. I have a mount that my scanner will directly put files.

Sup3rlativ3 commented 3 years ago

I have checked the container and can confirm that folder and file exists.

jonaswinkler commented 3 years ago

Regarding the loading... issue:

Could you further confirm that, inside the container, there are files in /usr/src/paperless/static/frontend/, and which files there are?

Regarding Permission denied:

In order for paperless to be able to read and write to/from the consumption directory on your host, the ID of the user running paperless inside the container has to be the same as the ID of the user owning the consumption directory on the host.

On a shell on your host, run id to get the ID of your user, and if your uid or gid is anything but 1000, you have to edit the docker-compose.env file to reflect that.

Sup3rlativ3 commented 3 years ago

There is no frontend folder inside the container.

root@af18761b6a27:/usr/src/paperless/static# ls -l
total 164
drwxr-xr-x 1 paperless paperless     51 Dec 19 10:03 admin
-rw-r--r-- 1 paperless paperless 160392 Dec 19 10:03 bootstrap.min.css
drwxr-xr-x 1 paperless paperless     38 Dec 19 10:03 django_extensions
drwxr-xr-x 1 paperless paperless     17 Dec 19 10:03 paperless
drwxr-xr-x 1 paperless paperless     63 Dec 19 10:03 rest_framework
-rw-r--r-- 1 paperless paperless    766 Dec 19 10:03 signin.css
root@af18761b6a27:/usr/src/paperless/static#

I have already confirmed that the uid matches (1000) as per the setup instructions.

[sup3rlativ3@localhost src]$ id
uid=1000(sup3rlativ3) gid=1000(sup3rlativ3) groups=1000(sup3rlativ3),10(wheel),992(docker)
[sup3rlativ3@localhost src]$

I found the problem was that the mount was owned by root rather than my user. Changing my fstab so that my user was the owner rather than root solved the issue. I found I also had to restart the paperless_webserver container for the changes to take effect.

jonaswinkler commented 3 years ago

How exactly did you install paperless? All images published on the hub come with that folder.

Sup3rlativ3 commented 3 years ago

I wonder if I've done something wrong when I created the container. Here are the exact steps I did.

git clone https://github.com/jonaswinkler/paperless-ng
cd paperless-ng
touch requirements.txt
nano requirements.txt
    dateparser==0.7.6
    django==3.1.3
    django-cors-headers
    django-extensions
    django-filter==2.4.0
    django-q==1.3.4
    djangorestframework==3.12.2
    filelock
    fuzzywuzzy
    gunicorn
    imap-tools
    langdetect
    pdftotext
    pathvalidate
    pillow
    pikepdf
    python-gnupg
    python-dotenv
    python-dateutil
    python-Levenshtein
    python-magic
    psycopg2-binary
    redis
    scikit-learn==0.23.2
    whitenoise==5.2.0
    watchdog
    whoosh==2.7.4
    inotifyrecursive==0.3.4
    ocrmypdf
    tqdm

cp docker/local/docker-compose.postgres.yml docker-compose.yml
nano docker-compose.yml
    /scans:/usr/src/paperless/consume

cp docker/docker-compose.env .
nano docker-compose.env
    PAPERLESS_TIME_ZONE=Australia/Sydney
    PAPERLESS_OCR_LANGUAGE=eng

cp docker/local/Dockerfile .
docker-compose up -d
jonaswinkler commented 3 years ago

Please use the release archive. The front end needs to be compiled and put into a folder where the backend expects it. There's also a scripts/make-release.sh script that assembles the image, but that's really only for me to publish images on the hub.

jonaswinkler commented 3 years ago

I case you're wondering: I agree that the current method for distributing paperless isn't optimal, but it's working.

Sup3rlativ3 commented 3 years ago

Thank you, that worked.