update paperless-ngx to v2.1.0

This commit is contained in:
Franzi 2023-12-07 21:07:33 +01:00
parent 4e50bfe1a2
commit 9a3134cf46
Signed by: kunsi
GPG key ID: 12E3D2136B818350
8 changed files with 106 additions and 135 deletions

View file

@ -5,7 +5,8 @@ Requires=redis.service
[Service]
User=paperless
Group=paperless
WorkingDirectory=/opt/paperless/src/src
Environment=PAPERLESS_CONFIGURATION_PATH=/opt/paperless/paperless.conf
WorkingDirectory=/opt/paperless/src/paperless-ngx/src
ExecStart=/opt/paperless/venv/bin/python manage.py document_consumer
[Install]

View file

@ -5,8 +5,9 @@ Requires=redis.service
[Service]
User=paperless
Group=paperless
WorkingDirectory=/opt/paperless/src/src
ExecStart=/opt/paperless/venv/bin/python manage.py qcluster
Environment=PAPERLESS_CONFIGURATION_PATH=/opt/paperless/paperless.conf
WorkingDirectory=/opt/paperless/src/paperless-ngx/src
ExecStart=/opt/paperless/venv/bin/celery --app paperless beat --loglevel INFO
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,13 @@
[Unit]
Description=Paperless task queue
Requires=redis.service
[Service]
User=paperless
Group=paperless
Environment=PAPERLESS_CONFIGURATION_PATH=/opt/paperless/paperless.conf
WorkingDirectory=/opt/paperless/src/paperless-ngx/src
ExecStart=/opt/paperless/venv/bin/celery --app paperless worker --loglevel INFO
[Install]
WantedBy=multi-user.target

View file

@ -7,8 +7,9 @@ Requires=redis.service
[Service]
User=paperless
Group=paperless
WorkingDirectory=/opt/paperless/src/src
ExecStart=/opt/paperless/venv/bin/gunicorn -c /opt/paperless/src/gunicorn.conf.py -b 127.0.0.1:22070 paperless.asgi:application
Environment=PAPERLESS_CONFIGURATION_PATH=/opt/paperless/paperless.conf
WorkingDirectory=/opt/paperless/src/paperless-ngx/src
ExecStart=/opt/paperless/venv/bin/gunicorn -c /opt/paperless/src/paperless-ngx/gunicorn.conf.py -b 127.0.0.1:22070 paperless.asgi:application
[Install]
WantedBy=multi-user.target

View file

@ -28,7 +28,8 @@ PAPERLESS_CORS_ALLOWED_HOSTS=http://${node.metadata.get('nginx/vhosts/paperless/
# OCR settings
PAPERLESS_OCR_LANGUAGE=${'+'.join(sorted(node.metadata.get('paperless/ocr_languages', {'deu', 'eng'})))}
PAPERLESS_OCR_MODE=skip_noarchive
PAPERLESS_OCR_MODE=skip
PAPERLESS_OCR_SKIP_ARCHIVE_FILE=never
#PAPERLESS_OCR_OUTPUT_TYPE=pdfa
#PAPERLESS_OCR_PAGES=1
#PAPERLESS_OCR_IMAGE_DPI=300

View file

