Setup logging in the appliance

The appliance currently tries to log to /tmp/gunicorn.log, but thats
misconfigured.  This sets gunicorn up to log to /var/log/akanda/ for
both access and error logs and installs and configures logrotate for
those files.

Change-Id: Ie75f305860a0c5204ec8fe5b1af0de03826aa880
This commit is contained in:
Adam Gandelman 2015-06-04 11:20:03 -07:00
parent aa72fd46b5
commit de7c6f7d3c
3 changed files with 19 additions and 1 deletions

View File

@ -5,6 +5,7 @@
with_items:
- python-pip
- python-dev
- logrotate
- name: copy akanda-appliance code
synchronize: src={{ playbook_dir }}/.. dest=/tmp/akanda-appliance
@ -18,6 +19,12 @@
- name: install akanda-appliance
command: python setup.py install chdir=/tmp/akanda-appliance
- name: install akanda gunicorn logging directory
file: path=/var/log/akanda state=directory
- name: install akanda logrotate config
template: src=logrotate.j2 dest=/etc/logrotate.d/akanda
- name: install gunicorn config file
template: src=gunicorn.j2 dest=/etc/akanda_gunicorn_config

View File

@ -7,4 +7,5 @@ worker_class ="sync"
debug = False
daemon = True
pidfile = "/var/run/gunicorn.pid"
errorfile = "/tmp/gunicorn.log"
errorlog = "/var/log/akanda/gunicorn_error.log"
accesslog = "/var/log/akanda/gunicorn_access.log"

View File

@ -0,0 +1,10 @@
/var/log/akanda/*.log {
weekly
rotate 7
compress
missingok
create 644 root root
postrotate
kill -USR1 `cat /var/run/gunicorn.pid`
endscript
}