From db65dfd2bb10ea185298c2f922b40f1e9db058c0 Mon Sep 17 00:00:00 2001 From: Adri Date: Fri, 30 Sep 2016 19:52:43 +1000 Subject: [PATCH 1/2] Extend harakiri for uwsgi worker processes Facilitates questionnaire uploads from slower connections --- provision/roles/webserver/production/templates/uwsgi.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/provision/roles/webserver/production/templates/uwsgi.ini b/provision/roles/webserver/production/templates/uwsgi.ini index 7066d8b68..cbd0528bd 100644 --- a/provision/roles/webserver/production/templates/uwsgi.ini +++ b/provision/roles/webserver/production/templates/uwsgi.ini @@ -16,7 +16,7 @@ chmod-socket = 666 vacuum = true pidfile = /tmp/cadasta-master.pid -harakiri = 20 +harakiri = 60 max-requests = 5000 daemonize = /var/log/uwsgi/cadasta.log From 944ddd257565dbc3765d7bf6004061246c3bdcbb Mon Sep 17 00:00:00 2001 From: amplifi Date: Fri, 30 Sep 2016 23:02:43 +1000 Subject: [PATCH 2/2] Add cron job to prune MEDIA_ROOT files Runs daily at 12:05AM to remove media files more than 1 day old --- provision/roles/webserver/production/tasks/main.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/provision/roles/webserver/production/tasks/main.yml b/provision/roles/webserver/production/tasks/main.yml index 532566c25..391c412a6 100644 --- a/provision/roles/webserver/production/tasks/main.yml +++ b/provision/roles/webserver/production/tasks/main.yml @@ -92,6 +92,13 @@ src="{{ application_path }}app/dist" state=link +- name: Create cron job to prune MEDIA_ROOT files + become: yes + become_user: root + cron: name="prune django media files" minute=5 hour=0 + user="root" + job="find {{ application_path }}cadasta/media/s3/* -type f -ctime +1 -exec rm {} \\; > /var/log/django/prune_media.log" + - name: Copy uwsgi_params to base directory become: yes become_user: "{{ app_user }}"