[GH-ISSUE #96] How do you auto start or run as a service? #75

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

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

Hi

I can't find any documentation on how to auto-start or run this software as a service in my Ubuntu 20.04 LXC container (under proxmox).

Is there any information on this?

Regards
Jayden

Originally created by @lukyjay on GitHub (Aug 22, 2020). Original GitHub issue: https://github.com/ciur/papermerge/issues/96 Hi I can't find any documentation on how to auto-start or run this software as a service in my Ubuntu 20.04 LXC container (under proxmox). Is there any information on this? Regards Jayden
kerem 2026-02-25 21:31:08 +03:00
Author
Owner

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

Hi @lukyjay,

Are you looking for systemd unit files (or maybe deploy configs for nginx / apache) ?

<!-- gh-comment-id:678615353 --> @ciur commented on GitHub (Aug 22, 2020): Hi @lukyjay, Are you looking for systemd unit files (or maybe deploy configs for nginx / apache) ?
Author
Owner

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

Hi @ciur

Sorry for the poor explanation. I'll describe my problem below.

I have installed Papermerge via the 'short version' Documentation: https://papermerge.readthedocs.io/en/latest/setup/manual_way.html#short-version

To start papermerge I need to run two terminals with:
$ ./manage.py runserver <IP>:<PORT>
and
$ ./manage.py worker
But I did not know how to do this when the Proxmox LXC (container) starts.

I've managed to solve this by creating and enabling two service files:

papermerge-server.service:

[Unit]
Description=Papermerge Worker
After=network.target

[Service]
# Change and/or create the required user and group.
#User=jayden
#Group=jayden

ExecStart=/opt/papermerge/.venv/bin/python /opt/papermerge/manage.py worker

Type=simple
TimeoutStopSec=20
KillMode=process
Restart=on-failure
Requires=papermerge-server.service

[Install]
WantedBy=multi-user.target

papermerge-worker.service:

[Unit]
Description=Papermerge Server
After=network.target

[Service]
# Change and/or create the required user and group.
#User=jayden
#Group=jayden

ExecStart=/opt/papermerge/.venv/bin/python /opt/papermerge/manage.py runserver 192.168.1.26:8080

Type=simple
TimeoutStopSec=20
KillMode=process
Restart=on-failure

[Install]
WantedBy=multi-user.target

The documentation is a bit confusing since there are so many steps spanning multiple pages and it's not clear what you need to do to install this software within a debian/ubuntu server container. I hope the above information helps :)

<!-- gh-comment-id:678727380 --> @lukyjay commented on GitHub (Aug 23, 2020): Hi @ciur Sorry for the poor explanation. I'll describe my problem below. I have installed Papermerge via the 'short version' Documentation: https://papermerge.readthedocs.io/en/latest/setup/manual_way.html#short-version To start papermerge I need to run two terminals with: `$ ./manage.py runserver <IP>:<PORT> ` and `$ ./manage.py worker ` But I did not know how to do this when the Proxmox LXC (container) starts. I've managed to solve this by creating and enabling two service files: papermerge-server.service: ``` [Unit] Description=Papermerge Worker After=network.target [Service] # Change and/or create the required user and group. #User=jayden #Group=jayden ExecStart=/opt/papermerge/.venv/bin/python /opt/papermerge/manage.py worker Type=simple TimeoutStopSec=20 KillMode=process Restart=on-failure Requires=papermerge-server.service [Install] WantedBy=multi-user.target ``` papermerge-worker.service: ``` [Unit] Description=Papermerge Server After=network.target [Service] # Change and/or create the required user and group. #User=jayden #Group=jayden ExecStart=/opt/papermerge/.venv/bin/python /opt/papermerge/manage.py runserver 192.168.1.26:8080 Type=simple TimeoutStopSec=20 KillMode=process Restart=on-failure [Install] WantedBy=multi-user.target ``` The documentation is a bit confusing since there are so many steps spanning multiple pages and it's not clear what you need to do to install this software within a debian/ubuntu server container. I hope the above information helps :)
Author
Owner

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

@lukyjay, there is no documentation yet about how to configure as papermerge system service 😁

Do you mind if I use your systemd units as example (obviously I will rename user/group names) ?
I will expand with more details, but systemd units you provided here are very good starting point 👍

<!-- gh-comment-id:678757482 --> @ciur commented on GitHub (Aug 23, 2020): @lukyjay, there is no documentation yet about how to configure as papermerge system service :grin: Do you mind if I use your systemd units as example (obviously I will rename user/group names) ? I will expand with more details, but systemd units you provided here are very good starting point :+1:
Author
Owner

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

@lukyjay, there is no documentation yet about how to configure as papermerge system service 😁

Do you mind if I use your systemd units as example (obviously I will rename user/group names) ?
I will expand with more details, but systemd units you provided here are very good starting point 👍

Of course! I just edited a Sonarr service file to make these.

It'd be great if one command could manage both the worker and the webserver. This would be easier for service files, bash scripts, application health monitoring, etc. I tried to write a bash script for this but I couldn't get it to work (never used python venv before)

<!-- gh-comment-id:678774847 --> @lukyjay commented on GitHub (Aug 23, 2020): > @lukyjay, there is no documentation yet about how to configure as papermerge system service 😁 > > Do you mind if I use your systemd units as example (obviously I will rename user/group names) ? > I will expand with more details, but systemd units you provided here are very good starting point 👍 Of course! I just edited a Sonarr service file to make these. It'd be great if one command could manage both the worker and the webserver. This would be easier for service files, bash scripts, application health monitoring, etc. I tried to write a bash script for this but I couldn't get it to work (never used python venv before)
Author
Owner

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

Just FYI - assuming this was noticed but the "papermerge-worker.service:" and "papermerge-server.service:" in the systemd config example post above seem to be reversed :)

