[GH-ISSUE #75] Manual Installation Issue on Ubuntu 20.04 LTS #57

Closed
opened 2026-02-25 21:31:06 +03:00 by kerem · 15 comments
Owner

Originally created by @ciur on GitHub (Aug 19, 2020).
Original GitHub issue: https://github.com/ciur/papermerge/issues/75

Originally assigned to: @ciur on GitHub.

Got feedback on reddit:

I would prefer the manual installation route due to filesystem ease of access, but attempting the install on a clean image of Ubuntu 20.04 results in error after error (python/python3/pip/pip3 related issues, pdftk errors, django errors, /etc/papermerge.conf.py access errors, 'pip wheel' needs installed to fix a bdist_wheel error, & more).

And even after working through all of those the process of starting the worker throws an error saying that debug settings are being used and to never use those in prod as it leads to a memory leak and I've got no idea how to fix that.

Lastly, I then don't know what the best route to make those processes auto-start at server boot would be.

Originally created by @ciur on GitHub (Aug 19, 2020). Original GitHub issue: https://github.com/ciur/papermerge/issues/75 Originally assigned to: @ciur on GitHub. Got [feedback on reddit:](https://www.reddit.com/r/selfhosted/comments/ibwuj2/papermerge_14_out/g22o04e?utm_source=share&utm_medium=web2x) > > I would prefer the manual installation route due to filesystem ease of access, but attempting the install on a clean image of Ubuntu 20.04 results in error after error (python/python3/pip/pip3 related issues, pdftk errors, django errors, /etc/papermerge.conf.py access errors, 'pip wheel' needs installed to fix a bdist_wheel error, & more). > > And even after working through all of those the process of starting the worker throws an error saying that debug settings are being used and to never use those in prod as it leads to a memory leak and I've got no idea how to fix that. > > Lastly, I then don't know what the best route to make those processes auto-start at server boot would be.
kerem 2026-02-25 21:31:06 +03:00
Author
Owner

@ciur commented on GitHub (Aug 19, 2020):

I will even record a screencast on this topic!

<!-- gh-comment-id:675876076 --> @ciur commented on GitHub (Aug 19, 2020): I will even record a screencast on this topic!
Author
Owner

@dohlin commented on GitHub (Aug 20, 2020):

Sorry for the late reply, and thanks for taking the feedback...hopefully it didn't sound rude I certainly didn't mean it that way :)

Also to be honest, when I posted the feedback I had already deleted the VM I had spun up (in no small part because I had run so many different trial & error commands during my install & troubleshooting that things just had started to feel really "messy" and disorganized)

That being said, I'd be happy to to test any updated directions and contribute any refinements. Thank you!

<!-- gh-comment-id:676963870 --> @dohlin commented on GitHub (Aug 20, 2020): Sorry for the late reply, and thanks for taking the feedback...hopefully it didn't sound rude I certainly didn't mean it that way :) Also to be honest, when I posted the feedback I had already deleted the VM I had spun up (in no small part because I had run so many different trial & error commands during my install & troubleshooting that things just had started to feel really "messy" and disorganized) That being said, I'd be happy to to test any updated directions and contribute any refinements. Thank you!
Author
Owner

@Pyromane commented on GitHub (Aug 20, 2020):

I am available for tests!
I use Ubuntu 20.04 in LXC containers.

<!-- gh-comment-id:677856768 --> @Pyromane commented on GitHub (Aug 20, 2020): I am available for tests! I use Ubuntu 20.04 in LXC containers.
Author
Owner

@ciur commented on GitHub (Aug 21, 2020):

Great! I am very happy that there are people ready to help!
Documentation updates follows...

<!-- gh-comment-id:678049156 --> @ciur commented on GitHub (Aug 21, 2020): Great! I am very happy that there are people ready to help! Documentation updates follows...
Author
Owner

@ciur commented on GitHub (Aug 21, 2020):

I created a pull request where I keep pushing documentation updates for manual installation for Ubuntu 20.04 LTS

