From fd38df4db5e90d8af6e04548084f1e6e7d5bcc15 Mon Sep 17 00:00:00 2001 From: Terence Tuhinanshu Date: Wed, 22 Feb 2023 22:02:36 +0000 Subject: [PATCH 1/2] Fix logrotate for Celery This was previously rotating all the files in that folder, not just the Celery logs, which was leading the Celery service to not start at times. By ensuring we only rotate the logs, we fix the Celery service start issues. --- .../templates/celery-logrotate.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/ansible/roles/model-my-watershed.celery-worker/templates/celery-logrotate.j2 b/deployment/ansible/roles/model-my-watershed.celery-worker/templates/celery-logrotate.j2 index 0ae479667..4fa5856b5 100644 --- a/deployment/ansible/roles/model-my-watershed.celery-worker/templates/celery-logrotate.j2 +++ b/deployment/ansible/roles/model-my-watershed.celery-worker/templates/celery-logrotate.j2 @@ -1,4 +1,4 @@ -{{ celery_log_dir }}/* { +{{ celery_log_dir }}/*.log { rotate 3 daily compress From 89702bf4b145223a86988937655b20f41c22a111 Mon Sep 17 00:00:00 2001 From: Terence Tuhinanshu Date: Thu, 23 Feb 2023 14:47:34 +0000 Subject: [PATCH 2/2] Improve logrotate config Inspired by the nginx logrotate configuration. --- .../templates/celery-logrotate.j2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deployment/ansible/roles/model-my-watershed.celery-worker/templates/celery-logrotate.j2 b/deployment/ansible/roles/model-my-watershed.celery-worker/templates/celery-logrotate.j2 index 4fa5856b5..567da0b19 100644 --- a/deployment/ansible/roles/model-my-watershed.celery-worker/templates/celery-logrotate.j2 +++ b/deployment/ansible/roles/model-my-watershed.celery-worker/templates/celery-logrotate.j2 @@ -1,5 +1,8 @@ {{ celery_log_dir }}/*.log { rotate 3 daily + missingok compress + delaycompress + notifempty }