the-paperless-project / paperless

Scan, index, and archive all of your paper documents
GNU General Public License v3.0
7.85k stars 499 forks source link

Did anyone get paperless installed via QNAP container station and docker #639

Open thimplicity opened 4 years ago

thimplicity commented 4 years ago

Hi, Not a real issue, but no ida where else to post this. So far I had no luck installing paperless on my QNAP through the container Station that supports docker. I am happy for any help!

Tooa commented 4 years ago

In order to help you, we need more information about the problem. Can you elaborate more on the trouble you have with installing paperless? Any logs?

thimplicity commented 4 years ago

Hi, thanks for your answer. I create a paperless container through the container station that is included in QNAP. I search for paperless and then create it from there. It asks me for a command and an entry point, but I have not found any in the instructions or on google, so I left them empty. It then downloads the image and installs it and runs it. I thought this might be enough to run it in the browser with IP:8000, but unfortunately that is not valid at this point. At a certain point the docker is just stopped.

The console provides this:

`Operations to perform:
Apply all migrations: admin, auth, contenttypes, documents, reminders, sessions
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying auth.0009_alter_user_last_name_max_length... OK
Applying documents.0001_initial... OK
Applying documents.0002_auto_20151226_1316... OK
Applying documents.0003_sender... OK
Applying documents.0004_auto_20160114_1844... OK
Applying documents.0005_auto_20160123_0313... OK
Applying documents.0006_auto_20160123_0430... OK
Applying documents.0007_auto_20160126_2114... OK
Applying documents.0008_document_file_type... OK
Applying documents.0009_auto_20160214_0040... OK
Applying documents.0010_log... OK
Applying documents.0011_auto_20160303_1929... OK
Applying documents.0012_auto_20160305_0040... OK
Applying documents.0013_auto_20160325_2111... OK
Applying documents.0014_document_checksum... OK
Applying documents.0015_add_insensitive_to_match... OK
Applying documents.0016_auto_20170325_1558... OK
Applying documents.0017_auto_20170512_0507... OK
Applying documents.0018_auto_20170715_1712... OK
Applying documents.0019_add_consumer_user... OK
Applying documents.0020_document_added... OK
Applying documents.0021_document_storage_type... OK
Applying documents.0022_auto_20181007_1420... OK
Applying reminders.0001_initial... OK
Applying reminders.0002_auto_20181007_1420... OK
Applying sessions.0001_initial... OK

Type 'manage.py help ' for help on a specific subcommand.

Available subcommands:

[auth]
changepassword
createsuperuser

[contenttypes]
remove_stale_contenttypes

[django]
check
compilemessages
createcachetable
dbshell
diffsettings
dumpdata
flush
inspectdb
loaddata
makemessages
makemigrations
migrate
sendtestemail
shell
showmigrations
sqlflush
sqlmigrate
sqlsequencereset
squashmigrations
startapp
startproject
test
testserver

[django_extensions]
admin_generator
clean_pyc
clear_cache
compile_pyc
create_command
create_jobs
create_template_tags
delete_squashed_migrations
describe_form
drop_test_database
dumpscript
export_emails
find_template
generate_password
generate_secret_key
graph_models
mail_debug
merge_model_instances
notes
passwd
pipchecker
print_settings
print_user_for_session
reset_db
reset_schema
runjob
runjobs
runprofileserver
runscript
runserver_plus
set_default_site
set_fake_emails
set_fake_passwords
shell_plus
show_template_tags
show_templatetags
show_urls
sqlcreate
sqldiff
sqldsn
sync_s3
syncdata
unreferenced_files
update_permissions
validate_templates

[documents]
change_storage_type
document_consumer
document_correspondents
document_exporter
document_importer
document_logs
document_retagger
loaddata_stdin

[rest_framework]
generateschema

[sessions]
clearsessions

[staticfiles]
collectstatic
findstatic
runserver`

Sblop commented 4 years ago

Hi, I suggest you install using the CLI. SSH into the qnap and run the appropriate docker commands. Doing this directly from the container station, I believe is impossible.

thimplicity commented 4 years ago

Thanks, will need to find out what the respective commands are.

ictIntdev commented 4 years ago

I did install it on a QNAP as a container. I did it with CLI / SSH and followed the "docker" install instructions. It's looks like it's working now except I don't see any documents.... The application is consuming them, but then they are disappeared....

tanderson1992 commented 4 years ago

@thimplicity I'm working through this myself and am finding Container Station probably isn't the best route. The text you saw in your May 3 comment is probably because like me, you left the "command" blank when setting up the container. Container Station automatically saved that as --help, and the container obliges by displaying the help text and then quitting. I've tried replacing the command with "document_consumer," which runs the document_consumer script but not the webserver or other parts of Paperless required to use the system.

