Fix missing home directory in background tasks

This commit is contained in:
Sascha Ißbrücker 2024-04-14 20:28:39 +02:00
parent 123c6fe02a
commit 6e38587174
4 changed files with 6 additions and 3 deletions

View file

@ -9,8 +9,6 @@ mkdir -p data
mkdir -p data/favicons mkdir -p data/favicons
# Create assets folder if it does not exist # Create assets folder if it does not exist
mkdir -p data/assets 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 # Generate secret key file if it does not exist
python manage.py generate_secret_key python manage.py generate_secret_key
@ -25,7 +23,6 @@ python manage.py migrate_tasks
# Ensure folders are owned by the right user # Ensure folders are owned by the right user
chown -R www-data: /etc/linkding/data chown -R www-data: /etc/linkding/data
chown -R www-data: /etc/linkding/chromium-profile
# Start background task processor using supervisord, unless explicitly disabled # Start background task processor using supervisord, unless explicitly disabled
if [ "$LD_DISABLE_BACKGROUND_TASKS" != "True" ]; then if [ "$LD_DISABLE_BACKGROUND_TASKS" != "True" ]; then

View file

@ -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 RUN npm install -g https://github.com/sissbruecker/single-file-cli/tarball/4c54b3bc704cfb3e96cec2d24854caca3df0b3b6
# copy uBlock0 # copy uBlock0
COPY --from=ublock-build /etc/linkding/uBlock0.chromium uBlock0.chromium/ 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 # enable snapshot support
ENV LD_ENABLE_SNAPSHOTS=True ENV LD_ENABLE_SNAPSHOTS=True

View file

@ -125,6 +125,8 @@ RUN apt-get install -y gnupg2 apt-transport-https ca-certificates && \
apt-get update && apt-get install -y nodejs apt-get update && apt-get install -y nodejs
# install single-file from fork for now, which contains several hotfixes # install single-file from fork for now, which contains several hotfixes
RUN npm install -g https://github.com/sissbruecker/single-file-cli/tarball/4c54b3bc704cfb3e96cec2d24854caca3df0b3b6 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 uBlock0
COPY --from=ublock-build /etc/linkding/uBlock0.chromium uBlock0.chromium/ COPY --from=ublock-build /etc/linkding/uBlock0.chromium uBlock0.chromium/
# enable snapshot support # enable snapshot support

View file

@ -4,6 +4,8 @@ loglevel=info
[program:jobs] [program:jobs]
user=www-data 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 command=python manage.py run_huey -f
stdout_logfile=background_tasks.log stdout_logfile=background_tasks.log
stdout_logfile_maxbytes=10MB stdout_logfile_maxbytes=10MB