From f93a0b3cd99c8d60e2f9724a539dd79ffe665567 Mon Sep 17 00:00:00 2001 From: tech Date: Mon, 18 Aug 2014 12:23:39 +0300 Subject: [PATCH] UK/ME: add celery logrotate config, closes #483 --- extras/celeryd/etc/logrotate.d/celeryd | 12 ++++++++++++ fabfile.py | 10 +++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 extras/celeryd/etc/logrotate.d/celeryd diff --git a/extras/celeryd/etc/logrotate.d/celeryd b/extras/celeryd/etc/logrotate.d/celeryd new file mode 100644 index 0000000000..419199c6e9 --- /dev/null +++ b/extras/celeryd/etc/logrotate.d/celeryd @@ -0,0 +1,12 @@ +/var/log/celery/*.log { + daily + size 30M + missingok + rotate 52 + compress + delaycompress + create 666 ubuntu ubuntu + notifempty + copytruncate +} + diff --git a/fabfile.py b/fabfile.py index 3cc1817144..267f46a77f 100644 --- a/fabfile.py +++ b/fabfile.py @@ -3,7 +3,7 @@ from subprocess import check_call import sys -from fabric.api import cd, env, prefix, run +from fabric.api import cd, env, prefix, run, sudo from fabric.contrib import files from fabric.operations import put @@ -169,3 +169,11 @@ def update_xforms(deployment_name, username, path): finally: run('rm -r /tmp/%s /tmp/%s.tgz' % (dir_name, dir_name)) check_call(['rm', path_compressed]) + + +def deploy_logrotate_celery(deployment_name, branch='master'): + setup_env(deployment_name) + with cd(env.code_src): + run("git fetch origin") + run("git checkout origin/%s" % branch) + sudo("cp extras/celeryd/etc/logrotate.d/celeryd /etc/logrotate.d/")