<!-- gh-comment-id:678270940 --> @ciur commented on GitHub (Aug 21, 2020): I created a [pull request](https://github.com/ciur/papermerge/pull/92) where I keep pushing documentation updates for manual installation for Ubuntu 20.04 LTS
Author
Owner

@ciur commented on GitHub (Aug 21, 2020):

Hi guys @Pyromane, @dohlin

I updated manual way part of documentation.
That guide is split into two parts - short version with gist of commands and long version with sort of step by step walk-through.
It is based on fresh installation of Ubuntu 20.04 LTS.

When you have time, maybe you can go through it and test if I didn't miss something. Also, I am sure I made a great deal of typos. I will be infinitely grateful if you'll correct typos/wrong parts.

Thank you !

<!-- gh-comment-id:678369182 --> @ciur commented on GitHub (Aug 21, 2020): Hi guys @Pyromane, @dohlin I updated [manual way part of documentation](https://papermerge.readthedocs.io/en/latest/setup/manual_way.html). That guide is split into two parts - short version with gist of commands and long version with sort of step by step walk-through. It is based on fresh installation of Ubuntu 20.04 LTS. When you have time, maybe you can go through it and test if I didn't miss something. Also, I am sure I made a great deal of typos. I will be infinitely grateful if you'll correct typos/wrong parts. Thank you !
Author
Owner

@dohlin commented on GitHub (Aug 22, 2020):

@ciur Thanks for the super speedy updates. I spun up a new VM (it's based on a template I have, but it's a stock image of 20.04 with nothing special really done to it). Going through the updated documentation it's MASSIVELY improved. I've gotten to the beginning of step 3, and I've encountered 2 things so far (and the first is super minor, simply grammer/format):

  1. Under 'Step 1' - the line that includes "there might be either pip or pip3 - later is specifically for python version 3":
    Not sure if you meant to include "pip" in the formatting like "pip3" is or not, and also it should say "latter" not "later" : )

  2. Under 'Step 3' - I'm encountering the following errors: https://imgur.com/a/h02GFW9
    I can fix the pdftk by exiting the venv (sudo su [username] - not sure if this is required or not), running 'sudo apt install pdftk', and re-activating the venv, but not sure how to fix the other errors as convert/identify/tesseract don't find any valid packages. There's also the piece about the config file - which I'd be ok just leaving the defaults for now, but it's a little confusing to me why lines such as "DBDIR" don't have a 'default' option - they aren't commented out by default.

What am I missing? Let me know and I'll continue working through the guide. Thanks!

<!-- gh-comment-id:678570805 --> @dohlin commented on GitHub (Aug 22, 2020): @ciur Thanks for the super speedy updates. I spun up a new VM (it's based on a template I have, but it's a stock image of 20.04 with nothing special really done to it). Going through the updated documentation it's _**MASSIVELY**_ improved. I've gotten to the beginning of step 3, and I've encountered 2 things so far (and the first is super minor, simply grammer/format): 1. Under 'Step 1' - the line that includes "there might be either pip or pip3 - later is specifically for python version 3": Not sure if you meant to include "pip" in the formatting like "pip3" is or not, and also it should say "latter" not "later" : ) 2. Under 'Step 3' - I'm encountering the following errors: https://imgur.com/a/h02GFW9 I can fix the pdftk by exiting the venv (sudo su [username] - not sure if this is required or not), running 'sudo apt install pdftk', and re-activating the venv, but not sure how to fix the other errors as convert/identify/tesseract don't find any valid packages. There's also the piece about the config file - which I'd be ok just leaving the defaults for now, but it's a little confusing to me why lines such as "DBDIR" don't have a 'default' option - they aren't commented out by default. What am I missing? Let me know and I'll continue working through the guide. Thanks!
Author
Owner

@ciur commented on GitHub (Aug 22, 2020):

Under 'Step 3' - I'm encountering the following errors:

Those are warning which are dealt with little bit later (like 2 paragraphs down below, by installing Ubuntu packages like imagemagick and poppler-utils etc). I fixed the typo (thanks for that !) I added a note saying that warnings should be ignored for ./manage.py migrate step as they are deal with later (./manage.py check)

There's also the piece about the config file - which I'd be ok just leaving the defaults for now, but it's a little confusing to me why > lines such as "DBDIR" don't have a 'default' option - they aren't commented out by default.

They have! You have a good point. I commented out all values in papermerge.conf.py, because indeed - every value has a default. In same documentation I mention that papermerge.conf.py can be left empty (just to make sure that admin/user is aware of configuration file).

Thank you for your great feedback!

<!-- gh-comment-id:678605379 --> @ciur commented on GitHub (Aug 22, 2020): > Under 'Step 3' - I'm encountering the following errors: Those are warning which are dealt with little bit later (like 2 paragraphs down below, by installing Ubuntu packages like imagemagick and poppler-utils etc). I fixed the typo (thanks for that !) I added a note saying that _warnings should be ignored for ./manage.py migrate step as they are deal with later (./manage.py check)_ > > There's also the piece about the config file - which I'd be ok just leaving the defaults for now, but it's a little confusing to me why > lines such as "DBDIR" don't have a 'default' option - they aren't commented out by default. > They have! You have a good point. I commented out all values in papermerge.conf.py, because indeed - every value has a default. In same documentation [I mention that papermerge.conf.py can be left empty](https://papermerge.readthedocs.io/en/latest/setup/manual_way.html#step-6-configurations) (just to make sure that admin/user is aware of configuration file). Thank you for your great feedback!
Author
Owner

@dohlin commented on GitHub (Aug 23, 2020):

Awesome, thanks for those updates, and sorry for not reading further before posting - I just didn't want to feel like my install was 'dirtied' by adding potentially unnecessary stuff like last time so I just said hold up and posted haha

I've finished the documentation and only have 2 further questions:

  1. How does one make it so that the server binds to 0.0.0.0 rather than 127.0.0.1 (so the web UI is accessible from other PC's in the LAN)

and 2. How does one make it so that the main app and the worker both start automatically after system reboot? It would be a little tedious to have to log in and manually open terminal windows to run both of them after any reboot.

Otherwise I think the manual documentation looks really really good now! Thanks!!

EDITS: Noticed there is a syntax error under Step 5 - 3rd line in the first code box should say " ./manage.py worker" instead of " ./manage worker".

Also - I'm still getting these 2 memory leak warnings when running the worker: https://imgur.com/a/il66qdH
Is this expected or anything to be concerned about? Thanks!

<!-- gh-comment-id:678718858 --> @dohlin commented on GitHub (Aug 23, 2020): Awesome, thanks for those updates, and sorry for not reading further before posting - I just didn't want to feel like my install was 'dirtied' by adding potentially unnecessary stuff like last time so I just said hold up and posted haha I've finished the documentation and only have 2 further questions: 1. How does one make it so that the server binds to 0.0.0.0 rather than 127.0.0.1 (so the web UI is accessible from other PC's in the LAN) and 2. How does one make it so that the main app and the worker both start automatically after system reboot? It would be a little tedious to have to log in and manually open terminal windows to run both of them after any reboot. Otherwise I think the manual documentation looks really really good now! Thanks!! **EDITS:** Noticed there is a syntax error under Step 5 - 3rd line in the first code box should say "$ ./manage.py worker" instead of "$ ./manage worker". Also - I'm still getting these 2 memory leak warnings when running the worker: https://imgur.com/a/il66qdH Is this expected or anything to be concerned about? Thanks!
Author
Owner

@mtonnie commented on GitHub (Aug 23, 2020):

@dohlin

  1. You can use use gunicorn to serve the app, for detail how I use it for Synology packed have a look here.

  2. Probably a simple start stop script or a service depend on your Linux version / distribution.

<!-- gh-comment-id:678741948 --> @mtonnie commented on GitHub (Aug 23, 2020): @dohlin 1. You can use use gunicorn to serve the app, for detail how I use it for Synology packed have a look [here](https://github.com/mtonnie/spksrc/blob/spk-papermerge/spk/papermerge/src/service-setup.sh#L14). 2. Probably a simple start stop script or a service depend on your Linux version / distribution.
Author
Owner

@dohlin commented on GitHub (Aug 23, 2020):

@dohlin

  1. You can use use gunicorn to serve the app, for detail how I use it for Synology packed have a look here.
  2. Probably a simple start stop script or a service depend on your Linux version / distribution.

I'm using Ubuntu 20.04...I might have a similar setup on another VM for auto-start functionality, not sure but I'll do some digging on that.

And I don't fully get the gunicorn bit, but I'll do some digging on that too. Thanks

<!-- gh-comment-id:678796578 --> @dohlin commented on GitHub (Aug 23, 2020): > @dohlin > > 1. You can use use gunicorn to serve the app, for detail how I use it for Synology packed have a look [here](https://github.com/mtonnie/spksrc/blob/spk-papermerge/spk/papermerge/src/service-setup.sh#L14). > 2. Probably a simple start stop script or a service depend on your Linux version / distribution. I'm using Ubuntu 20.04...I might have a similar setup on another VM for auto-start functionality, not sure but I'll do some digging on that. And I don't fully get the gunicorn bit, but I'll do some digging on that too. Thanks
Author
Owner

@ciur commented on GitHub (Aug 24, 2020):

Also - I'm still getting these 2 memory leak warnings when running the worker: https://imgur.com/a/il66qdH
Is this expected or anything to be concerned about? Thanks!

Those warning are issued because you run Papermerge in DEBUG mode. As long as you run it from you own computer (or only for home networks - that is from 100% safe environment) and only "in manual way" - means you start application with ./manage.py runserver + ./manage.py worker command there is nothing to be concerned about.

DEBUG mode means that during an exception all stacktrace with all environment variables, paths etc will be printed on the screen - this is a big problem if you run application "in the wild" (in wild wild Internet :))) )

How does one make it so that the server binds to 0.0.0.0 rather than 127.0.0.1 (so the web UI is accessible from other PC's in the LAN)

Use runserver command:

$ ./manage.py runserver 0.0.0.0:8090

It will bind application on IP 0.0.0.0 on port 8090. Obviously you can use any other port greater than 1024. Port 8090 is just a random example.

  1. How does one make it so that the main app and the worker both start automatically after system reboot?

This is part of next documentation ticket I am going to work on.

Otherwise I think this ticket is good to be closed.
@dohlin, what do you think?

Ah, @dohlin, completely unrelated, but still I think useful tip:
Instead of uploading images to imgur.com and copy/paste url here, you can drag and drop directly images directly in this edit box. It is confusing because editor does not have "upload image" button... but still it supports drag and drop. I found out that myself couple of days ago.

<!-- gh-comment-id:678922216 --> @ciur commented on GitHub (Aug 24, 2020): > Also - I'm still getting these 2 memory leak warnings when running the worker: https://imgur.com/a/il66qdH > Is this expected or anything to be concerned about? Thanks! Those warning are issued because you run Papermerge in DEBUG mode. As long as you run it from you own computer (or only for home networks - that is from 100% safe environment) and only "in manual way" - means you start application with ``./manage.py runserver`` + ``./manage.py worker`` command there is nothing to be concerned about. DEBUG mode means that during an exception all stacktrace with all environment variables, paths etc will be printed on the screen - this is a big problem if you run application "in the wild" (in wild wild Internet :))) ) > > How does one make it so that the server binds to 0.0.0.0 rather than 127.0.0.1 (so the web UI is accessible from other PC's in the LAN) > Use runserver command: > $ ./manage.py runserver 0.0.0.0:8090 It will bind application on IP 0.0.0.0 on port 8090. Obviously you can use any other port greater than 1024. Port 8090 is just a random example. > 2. How does one make it so that the main app and the worker both start automatically after system reboot? This is part of [next documentation ticket I am going to work on](https://github.com/ciur/papermerge/issues/96). Otherwise I think this ticket is good to be closed. @dohlin, what do you think? Ah, @dohlin, completely unrelated, but still I think useful tip: Instead of uploading images to imgur.com and copy/paste url here, you can drag and drop directly images directly in this edit box. It is confusing because editor does not have "upload image" button... but still it supports drag and drop. I found out that myself couple of days ago.
Author
Owner

@dohlin commented on GitHub (Aug 24, 2020):

Ah, @dohlin, completely unrelated, but still I think useful tip:
Instead of uploading images to imgur.com and copy/paste url here, you can drag and drop directly images directly in this edit box. It is confusing because editor does not have "upload image" button... but still it supports drag and drop. I found out that myself couple of days ago.

Good to know, thanks for that heads up!

$ ./manage.py runserver 0.0.0.0:8090

It will bind application on IP 0.0.0.0 on port 8090. Obviously you can use any other port greater than 1024. Port 8090 is just a random example.

Probably wouldn't hurt to add this to the manual docs, but this answers my question!

Those warning are issued because you run Papermerge in DEBUG mode. As long as you run it from you own computer (or only for home networks - that is from 100% safe environment) and only "in manual way" - means you start application with ./manage.py runserver + ./manage.py worker command there is nothing to be concerned about.

DEBUG mode means that during an exception all stacktrace with all environment variables, paths etc will be printed on the screen - this is a big problem if you run application "in the wild" (in wild wild Internet :))) )

Otherwise I think this ticket is good to be closed.
@dohlin, what do you think?

Not like I'm going to be exposing this to the internet lol, but just for my knowledge is there a way to run it in PROD mode? Or is DEBUG mode just how the project is run in its current state?

Otherwise yes - ok to close and I'll keep watching that 'auto start' documentation ticket. Thanks again!

EDIT: I think I resolved my non-debug question myself by changing "DEBUG = True" to "DEBUG = False" in [PapermergeDMS root]\config\settings\dev.py

<!-- gh-comment-id:679180336 --> @dohlin commented on GitHub (Aug 24, 2020): > Ah, @dohlin, completely unrelated, but still I think useful tip: > Instead of uploading images to imgur.com and copy/paste url here, you can drag and drop directly images directly in this edit box. It is confusing because editor does not have "upload image" button... but still it supports drag and drop. I found out that myself couple of days ago. Good to know, thanks for that heads up! > > $ ./manage.py runserver 0.0.0.0:8090 > > It will bind application on IP 0.0.0.0 on port 8090. Obviously you can use any other port greater than 1024. Port 8090 is just a random example. Probably wouldn't hurt to add this to the manual docs, but this answers my question! > Those warning are issued because you run Papermerge in DEBUG mode. As long as you run it from you own computer (or only for home networks - that is from 100% safe environment) and only "in manual way" - means you start application with `./manage.py runserver` + `./manage.py worker` command there is nothing to be concerned about. > > DEBUG mode means that during an exception all stacktrace with all environment variables, paths etc will be printed on the screen - this is a big problem if you run application "in the wild" (in wild wild Internet :))) ) > Otherwise I think this ticket is good to be closed. > @dohlin, what do you think? Not like I'm going to be exposing this to the internet lol, but just for my knowledge is there a way to run it in PROD mode? Or is DEBUG mode just how the project is run in its current state? Otherwise yes - ok to close and I'll keep watching that 'auto start' documentation ticket. Thanks again! **EDIT:** I think I resolved my non-debug question myself by changing "DEBUG = True" to "DEBUG = False" in [PapermergeDMS root]\config\settings\dev.py
Author
Owner

@ciur commented on GitHub (Aug 24, 2020):

I think I resolved my non-debug question myself by changing "DEBUG = True" to "DEBUG = False" in [PapermergeDMS root]\config\settings\dev.py

@dohlin, correct !
Thank you very much for great feedback + ticket!

<!-- gh-comment-id:679231979 --> @ciur commented on GitHub (Aug 24, 2020): > I think I resolved my non-debug question myself by changing "DEBUG = True" to "DEBUG = False" in [PapermergeDMS root]\config\settings\dev.py @dohlin, correct ! Thank you very much for great feedback + ticket!
Author
Owner

@Pyromane commented on GitHub (Aug 25, 2020):

Wow, that's a great guide!
I followed detailed version and this one worked perfectly.

<!-- gh-comment-id:680318918 --> @Pyromane commented on GitHub (Aug 25, 2020): Wow, that's a great guide! I followed detailed version and this one worked perfectly.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/papermerge#57
No description provided.