From 967ca34697fc167d458dee483d2d12d5ebd601dd Mon Sep 17 00:00:00 2001 From: Mark Calvert Date: Wed, 28 Feb 2024 08:45:35 +0800 Subject: [PATCH] Update CKAN config log file handler to use the worker log file and the supervisor processes --- ckan/Dockerfile.worker | 2 ++ ckan/config/dbca.ini | 2 +- ckan/docker-entrypoint.d/02_setup_dbca.sh | 1 + ckan/supervisor/ckan_cron_jobs.conf | 2 +- ckan/supervisor/ckan_worker_bulk.conf | 2 +- ckan/supervisor/ckan_worker_default.conf | 2 +- ckan/supervisor/ckan_worker_priority.conf | 2 +- 7 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ckan/Dockerfile.worker b/ckan/Dockerfile.worker index 18b681fe..676ae428 100644 --- a/ckan/Dockerfile.worker +++ b/ckan/Dockerfile.worker @@ -4,6 +4,8 @@ FROM ${CKAN_IMAGE} # Override the default CKAN config plugins to only use the ones we need for the worker ENV CKAN__PLUGINS="dbca activity datastore xloader scheming_datasets qa archiver report envvars" RUN ckan config-tool $CKAN_INI "ckan.plugins = ${CKAN__PLUGINS}" +# Update the CKAN config log file handler to use the worker log file +RUN ckan config-tool $CKAN_INI -s handler_fileHandler "args = ('/srv/app/logs/ckan-worker.log', 'midnight', 1, 7)" ## Supervisor config COPY supervisor/*.conf /etc/supervisord.d diff --git a/ckan/config/dbca.ini b/ckan/config/dbca.ini index 7f2e8a41..13119baa 100644 --- a/ckan/config/dbca.ini +++ b/ckan/config/dbca.ini @@ -113,7 +113,7 @@ formatter = generic [handler_fileHandler] class = handlers.TimedRotatingFileHandler -args = ('/srv/app/logs/ckan.log', 'midnight', 1, 0) +args = ('/srv/app/logs/ckan.log', 'midnight', 1, 7) level = NOTSET formatter = generic diff --git a/ckan/docker-entrypoint.d/02_setup_dbca.sh b/ckan/docker-entrypoint.d/02_setup_dbca.sh index 76166c99..7301369b 100644 --- a/ckan/docker-entrypoint.d/02_setup_dbca.sh +++ b/ckan/docker-entrypoint.d/02_setup_dbca.sh @@ -3,6 +3,7 @@ ## Create logs folder/files and set permissions mkdir -p $APP_DIR/logs touch $APP_DIR/logs/ckan.log +touch $APP_DIR/logs/ckan-worker.log chown -R ckan:ckan $APP_DIR/logs ## Create archive folder and set permissions diff --git a/ckan/supervisor/ckan_cron_jobs.conf b/ckan/supervisor/ckan_cron_jobs.conf index ca3de39a..bc4cbf3b 100644 --- a/ckan/supervisor/ckan_cron_jobs.conf +++ b/ckan/supervisor/ckan_cron_jobs.conf @@ -24,7 +24,7 @@ process_name=%(program_name)s-%(process_num)02d ; Log files. -stderr_logfile=/srv/app/logs/ckan.log +stderr_logfile=/srv/app/logs/ckan-worker.log ; Make sure that the worker is started on system start and automatically diff --git a/ckan/supervisor/ckan_worker_bulk.conf b/ckan/supervisor/ckan_worker_bulk.conf index cf513309..b79065c1 100644 --- a/ckan/supervisor/ckan_worker_bulk.conf +++ b/ckan/supervisor/ckan_worker_bulk.conf @@ -24,7 +24,7 @@ process_name=%(program_name)s-%(process_num)02d ; Log files. -stderr_logfile=/srv/app/logs/ckan.log +stderr_logfile=/srv/app/logs/ckan-worker.log ; Make sure that the worker is started on system start and automatically diff --git a/ckan/supervisor/ckan_worker_default.conf b/ckan/supervisor/ckan_worker_default.conf index 3e2ccd19..354bfc1b 100644 --- a/ckan/supervisor/ckan_worker_default.conf +++ b/ckan/supervisor/ckan_worker_default.conf @@ -24,7 +24,7 @@ process_name=%(program_name)s-%(process_num)02d ; Log files. -stderr_logfile=/srv/app/logs/ckan.log +stderr_logfile=/srv/app/logs/ckan-worker.log ; Make sure that the worker is started on system start and automatically diff --git a/ckan/supervisor/ckan_worker_priority.conf b/ckan/supervisor/ckan_worker_priority.conf index 0c73f6ab..195ad982 100644 --- a/ckan/supervisor/ckan_worker_priority.conf +++ b/ckan/supervisor/ckan_worker_priority.conf @@ -24,7 +24,7 @@ process_name=%(program_name)s-%(process_num)02d ; Log files. -stderr_logfile=/srv/app/logs/ckan.log +stderr_logfile=/srv/app/logs/ckan-worker.log ; Make sure that the worker is started on system start and automatically