bundles/paperless: ensure we run collectstatic and restart services

This commit is contained in:
Franzi 2024-02-17 04:36:39 +01:00
parent 297726f297
commit 012726a2ce
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -52,6 +52,9 @@ actions['paperless_install'] = {
}, },
'triggers': { 'triggers': {
'action:paperless_migrate_database', 'action:paperless_migrate_database',
*{
f'svc_systemd:paperless-{worker}:restart' for worker in workers
}
}, },
} }
@ -61,6 +64,21 @@ actions['paperless_migrate_database'] = {
'sudo -Hu paperless PAPERLESS_CONFIGURATION_PATH=/opt/paperless/paperless.conf /opt/paperless/venv/bin/python manage.py migrate', 'sudo -Hu paperless PAPERLESS_CONFIGURATION_PATH=/opt/paperless/paperless.conf /opt/paperless/venv/bin/python manage.py migrate',
]), ]),
'triggered': True, 'triggered': True,
'needs': {
# /mnt/paperless is NOT created by this bundle.
'action:paperless_install',
'directory:/mnt/paperless',
'file:/opt/paperless/paperless.conf',
'user:paperless',
'postgres_db:paperless',
},
}
actions['paperless_collectstatic'] = {
'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 collectstatic',
]),
'triggered': True,
'needs': { 'needs': {
# /mnt/paperless is NOT created by this bundle. # /mnt/paperless is NOT created by this bundle.
'action:paperless_install', 'action:paperless_install',
@ -91,6 +109,7 @@ for worker in workers:
'needs': { 'needs': {
'action:paperless_install', 'action:paperless_install',
'action:paperless_migrate_database', 'action:paperless_migrate_database',
'action:paperless_collectstatic',
f'file:/usr/local/lib/systemd/system/paperless-{worker}.service', f'file:/usr/local/lib/systemd/system/paperless-{worker}.service',
}, },
} }