Skip to content

Commit 2ef86b1

Browse files
Add log rotation scheduler job for the nginx logs (#619)
## Overview Currently the nginx logs are not rotated so they can build up to quite a large size. Previously, they were rotated by the `canarie-api` component but that is no longer a required component and CanarieAPI hasn't handled log rotation since CanarieAPI version 1.0.0. Fixes #593. This quick and least disruptive fix to get the production server out of the water should be a temporary solution until a better solution using container STDOUT parsing is implemented for the CanarieAPI and prometheus-log-parser (#618). Then we can deprecate this scheduler job. ## Changes **Non-breaking changes** - adds new scheduler job **Breaking changes** - None ## Related Issue / Discussion - This is an alternative to #617. See #617 (comment) for reasons why I believe this is a preferred solution. ## Additional Information ## CI Operations <!-- The test suite can be run using a different DACCS config with ``birdhouse_daccs_configs_branch: branch_name`` in the PR description. To globally skip the test suite regardless of the commit message use ``birdhouse_skip_ci`` set to ``true`` in the PR description. Using ``[<cmd>]`` (with the brackets) where ``<cmd> = skip ci`` in the commit message will override ``birdhouse_skip_ci`` from the PR description. Such commit command can be used to override the PR description behavior for a specific commit update. However, a commit message cannot 'force run' a PR which the description turns off the CI. To run the CI, the PR should instead be updated with a ``true`` value, and a running message can be posted in following PR comments to trigger tests once again. --> birdhouse_daccs_configs_branch: master birdhouse_skip_ci: false
2 parents c7d4583 + 3ad5beb commit 2ef86b1

File tree

15 files changed

+96
-13
lines changed

15 files changed

+96
-13
lines changed

.bumpversion.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tool.bumpversion]
2-
current_version = "2.20.0"
2+
current_version = "2.20.1"
33
commit = true
44
tag = false
55
tag_name = "{new_version}"

CHANGES.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,30 @@
1717

