From 6e385871747c17b3495851fd3aa6772a8dd7e91a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sascha=20I=C3=9Fbr=C3=BCcker?= Date: Sun, 14 Apr 2024 20:28:39 +0200 Subject: [PATCH] Fix missing home directory in background tasks --- bootstrap.sh | 3 --- docker/alpine.Dockerfile | 2 ++ docker/default.Dockerfile | 2 ++ supervisord.conf | 2 ++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 6923a2d..4da3861 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -9,8 +9,6 @@ mkdir -p data mkdir -p data/favicons # Create assets folder if it does not exist mkdir -p data/assets -# Create chromium profile folder if it does not exist -mkdir -p chromium-profile # Generate secret key file if it does not exist python manage.py generate_secret_key @@ -25,7 +23,6 @@ python manage.py migrate_tasks # Ensure folders are owned by the right user chown -R www-data: /etc/linkding/data -chown -R www-data: /etc/linkding/chromium-profile # Start background task processor using supervisord, unless explicitly disabled if [ "$LD_DISABLE_BACKGROUND_TASKS" != "True" ]; then diff --git a/docker/alpine.Dockerfile b/docker/alpine.Dockerfile index 51fd009..039d6e2 100644 --- a/docker/alpine.Dockerfile +++ b/docker/alpine.Dockerfile @@ -123,5 +123,7 @@ RUN apk update && apk add nodejs npm chromium RUN npm install -g https://github.com/sissbruecker/single-file-cli/tarball/4c54b3bc704cfb3e96cec2d24854caca3df0b3b6 # copy uBlock0 COPY --from=ublock-build /etc/linkding/uBlock0.chromium uBlock0.chromium/ +# create chromium profile folder for user running background tasks +RUN mkdir -p chromium-profile && chown -R www-data:www-data chromium-profile # enable snapshot support ENV LD_ENABLE_SNAPSHOTS=True diff --git a/docker/default.Dockerfile b/docker/default.Dockerfile index c029403..7ffb6b0 100644 --- a/docker/default.Dockerfile +++ b/docker/default.Dockerfile @@ -125,6 +125,8 @@ RUN apt-get install -y gnupg2 apt-transport-https ca-certificates && \ apt-get update && apt-get install -y nodejs # install single-file from fork for now, which contains several hotfixes RUN npm install -g https://github.com/sissbruecker/single-file-cli/tarball/4c54b3bc704cfb3e96cec2d24854caca3df0b3b6 +# create chromium profile folder for user running background tasks +RUN mkdir -p chromium-profile && chown -R www-data:www-data chromium-profile # copy uBlock0 COPY --from=ublock-build /etc/linkding/uBlock0.chromium uBlock0.chromium/ # enable snapshot support diff --git a/supervisord.conf b/supervisord.conf index 15d7f5e..1447d5c 100644 --- a/supervisord.conf +++ b/supervisord.conf @@ -4,6 +4,8 @@ loglevel=info [program:jobs] user=www-data +# setup a temp home folder for the job, required by chromium to write to .config +environment=HOME=/tmp/.config command=python manage.py run_huey -f stdout_logfile=background_tasks.log stdout_logfile_maxbytes=10MB