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] [Service]
User=paperless User=paperless
Group=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 ExecStart=/opt/paperless/venv/bin/python manage.py document_consumer
[Install] [Install]

View file

@ -5,8 +5,9 @@ Requires=redis.service
[Service] [Service]
User=paperless User=paperless
Group=paperless Group=paperless
WorkingDirectory=/opt/paperless/src/src Environment=PAPERLESS_CONFIGURATION_PATH=/opt/paperless/paperless.conf
ExecStart=/opt/paperless/venv/bin/python manage.py qcluster WorkingDirectory=/opt/paperless/src/paperless-ngx/src
ExecStart=/opt/paperless/venv/bin/celery --app paperless beat --loglevel INFO
[Install] [Install]
WantedBy=multi-user.target 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] [Service]
User=paperless User=paperless
Group=paperless Group=paperless
WorkingDirectory=/opt/paperless/src/src Environment=PAPERLESS_CONFIGURATION_PATH=/opt/paperless/paperless.conf
ExecStart=/opt/paperless/venv/bin/gunicorn -c /opt/paperless/src/gunicorn.conf.py -b 127.0.0.1:22070 paperless.asgi:application 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] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View file

@ -28,7 +28,8 @@ PAPERLESS_CORS_ALLOWED_HOSTS=http://${node.metadata.get('nginx/vhosts/paperless/
# OCR settings # OCR settings
PAPERLESS_OCR_LANGUAGE=${'+'.join(sorted(node.metadata.get('paperless/ocr_languages', {'deu', 'eng'})))} 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_OUTPUT_TYPE=pdfa
#PAPERLESS_OCR_PAGES=1 #PAPERLESS_OCR_PAGES=1
#PAPERLESS_OCR_IMAGE_DPI=300 #PAPERLESS_OCR_IMAGE_DPI=300

View file

@ -1,146 +1,96 @@
users = { version = node.metadata.get('paperless/version')
'paperless': { workers = ('consumer', 'scheduler', 'taskqueue', 'webserver')
users['paperless'] = {
'home': '/opt/paperless', 'home': '/opt/paperless',
},
} }
directories = { directories['/opt/paperless'] = {}
'/opt/paperless/src': {},
'/opt/paperless/static': { directories['/opt/paperless/static'] = {
'owner': 'paperless', 'owner': 'paperless',
},
} }
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',
},
},
}
files = { files['/opt/paperless/paperless.conf'] = {
'/etc/systemd/system/paperless-consumer.service': {
'triggers': {
'action:systemd-reload',
'svc_systemd:paperless-consumer:restart',
},
},
'/etc/systemd/system/paperless-scheduler.service': {
'triggers': {
'action:systemd-reload',
'svc_systemd:paperless-scheduler:restart',
},
},
'/etc/systemd/system/paperless-webserver.service': {
'triggers': {
'action:systemd-reload',
'svc_systemd:paperless-webserver:restart',
},
},
'/opt/paperless/src/paperless.conf': {
'content_type': 'mako', 'content_type': 'mako',
'needs': {
'git_deploy:/opt/paperless/src',
},
'triggers': { 'triggers': {
'svc_systemd:paperless-consumer:restart', f'svc_systemd:paperless-{worker}:restart'
'svc_systemd:paperless-scheduler:restart', for worker in workers
'svc_systemd:paperless-webserver:restart',
},
}, },
} }
actions = { actions['paperless_create_virtualenv'] = {
'paperless_create_virtualenv': {
'command': '/usr/bin/python3 -m virtualenv -p python3 /opt/paperless/venv/', 'command': '/usr/bin/python3 -m virtualenv -p python3 /opt/paperless/venv/',
'unless': 'test -d /opt/paperless/venv/', 'unless': 'test -d /opt/paperless/venv/',
'needs': { 'needs': {
# actually /opt/paperless, but we don't create that 'directory:/opt/paperless',
'directory:/opt/paperless/src',
'pkg_apt:python3', 'pkg_apt:python3',
'pkg_apt:python3-pip', 'pkg_apt:python3-pip',
'pkg_apt:python3-virtualenv', 'pkg_apt:python3-virtualenv',
}, },
}, }
'paperless_install_deps': {
'command': actions['paperless_install'] = {
'cd /opt/paperless/src && ' 'command': ' && '.join([
'/opt/paperless/venv/bin/pip install --upgrade pip && ' 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', '/opt/paperless/venv/bin/pip install --upgrade -r requirements.txt',
'triggered': True, f'echo "{version}" > /opt/paperless/version',
]),
'unless': f'''bash -c '[[ "$(cat /opt/paperless/version)" == "{version}" ]]' ''',
'after': {
'pkg_apt:',
},
'needs': { 'needs': {
'action:paperless_create_virtualenv', 'action:paperless_create_virtualenv',
}, },
}, 'triggers': {
'paperless_migrate_database': { 'action: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 = { actions['paperless_migrate_database'] = {
'paperless-consumer': { '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': { 'needs': {
'action:paperless_migrate_database', # /mnt/paperless is NOT created by this bundle.
'file:/etc/systemd/system/paperless-consumer.service', 'action:paperless_install',
'git_deploy:/opt/paperless/src', 'directory:/mnt/paperless',
}, 'directory:/opt/paperless/static',
}, 'file:/opt/paperless/paperless.conf',
'paperless-scheduler': { 'user:paperless',
'needs': { 'postgres_db:paperless',
'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',
},
}, },
} }
for worker in workers:
files[f'/etc/systemd/system/paperless-{worker}.service'] = {
'delete': True,
'triggers': {
'action:systemd-reload',
},
}
files[f'/usr/local/lib/systemd/system/paperless-{worker}.service'] = {
'triggers': {
'action:systemd-reload',
f'svc_systemd:paperless-{worker}:restart',
},
}
svc_systemd[f'paperless-{worker}'] = {
'needs': {
'action:paperless_install',
'action:paperless_migrate_database',
f'file:/usr/local/lib/systemd/system/paperless-{worker}.service',
},
}

View file

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

View file

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