<!-- gh-comment-id:679186843 --> @dohlin commented on GitHub (Aug 24, 2020): Just FYI - assuming this was noticed but the "papermerge-worker.service:" and "papermerge-server.service:" in the systemd config example post above seem to be reversed :)
Author
Owner

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

Just FYI - assuming this was noticed but the "papermerge-worker.service:" and "papermerge-server.service:" in the systemd config example post above seem to be reversed :)

right!

@dohlin, this ticket is continuation of your issue #75. Once you installed manually and ./manage.py runserver + manage.py worker commands worked - next level is to configuring Papermerge to run as service. Service - usually assumes that application in production mode (DEBUG=False). I will paste here URL when documentation will be updated.

<!-- gh-comment-id:679236574 --> @ciur commented on GitHub (Aug 24, 2020): > Just FYI - assuming this was noticed but the "papermerge-worker.service:" and "papermerge-server.service:" in the systemd config example post above seem to be reversed :) right! @dohlin, this ticket is continuation of your issue #75. Once you installed manually and ./manage.py runserver + manage.py worker commands worked - next level is to configuring Papermerge to run as service. Service - usually assumes that application in production mode (DEBUG=False). I will paste here URL when documentation will be updated.
Author
Owner

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

Just FYI - assuming this was noticed but the "papermerge-worker.service:" and "papermerge-server.service:" in the systemd config example post above seem to be reversed :)

Only in my GitHub comment 😉

Just FYI - assuming this was noticed but the "papermerge-worker.service:" and "papermerge-server.service:" in the systemd config example post above seem to be reversed :)

right!

@dohlin, this ticket is continuation of your issue #75. Once you installed manually and ./manage.py runserver + manage.py worker commands worked - next level is to configuring Papermerge to run as service. Service - usually assumes that application in production mode (DEBUG=False). I will paste here URL when documentation will be updated.

My instance is giving me an error regarding debug mode being enabled. Can this be disabled via a setting in the conf file?

<!-- gh-comment-id:679391255 --> @lukyjay commented on GitHub (Aug 24, 2020): > Just FYI - assuming this was noticed but the "papermerge-worker.service:" and "papermerge-server.service:" in the systemd config example post above seem to be reversed :) Only in my GitHub comment 😉 > > Just FYI - assuming this was noticed but the "papermerge-worker.service:" and "papermerge-server.service:" in the systemd config example post above seem to be reversed :) > > right! > > @dohlin, this ticket is continuation of your issue #75. Once you installed manually and ./manage.py runserver + manage.py worker commands worked - next level is to configuring Papermerge to run as service. Service - usually assumes that application in production mode (DEBUG=False). I will paste here URL when documentation will be updated. My instance is giving me an error regarding debug mode being enabled. Can this be disabled via a setting in the conf file?
Author
Owner

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

Just FYI - assuming this was noticed but the "papermerge-worker.service:" and "papermerge-server.service:" in the systemd config example post above seem to be reversed :)

Only in my GitHub comment 😉

Just FYI - assuming this was noticed but the "papermerge-worker.service:" and "papermerge-server.service:" in the systemd config example post above seem to be reversed :)

right!
@dohlin, this ticket is continuation of your issue #75. Once you installed manually and ./manage.py runserver + manage.py worker commands worked - next level is to configuring Papermerge to run as service. Service - usually assumes that application in production mode (DEBUG=False). I will paste here URL when documentation will be updated.

My instance is giving me an error regarding debug mode being enabled. Can this be disabled via a setting in the conf file?

You can set debug = false in settings.py on the config folder, but this seems to break the login page, at least on Chrome.

<!-- gh-comment-id:679392258 --> @dohlin commented on GitHub (Aug 24, 2020): > > Just FYI - assuming this was noticed but the "papermerge-worker.service:" and "papermerge-server.service:" in the systemd config example post above seem to be reversed :) > > Only in my GitHub comment 😉 > > > > Just FYI - assuming this was noticed but the "papermerge-worker.service:" and "papermerge-server.service:" in the systemd config example post above seem to be reversed :) > > > > > > right! > > @dohlin, this ticket is continuation of your issue #75. Once you installed manually and ./manage.py runserver + manage.py worker commands worked - next level is to configuring Papermerge to run as service. Service - usually assumes that application in production mode (DEBUG=False). I will paste here URL when documentation will be updated. > > My instance is giving me an error regarding debug mode being enabled. Can this be disabled via a setting in the conf file? You can set debug = false in settings.py on the config folder, but this seems to break the login page, at least on Chrome.
Author
Owner

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

Hi guys!

this is documentation page you were looking for.
It is work in progress.
There I document systemd service examples for worker and main app. Server configurations for apache and nginx.

<!-- gh-comment-id:679905103 --> @ciur commented on GitHub (Aug 25, 2020): Hi guys! this [is documentation page you were looking for](https://papermerge.readthedocs.io/en/latest/setup/server_configurations.html). It is work in progress. There I document systemd service examples for worker and main app. Server configurations for apache and nginx.
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#75
No description provided.