1818
[//]: # (list changes here, using '-' for each new entry, remove this when items are added)
1919

20+
[2.20.1](https://github.com/bird-house/birdhouse-deploy/tree/2.20.1) (2025-12-16)
21+
------------------------------------------------------------------------------------------------------------------
22+
23+
## Fixes
24+
25+
- Add log rotation scheduler job for the nginx logs
26+
27+
Currently the nginx logs are not rotated so they can build up to quite a large size.
28+
29+
Previously, they were rotated by the `canarie-api` component but that is no longer a required
30+
component and CanarieAPI hasn't handled log rotation since CanarieAPI version 1.0.0 (see
31+
https://github.com/bird-house/birdhouse-deploy/pull/452 for details).
32+
33+
Fixes https://github.com/bird-house/birdhouse-deploy/issues/593. Here is a summary of the issue:
34+
35+
- CanarieApi parses the log file every minute starting from the beginning of the file
36+
- If the log file is really big it uses a lot of CPU and memory to read through the whole file
37+
- This would use a lot less CPU and memory if the log file was smaller
38+
39+
This quick and least disruptive fix to get the production server out of the water should be a
40+
temporary solution until a better solution using container STDOUT parsing is implemented for
41+
the CanarieAPI and prometheus-log-parser (https://github.com/bird-house/birdhouse-deploy/issues/618).
42+
Then we can deprecate this scheduler job.
43+
2044
[2.20.0](https://github.com/bird-house/birdhouse-deploy/tree/2.20.0) (2025-12-10)
2145
------------------------------------------------------------------------------------------------------------------
2246

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ override BIRDHOUSE_MAKE_DIR := $(shell realpath -P $$(dirname $(BIRDHOUSE_MAKE_C
88
# Generic variables
99
override SHELL := bash
1010
override APP_NAME := birdhouse-deploy
11-
override APP_VERSION := 2.20.0
11+
override APP_VERSION := 2.20.1
1212

1313
# utility to remove comments after value of an option variable
1414
override clean_opt = $(shell echo "$(1)" | $(_SED) -r -e "s/[ '$'\t'']+$$//g")

README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ for a full-fledged production platform.
1818
* - citation
1919
- | |citation|
2020

21-
.. |commits-since| image:: https://img.shields.io/github/commits-since/bird-house/birdhouse-deploy/2.20.0.svg
21+
.. |commits-since| image:: https://img.shields.io/github/commits-since/bird-house/birdhouse-deploy/2.20.1.svg
2222
:alt: Commits since latest release
23-
:target: https://github.com/bird-house/birdhouse-deploy/compare/2.20.0...master
23+
:target: https://github.com/bird-house/birdhouse-deploy/compare/2.20.1...master
2424

25-
.. |latest-version| image:: https://img.shields.io/badge/tag-2.20.0-blue.svg?style=flat
25+
.. |latest-version| image:: https://img.shields.io/badge/tag-2.20.1-blue.svg?style=flat
2626
:alt: Latest Tag
27-
:target: https://github.com/bird-house/birdhouse-deploy/tree/2.20.0
27+
:target: https://github.com/bird-house/birdhouse-deploy/tree/2.20.1
2828

2929
.. |readthedocs| image:: https://readthedocs.org/projects/birdhouse-deploy/badge/?version=latest
3030
:alt: ReadTheDocs Build Status (latest version)

RELEASE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.20.0 2025-12-10T22:06:17Z
1+
2.20.1 2025-12-16T18:09:59Z

birdhouse/components/canarie-api/docker_configuration.py.template

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ SERVICES = {
108108
# NOTE:
109109
# Below version and release time auto-managed by 'make VERSION=x.y.z bump'.
110110
# Do NOT modify it manually. See 'Tagging policy' in 'birdhouse/README.rst'.
111-
'version': '2.20.0',
112-
'releaseTime': '2025-12-10T22:06:17Z',
111+
'version': '2.20.1',
112+
'releaseTime': '2025-12-16T18:09:59Z',
113113
'institution': '${BIRDHOUSE_INSTITUTION}',
114114
'researchSubject': '${BIRDHOUSE_SUBJECT}',
115115
'supportEmail': '${BIRDHOUSE_SUPPORT_EMAIL}',
@@ -141,8 +141,8 @@ PLATFORMS = {
141141
# NOTE:
142142
# Below version and release time auto-managed by 'make VERSION=x.y.z bump'.
143143
# Do NOT modify it manually. See 'Tagging policy' in 'birdhouse/README.rst'.
144-
'version': '2.20.0',
145-
'releaseTime': '2025-12-10T22:06:17Z',
144+
'version': '2.20.1',
145+
'releaseTime': '2025-12-16T18:09:59Z',
146146
'institution': '${BIRDHOUSE_INSTITUTION}',
147147
'researchSubject': '${BIRDHOUSE_SUBJECT}',
148148
'supportEmail': '${BIRDHOUSE_SUPPORT_EMAIL}',

birdhouse/components/proxy/default.env

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,9 @@ export OPTIONAL_VARS="
7171
\$PROXY_LISTEN_443_PARAMS
7272
\$PROXY_LISTEN_80_PARAMS
7373
"
74+
75+
# TODO: remove this dependency once https://github.com/bird-house/birdhouse-deploy/issues/618 is resolved
76+
COMPONENT_DEPENDENCIES="
77+
./components/scheduler
78+
./optional-components/scheduler-job-logrotate-nginx
79+
"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
config.yml
2+
nginx.logrotate
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
- name: logrotate-nginx
2+
comment: Rotate log files for nginx
3+
schedule: '${SCHEDULER_JOB_LOGROTATE_NGINX_JOB_SCHEDULE}'
4+
command: bash -c 'cp /etc/logrotate.conf.orig /etc/logrotate.conf && chown root:root /etc/logrotate.conf && chmod 644 /etc/logrotate.conf && /usr/sbin/logrotate -v /etc/logrotate.conf'
5+
dockerargs: >-
6+
--rm --name logrotate-nginx
7+
--volume ${COMPOSE_PROJECT_NAME}_proxy-logs:/var/log/nginx/:rw
8+
--volume ${COMPOSE_DIR}/optional-components/scheduler-job-logrotate-nginx/nginx.logrotate:/etc/logrotate.conf.orig:ro
9+
trigger:
10+
- command: sh -c '[ -f /var/run/nginx.pid ] && kill -USR1 $(cat /var/run/nginx.pid)'
11+
container: proxy
12+
image: 'stakater/logrotate:3.13.0'
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
services:
2+
proxy:
3+
volumes:
4+
- proxy-logs:${PROXY_LOG_DIR}
5+
6+
volumes:
7+
proxy-logs:

0 commit comments

Comments
 (0)