diff --git a/rattail_fabric2/backup.py b/rattail_fabric2/backup.py index 168622a..d2e4788 100644 --- a/rattail_fabric2/backup.py +++ b/rattail_fabric2/backup.py @@ -66,6 +66,7 @@ def deploy_backup_app(c, deploy, envname, mkvirtualenv=True, user='rattail', everything=None, crontab=None, runat=UNSPECIFIED, + logrotate=False, context={}): """ Make an app which can run backups for the server. @@ -228,3 +229,8 @@ def deploy_backup_app(c, deploy, envname, mkvirtualenv=True, user='rattail', deploy(c, crontab, '/etc/cron.d/backup', context=crontab_context, use_sudo=True) else: deploy_generic(c, 'backup/crontab.mako', '/etc/cron.d/backup', context=crontab_context, use_sudo=True) + + # logrotate + if logrotate: + deploy_generic(c, 'backup/logrotate.conf', '/etc/logrotate.d/backup', + use_sudo=True) diff --git a/rattail_fabric2/deploy/backup/logrotate.conf b/rattail_fabric2/deploy/backup/logrotate.conf new file mode 100644 index 0000000..401f1a6 --- /dev/null +++ b/rattail_fabric2/deploy/backup/logrotate.conf @@ -0,0 +1,10 @@ + +/srv/envs/backup/app/log/rattail.log { + daily + missingok + rotate 30 + compress + delaycompress + notifempty + create 600 rattail rattail +}