feat: add supercronic to allow running background jobs

This commit is contained in:
Daniel Richter 2024-07-07 23:54:34 +02:00
parent 1b9cf5121b
commit 525e40339b
3 changed files with 20 additions and 0 deletions

View File

@ -286,6 +286,11 @@ VOLUME ["/usr/src/paperless/data", \
"/usr/src/paperless/consume", \ "/usr/src/paperless/consume", \
"/usr/src/paperless/export"] "/usr/src/paperless/export"]
ENV SUPERCRONIC=supercronic-linux-amd64
ENV VERSION=0.2.30
RUN curl -fsSL -o "/usr/local/bin/supercronic" "https://github.com/aptible/supercronic/releases/download/v$VERSION/$SUPERCRONIC"
RUN chmod a+x "/usr/local/bin/supercronic"
ENTRYPOINT ["/sbin/docker-entrypoint.sh"] ENTRYPOINT ["/sbin/docker-entrypoint.sh"]
EXPOSE 8000 EXPOSE 8000

View File

@ -157,6 +157,11 @@ if [[ -n "$PAPERLESS_OCR_LANGUAGES" ]]; then
install_languages "$PAPERLESS_OCR_LANGUAGES" install_languages "$PAPERLESS_OCR_LANGUAGES"
fi fi
touch /etc/cron.d/export.cron
if [[ -n "$PAPERLESS_EXPORT_CRON" ]]; then
echo "$PAPERLESS_EXPORT_CRON document_exporter /usr/src/paperless/export" > /etc/cron.d/export.cron
fi
initialize initialize
if [[ "$1" != "/"* ]]; then if [[ "$1" != "/"* ]]; then

View File

@ -17,6 +17,16 @@ stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0 stderr_logfile_maxbytes=0
environment = HOME="/usr/src/paperless",USER="paperless" environment = HOME="/usr/src/paperless",USER="paperless"
[program:export]
command=/usr/local/bin/supercronic /etc/cron.d/export.cron
user=paperless
startsecs=0
priority=2
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[program:consumer] [program:consumer]
command=python3 manage.py document_consumer command=python3 manage.py document_consumer
user=paperless user=paperless