move the hyperkitty logs out of the mailman-suite distribution dir. Add logrotate entries for all the mailman and postorious logs.

This commit is contained in:
Andrea Dell'Amico 2020-02-21 16:46:14 +01:00
parent 61ac52cf4e
commit b850932d43
5 changed files with 42 additions and 5 deletions

View File

@ -16,6 +16,9 @@ mailman_noreply_addr: 'noreply'
mailman_use_memcache: False
mailman_memcache_hosts: '127.0.0.1:11211'
mailman_site_url: 'http://localhost'
mailman_logrotate_freq: 'weekly'
mailman_logrotate_retain: 10
# Documentation that must be followed to configure the social auth providers
# https://django-allauth.readthedocs.io/en/latest/installation.html
mailman_use_social_account_providers: False
@ -101,7 +104,10 @@ mailman_antispam_header_checks:
mailman_start_nntp_runner: 'no'
mailman_repository: 'https://gitlab.com/mailman/mailman-suite.git'
mailman_postorious_log_dir: /var/log/mailmansuite
mailman_postorious_var_dir: var
mailman_postorious_log_base_dir: log
mailman_postorious_log_dest_dir: mailmansuite
mailman_postorious_log_dir: '/{{ mailman_postorious_var_dir }}/{{ mailman_postorious_log_base_dir }}/{{ mailman_postorious_log_dest_dir }}'
mailman_postorious_dir: '{{ mailman_home }}/mailman-suite/mailman-suite_project'
mailman_postorious_http_port: 8000
# 'systemd_logger,logfile,python36'
@ -125,5 +131,7 @@ mailman_postorious_db_user: mailmansuite_u
mailman_postorious_db_host: 'localhost'
mailman_postorious_db_port: ''
mailman_use_hyperkitty_archiver: True
# /opt/mailman/mailman-suite/mailman-suite_project/manage.py runjobs quarter_hourly
mailman_postorious_cronjob_frequency: 'quarter_hourly'

View File

@ -144,6 +144,14 @@
when: mailman_use_hyperkitty_archiver | bool
register: mailman_hyperkitty_install
- name: add a cron job that syncs the mailman core and postorious settings
cron:
job: "{{ mailman_postorious_dir }}/manage.py runjobs {{ mailman_postorious_cronjob_frequency }} > {{ mailman_postorious_log_dir }}/runjobs.log 2>&1"
special_time: hourly
user: '{{ mailman_user }}'
name: "postorious / hyperkitty runjobs"
state: present
tags: [ 'mailman', 'postorious', 'hyperkitty', 'mailman_conf' ]
- name: Manage the mailman service
@ -159,5 +167,11 @@
service: name=mailman state=restarted
when: mailman_hyperkitty_install is changed
- name: Install the mailman and mailmansuite logrotate configurations
template: src={{ item }}-logrotate.j2 dest=/etc/logrotate.d/{{ item }} owner=root mode=0444
with_items:
- 'mailman'
- 'mailman-postorious'
tags: [ 'mailman', 'postorious', 'hyperkitty', 'mailman_conf' ]

View File

@ -0,0 +1,8 @@
{{ mailman_log_dir }}/*.log {
copytruncate
{{ mailman_logrotate_freq }}
rotate {{ mailman_logrotate_retain }}
compress
missingok
create 640 {{ mailman_user }} adm
}

View File

@ -0,0 +1,8 @@
{{ mailman_postorious_log_dir }}/*.log {
copytruncate
{{ mailman_logrotate_freq }}
rotate {{ mailman_logrotate_retain }}
compress
missingok
create 640 {{ mailman_user }} adm
}

View File

@ -392,7 +392,6 @@ Q_CLUSTER = {
'orm': 'default',
}
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
@ -416,7 +415,7 @@ LOGGING = {
'level': 'INFO',
#'class': 'logging.handlers.RotatingFileHandler',
'class': 'logging.handlers.WatchedFileHandler',
'filename': os.path.join(BASE_DIR, 'logs', 'mailmansuite.log'),
'filename': os.path.join('..', '..', '..', '..', '{{ mailman_postorious_var_dir }}', '{{ mailman_postorious_log_base_dir }}', '{{ mailman_postorious_log_dest_dir }}', 'mailmansuite.log'),
'formatter': 'verbose',
},
'console': {
@ -437,11 +436,11 @@ LOGGING = {
},
'hyperkitty': {
'handlers': ['file'],
'level': 'DEBUG',
'level': 'ERROR',
'propagate': True,
},
'postorius': {
'handlers': ['console', 'file'],
'handlers': ['file'],
'level': 'INFO',
},
},