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

[BUG] error when starting Docker #1675

Open jaydhary14 opened 2 years ago

jaydhary14 commented 2 years ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Webserver logs

-- Logging error ---
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/concurrent_log_handler/__init__.py", line 330, in emit
    self._do_lock()
  File "/usr/local/lib/python3.9/site-packages/concurrent_log_handler/__init__.py", line 407, in _do_lock
    self._open_lockfile()
  File "/usr/local/lib/python3.9/site-packages/concurrent_log_handler/__init__.py", line 253, in _open_lockfile
    self.stream_lock = open(lock_file, "wb", buffering=0)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/src/paperless/data/log/.__paperless.lock'
Call stack:
  File "/usr/src/paperless/src/manage.py", line 11, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/usr/src/paperless/src/documents/management/commands/document_consumer.py", line 167, in handle
    self.handle_inotify(directory, recursive)
  File "/usr/src/paperless/src/documents/management/commands/document_consumer.py", line 189, in handle_inotify
    logger.info(
  File "/usr/local/lib/python3.9/logging/__init__.py", line 1446, in info
    self._log(INFO, msg, args, **kwargs)
  File "/usr/local/lib/python3.9/logging/__init__.py", line 1589, in _log
    self.handle(record)
  File "/usr/local/lib/python3.9/logging/__init__.py", line 1599, in handle
    self.callHandlers(record)
  File "/usr/local/lib/python3.9/logging/__init__.py", line 1661, in callHandlers
    hdlr.handle(record)
  File "/usr/local/lib/python3.9/logging/__init__.py", line 952, in handle
    self.emit(record)
  File "/usr/local/lib/python3.9/site-packages/concurrent_log_handler/__init__.py", line 346, in emit
    self.handleError(record)
Message: 'Using inotify to watch directory for changes: /usr/src/paperless/src/../consume'
Arguments: ()
If available, post any logs from the web server related to your issue.

Relevant information

docker-compose.yml

 - version: "3.4"
services:
  webserver:
    image: jonaswinkler/paperless-ng:latest
    restart: unless-stopped
    ports:
      - 8010:8000
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8000"]
      interval: 30s
      timeout: 10s
      retries: 5
    volumes:
      - type: bind
        source: /media/shared/paperless/data
        target: /usr/src/paperless/data
      - type: bind
        source: /media/shared/paperless/media
        target: /usr/src/paperless/media
      - type: bind
        source: /media/shared/paperless/export
        target: /usr/src/paperless/export
      - type: bind
        source: /media/shared/paperless/incoming
        target: /usr/src/paperless/consume
    environment:
      PAPERLESS_REDIS: redis://192.xxx.x.xx:6379
      PAPERLESS_DBHOST: 192.xxx.x.xx

  tika:
    image: apache/tika:1.27
    restart: unless-stopped

  gotenberg:
    image: thecodingmachine/gotenberg
    restart: unless-stopped
    environment:
      DISABLE_GOOGLE_CHROME: 1

# The UID and GID of the user used to run paperless in the container. Set this
# to your UID and GID on the host so that you have write access to the
# consumption directory.
      USERMAP_UID: 1000
      USERMAP_GID: 1000
# Additional languages to install for text recognition, separated by a
# whitespace. Note that this is
# different from PAPERLESS_OCR_LANGUAGE (default=eng), which defines the
# language used for OCR.
# The container installs English, German, Italian, Spanish and French by
# default.
# See https://packages.debian.org/search?keywords=tesseract-ocr-&searchon=names&suite=buster
# for available languages.
      #PAPERLESS_OCR_LANGUAGES: tur ces
# Adjust this key if you plan to make paperless available publicly. It should
# be a very long sequence of random characters. You don't need to remember it.
      #PAPERLESS_SECRET_KEY: change-me
# Use this variable to set a timezone for the Paperless Docker containers. If not specified, defaults to UTC.
      PAPERLESS_TIME_ZONE: America/Chicago
# The default language to use for OCR. Set this to the language most of your
# documents are written in.
      PAPERLESS_OCR_LANGUAGE: eng
      PAPERLESS_TIKA_ENABLED: 1
      PAPERLESS_TIKA_GOTENBERG_ENDPOINT: http://gotenberg:3000
      PAPERLESS_TIKA_ENDPOINT: http://tika:9998
      PAPERLESS_FILENAME_FORMAT: "{correspondent}/{correspondent} {created_year}-{created_month}-{title}"
      PAPERLESS_CONSUMER_POLLING: 60
      PAPERLESS_CONSUMER_DELETE_DUPLICATES: 1

volumes:
  data:
  media:
nedy13 commented 2 years ago

I think you have already seen the message: FileNotFoundError: [Errno 2] No such file or directory: '/usr/src/paperless/data/log/.__paperless.lock'

I could think of two things right now. I really don't know now if Docker creates a folder "data" and "media".According to Docker documentation, with a bind-mount, the directory structure must be there.

Source: https://docs.docker.com/storage/bind-mounts/

The file or directory does not need to exist on the Docker host already (this sentence is for volumes not bind mounts). It is created on demand if it does not yet exist. Bind mounts are very performant, but they rely on the host machine’s filesystem having a specific directory structure available. If you are developing new Docker applications, consider using named volumes instead. You can’t use Docker CLI commands to directly manage bind mounts.

The second problem I see is the samba mount that is underneath. The mount user has permissions to write? I think you have already tried a simple touch /usr/src/paperless/data/log/.__paperless.lock?