Papermerge

From ArchWiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Papermerge is an open source document management system for digital archives.

Installation

Install the papermergeAUR package. Installation and updates of the package automatically run the database migrations.

Start

Enable and start the two papermerge systemd units:

# systemctl enable --now papermerge-gunicorn papermerge-worker

Your papermerge instance should now be available at port 9001.

Configuration

For details on papermerge configuration, visit its official documentation. The main configuration file is located at /etc/papermerge.conf.py.

Note: The papermergeAUR package creates a papermerge system user and provides a papermerge-manage command which should always be run as the papermerge user. See below for an example. The papermerge-manage command should be used wherever the official documentation refers to manage.py.

Do not forget to restart papermerge-gunicorn.service and papermerge-worker.service after changing configurations.

Create admin user

After initial installation, you should create an admin user for your papermerge instance:

$ sudo -u papermerge papermerge-manage createsuperuser

Nginx

Install Nginx and use the following configuration as a starting point for the papermerge virtual host:

/etc/nginx/sites-available/papermerge.domain.tld
server {
    server_name papermerge.domain.tld;
    listen 80;
    listen [::]:80;

    location /static/ {
        alias /var/lib/papermerge/static/;
    }

    location /media/ {
        alias /var/lib/papermerge/media/;
    }

    location / {
        proxy_pass http://127.0.0.1:9001;
    }
}

Redis

It is recommended to use Redis as a message broker instead of the default filesystem-based approach.

Install redis and python-redis and start/enable redis.service. In /usr/lib/python3.9/site-packages/config/settings/base.py replace

/usr/lib/python3.9/site-packages/config/settings/base.py
CELERY_BROKER_URL = "filesystem://"
CELERY_BROKER_TRANSPORT_OPTIONS = {
    'data_folder_in': PAPERMERGE_TASK_QUEUE_DIR,
    'data_folder_out': PAPERMERGE_TASK_QUEUE_DIR,
}

with

/usr/lib/python3.9/site-packages/config/settings/base.py
CELERY_BROKER_URL = "redis://"
CELERY_BROKER_TRANSPORT_OPTIONS = {}
CELERY_RESULT_BACKEND = "redis://localhost/0"

and restart papermerge-gunicorn.service and papermerge-worker.service