It seems like Paperless possibly can be installed from the Container Station, but the problem is knowing how to translate the CLI instructions to appropriate Container Station settings. For example, as far as I can tell the Container Station's Environment setting can replace docker-compose.env. After that, I'm lost. CS's "Create Application" is looking for a .yml file, and I'm wondering if the docker-compose.yml.example can be modified and pasted here for a successful install.

Sblop commented 4 years ago

Hi all,

Using paperless on Qnap is sooo dificult using container station. I would recommend you login to your nas using putty or another terminal viewer.

In your home folder (this is the default folder when you login) create a start.sh file and a paperless.yml file. Also make the folder Paperless and Docker, as your data folders.

In the start file use this code:

#!/bin/bash
echo "Start composer sequense..."
sleep 1
echo "Create network QNET"
docker network create --driver=qnet --attachable --ipam-driver=qnet --ipam-opt=iface=eth1 --subnet 10.0.0.0/24 --gateway 10.0.0.1 docker_qnet
echo "Create network FRONTEND"
docker network create --driver=bridge --subnet 10.0.15.0/24 docker_frontend
echo "Create network BACKEND"
docker network create --driver=bridge --subnet 10.0.13.0/24 docker_backend

echo "Start paperless sequense"
docker-compose -f paperless.yml pull
docker-compose -p paperless -f paperless.yml up --no-start
echo "End paperless sequense..."

echo "begin starting paperless!"
docker-compose -p paperless -f paperless.yml up -d

echo "Clean up"
docker volume prune -f
docker image prune -f

echo "All done!"

This code creates the proper network, download the images, and finally starts the images. The "paperless sequense" parts can actually be omitted, but in my setup, I download all the various containers before it starts at the end.

To start this, add the following to paperless.yml

version: '3.7'
services:

#Paperless

  paperlesswebserver:
    image: thepaperlessproject/paperless:latest
    container_name: paperlesswebserver    
    command: runserver --insecure --noreload 0.0.0.0:8050
    restart: unless-stopped
    environment:
      - TZ=Europe/Copenhagen
      - PAPERLESS_OCR_LANGUAGES=
      - PAPERLESS_DISABLE_LOGIN=false
      - PAPERLESS_INLINE_DOC=true
      - PAPERLESS_LIST_PER_PAGE=100
      - PAPERLESS_RECENT_CORRESPONDENT_YEARS=5
      - PAPERLESS_EXPORT_DIR=/export
    network_mode: host
    volumes:
      - "/share/Paperless/export:/export"
      - "/share/Docker/paperless:/usr/src/paperless/data" 
      - "/share/Paperless/media:/usr/src/paperless/media" 
      - "/share/Paperless/consume:/consume" 
      - "/etc/localtime:/etc/localtime:ro" 

    paperlessdocconsumer:
    image: thepaperlessproject/paperless:latest
    container_name: paperlessdocconsumer    
    command: document_consumer
    restart: unless-stopped
    environment:
      - TZ=Europe/Copenhagen
      - PAPERLESS_OCR_LANGUAGES=dan
      - PAPERLESS_DISABLE_LOGIN=false
      - PAPERLESS_INLINE_DOC=true
      - PAPERLESS_LIST_PER_PAGE=100
      - PAPERLESS_CONVERT_DENSITY=300
      - PAPERLESS_CONSUMER_LOOP_TIME=600
      - PAPERLESS_FORGIVING_OCR=true
      - PAPERLESS_CONVERT_MEMORY_LIMIT=32000000
      - PAPERLESS_EXPORT_DIR=/export
      - PAPERLESS_CONSUMPTION_DIR=/consume

    networks:
      docker_frontend: #due to email consumption
    hostname: paperlessdocconsumer
    volumes:
      - "/share/Paperless/export:/export"
      - "/share/Docker/paperless:/usr/src/paperless/data" 
      - "/share/Paperless/media:/usr/src/paperless/media" 
      - "/share/Paperless/consume:/consume" 
      - "/etc/localtime:/etc/localtime:ro"     
    depends_on:
      - paperlesswebserver

networks:
  docker_qnet:
    external: true 
  docker_frontend:
    external: true 
  docker_backend:
    external: true 

This is my setup. The reason for the script file, is that I have more than 30 containers starting, so it is much easier to maintain a .sh file with all my containers. Then I am certain to create everything the same, everytime it start it.

Really I was unable to get this working properly untill I switched to the command line mode.

If you require the consumer to grap emails directly, then add these lines:

    #  - PAPERLESS_CONSUME_MAIL_HOST=mail.server.com 
   #   - PAPERLESS_CONSUME_MAIL_PORT=993
    #  - PAPERLESS_CONSUME_MAIL_USER=login mail
  #    - PAPERLESS_CONSUME_MAIL_PASS=password
   #   - PAPERLESS_CONSUME_MAIL_INBOX=INBOX
 #     - PAPERLESS_EMAIL_SECRET=text that must be in email

Edits: due to formating etc.