@ -1,146 +1,96 @@
users = {
'paperless': {
'home': '/opt/paperless',
version = node.metadata.get('paperless/version')
workers = ('consumer', 'scheduler', 'taskqueue', 'webserver')
users['paperless'] = {
'home': '/opt/paperless',
}
directories['/opt/paperless'] = {}
directories['/opt/paperless/static'] = {
'owner': 'paperless',
}
files['/opt/paperless/paperless.conf'] = {
'content_type': 'mako',
'triggers': {
f'svc_systemd:paperless-{worker}:restart'
for worker in workers
},
}
directories = {
'/opt/paperless/src': {},
'/opt/paperless/static': {
'owner': 'paperless',
actions['paperless_create_virtualenv'] = {
'command': '/usr/bin/python3 -m virtualenv -p python3 /opt/paperless/venv/',
'unless': 'test -d /opt/paperless/venv/',
'needs': {
'directory:/opt/paperless',
'pkg_apt:python3',
'pkg_apt:python3-pip',
'pkg_apt:python3-virtualenv',
},
}
git_deploy = {
'/opt/paperless/src': {
'repo': 'https://github.com/paperless-ngx/paperless-ngx.git',
'rev': node.metadata.get('paperless/version'),
'triggers': {
'action:paperless_collectstatic',
'action:paperless_compile_frontend',
'action:paperless_install_deps',
'action:paperless_migrate_database',
'svc_systemd:paperless-consumer:restart',
'svc_systemd:paperless-scheduler:restart',
'svc_systemd:paperless-webserver:restart',
},
actions['paperless_install'] = {
'command': ' && '.join([
f'wget -qO /opt/paperless/{version}.tar.xz https://github.com/paperless-ngx/paperless-ngx/releases/download/{version}/paperless-ngx-{version}.tar.xz',
'rm -rf /opt/paperless/src/',
'mkdir -p /opt/paperless/src/',
f'tar -C /opt/paperless/src -xf /opt/paperless/{version}.tar.xz',
f'rm /opt/paperless/{version}.tar.xz',
'cd /opt/paperless/src/paperless-ngx',
'/opt/paperless/venv/bin/pip install --upgrade pip',
'/opt/paperless/venv/bin/pip install --upgrade -r requirements.txt',
f'echo "{version}" > /opt/paperless/version',
]),
'unless': f'''bash -c '[[ "$(cat /opt/paperless/version)" == "{version}" ]]' ''',
'after': {
'pkg_apt:',
},
'needs': {
'action:paperless_create_virtualenv',
},
'triggers': {
'action:paperless_migrate_database',
},
}
files = {
'/etc/systemd/system/paperless-consumer.service': {
actions['paperless_migrate_database'] = {
'command': ' && '.join([
'cd /opt/paperless/src/paperless-ngx/src',
'sudo -Hu paperless PAPERLESS_CONFIGURATION_PATH=/opt/paperless/paperless.conf /opt/paperless/venv/bin/python manage.py migrate',
]),
'triggered': True,
'needs': {
# /mnt/paperless is NOT created by this bundle.
'action:paperless_install',
'directory:/mnt/paperless',
'directory:/opt/paperless/static',
'file:/opt/paperless/paperless.conf',
'user:paperless',
'postgres_db:paperless',
},
}
for worker in workers:
files[f'/etc/systemd/system/paperless-{worker}.service'] = {
'delete': True,
'triggers': {
'action:systemd-reload',
'svc_systemd:paperless-consumer:restart',
},
},
'/etc/systemd/system/paperless-scheduler.service': {
}
files[f'/usr/local/lib/systemd/system/paperless-{worker}.service'] = {
'triggers': {
'action:systemd-reload',
'svc_systemd:paperless-scheduler:restart',
f'svc_systemd:paperless-{worker}:restart',
},
},
'/etc/systemd/system/paperless-webserver.service': {
'triggers': {
'action:systemd-reload',
'svc_systemd:paperless-webserver:restart',
},
},
'/opt/paperless/src/paperless.conf': {
'content_type': 'mako',
'needs': {
'git_deploy:/opt/paperless/src',
},
'triggers': {
'svc_systemd:paperless-consumer:restart',
'svc_systemd:paperless-scheduler:restart',
'svc_systemd:paperless-webserver:restart',
},
},
}
}
actions = {
'paperless_create_virtualenv': {
'command': '/usr/bin/python3 -m virtualenv -p python3 /opt/paperless/venv/',
'unless': 'test -d /opt/paperless/venv/',
'needs': {
# actually /opt/paperless, but we don't create that
'directory:/opt/paperless/src',
'pkg_apt:python3',
'pkg_apt:python3-pip',
'pkg_apt:python3-virtualenv',
},
},
'paperless_install_deps': {
'command':
'cd /opt/paperless/src && '
'/opt/paperless/venv/bin/pip install --upgrade pip && '
'/opt/paperless/venv/bin/pip install --upgrade -r requirements.txt',
'triggered': True,
'needs': {
'action:paperless_create_virtualenv',
},
},
'paperless_migrate_database': {
'command':
'cd /opt/paperless/src/src && '
'sudo -Hu paperless /opt/paperless/venv/bin/python manage.py migrate',
'triggered': True,
'needs': {
# /mnt/paperless is NOT created by this bundle.
'action:paperless_install_deps',
'directory:/mnt/paperless',
'directory:/opt/paperless/static',
'file:/opt/paperless/src/paperless.conf',
'user:paperless',
'postgres_db:paperless',
},
},
'paperless_compile_frontend': {
'command':
'cd /opt/paperless/src/src-ui && '
'npm install && '
'node_modules/.bin/ng build',
'triggered': True,
'needs': {
'file:/opt/paperless/src/paperless.conf',
'pkg_apt:nodejs',
},
},
'paperless_collectstatic': {
'command':
'cd /opt/paperless/src/src && '
'sudo -Hu paperless /opt/paperless/venv/bin/python manage.py collectstatic',
'triggered': True,
'needs': {
'directory:/opt/paperless/static',
'file:/opt/paperless/src/paperless.conf',
'action:paperless_install_deps',
},
},
}
svc_systemd = {
'paperless-consumer': {
svc_systemd[f'paperless-{worker}'] = {
'needs': {
'action:paperless_install',
'action:paperless_migrate_database',
'file:/etc/systemd/system/paperless-consumer.service',
'git_deploy:/opt/paperless/src',
f'file:/usr/local/lib/systemd/system/paperless-{worker}.service',
},
},
'paperless-scheduler': {
'needs': {
'action:paperless_migrate_database',
'file:/etc/systemd/system/paperless-scheduler.service',
'git_deploy:/opt/paperless/src',
},
},
'paperless-webserver': {
'needs': {
'action:paperless_compile_frontend',
'action:paperless_migrate_database',
'file:/etc/systemd/system/paperless-webserver.service',
'git_deploy:/opt/paperless/src',
},
},
}
}

View file

@ -6,7 +6,9 @@ defaults = {
'gnupg': {},
'imagemagick': {},
'libmagic-dev': {},
'default-libmysqlclient-dev': {},
'libpq-dev': {},
'mariadb-client': {},
'mime-support': {},
'optipng': {},
'python3-wheel': {},
@ -19,6 +21,8 @@ defaults = {
'pngquant': {},
'qpdf': {},
'tesseract-ocr': {},
'tesseract-ocr-deu': {},
'tesseract-ocr-eng': {},
'unpaper': {},
'zlib1g': {},
},

View file

@ -55,11 +55,11 @@ nodes['home.paperless'] = {
},
},
'paperless': {
'version': 'v1.17.4',
'version': 'v2.1.0',
'timezone': 'Europe/Berlin',
},
'postgresql': {
'version': '11',
'version': 15,
},
'vm': {
'cpu': 2,