Skip to content

Commit

Permalink
Fix celery log folder creation (#1787)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathangreen authored Apr 16, 2024
1 parent 373b68e commit 0b09ca4
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 4 deletions.
2 changes: 2 additions & 0 deletions core/celery/tasks/custom_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,7 @@ def update_custom_lists(task: Task) -> None:
select(CustomList.id).where(CustomList.auto_update_enabled == True)
).all()

task.log.info(f"Updating {len(custom_lists)} custom lists.")

for custom_list in custom_lists:
update_custom_list.delay(custom_list.id)
4 changes: 0 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ FROM common AS scripts
# Set the local timezone and setup cron
ENV TZ=US/Eastern
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
mkdir /var/log/celery && \
chown simplified:simplified /var/log/celery && \
mkdir /var/run/celery && \
chown simplified:simplified /var/run/celery && \
touch /var/log/cron.log

# Copy cron config into container
Expand Down
11 changes: 11 additions & 0 deletions docker/runit-scripts/beat/run
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
#!/bin/bash
set -e

# Set the working directory to the root of the project
cd /var/www/circulation
source env/bin/activate

# Make sure the log directory exists and is writable
mkdir -p /var/log/celery
chown 1000:adm /var/log/celery

# Make sure the run directory exists and is writable
mkdir -p /var/run/celery
chown 1000:1000 /var/run/celery

# Start the celery beat process
exec env/bin/celery -A "core.celery.worker.app" beat --uid 1000 --gid 1000 --logfile /var/log/celery/beat.log -s /var/run/celery/beat-schedule
7 changes: 7 additions & 0 deletions docker/runit-scripts/worker-default/run
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#!/bin/bash
set -e

# Set the working directory to the root of the project
cd /var/www/circulation
source env/bin/activate

# Make sure the log directory exists and is writable
mkdir -p /var/log/celery
chown 1000:adm /var/log/celery

# Start the celery worker
exec env/bin/celery -A "core.celery.worker.app" worker --uid 1000 --gid 1000 --autoscale 4,1 --hostname default@%h -Q high,default --logfile /var/log/celery/default.log
7 changes: 7 additions & 0 deletions docker/runit-scripts/worker-high/run
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#!/bin/bash
set -e

# Set the working directory to the root of the project
cd /var/www/circulation
source env/bin/activate

# Make sure the log directory exists and is writable
mkdir -p /var/log/celery
chown 1000:adm /var/log/celery

# Start the celery worker
exec env/bin/celery -A "core.celery.worker.app" worker --uid 1000 --gid 1000 --concurrency 1 --hostname high@%h -Q high --logfile /var/log/celery/high.log

0 comments on commit 0b09ca4

Please sign in to comment.