Merge lp:~cjohnston/uci-engine/p-d-logging into lp:uci-engine

Proposed by Chris Johnston
Status: Merged
Approved by: Chris Johnston
Approved revision: 536
Merged at revision: 547
Proposed branch: lp:~cjohnston/uci-engine/p-d-logging
Merge into: lp:uci-engine
Diff against target: 121 lines (+29/-12)
4 files modified
charms/precise/python-django/config.yaml (+4/-0)
charms/precise/python-django/hooks/hooks.py (+17/-8)
juju-deployer/ppa-assigner.yaml.tmpl (+4/-2)
juju-deployer/ticket-system.yaml.tmpl (+4/-2)
To merge this branch: bzr merge lp:~cjohnston/uci-engine/p-d-logging
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Andy Doan (community) Approve
Review via email: mp+222272@code.launchpad.net

Commit message

Add ability to specify where gunicorn logging happens from the python-django charm.

To post a comment you must log in.
Revision history for this message
Andy Doan (doanac) wrote :

i loathe this "instance_type" stuff, but that's out of our control.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:536
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/802/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/802/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charms/precise/python-django/config.yaml'
2--- charms/precise/python-django/config.yaml 2014-05-30 14:46:01 +0000
3+++ charms/precise/python-django/config.yaml 2014-06-06 20:03:25 +0000
4@@ -67,6 +67,10 @@
5 type: string
6 default: "/srv/"
7 description: The root directory to checkout to.
8+ instance_type:
9+ type: string
10+ default: "development"
11+ description: "Instance type (development, staging, or production)"
12 application_path:
13 type: string
14 default: ""
15
16=== modified file 'charms/precise/python-django/hooks/hooks.py'
17--- charms/precise/python-django/hooks/hooks.py 2014-06-05 15:32:53 +0000
18+++ charms/precise/python-django/hooks/hooks.py 2014-06-06 20:03:25 +0000
19@@ -788,7 +788,14 @@
20
21 if not config_data['python_path']:
22 relation_set({'python_path': install_root})
23-
24+ if config_data['wsgi_log_file']:
25+ relation_set(
26+ {'wsgi_log_file': os.path.join(
27+ django_logs_dir, config_data['wsgi_log_file'])})
28+ if config_data['wsgi_access_logfile']:
29+ relation_set(
30+ {'wsgi_access_logfile': os.path.join(
31+ django_logs_dir, config_data['wsgi_access_logfile'])})
32 open_port(config_data['port'])
33
34
35@@ -919,19 +926,21 @@
36 django_south = config_data['django_south']
37 if django_south:
38 CHARM_PACKAGES.append('python-django-south')
39-
40+instance_type = config_data['instance_type']
41 unit_name = os.environ['JUJU_UNIT_NAME'].split('/')[0]
42 sanitized_unit_name = sanitize(unit_name)
43-vcs_clone_dir = os.path.join(install_root, sanitized_unit_name)
44+base_dir = os.path.join(install_root, sanitized_unit_name)
45+django_settings_modules = '.'.join([sanitized_unit_name, django_settings])
46+django_settings_modules = django_settings # andy hack
47+django_run_dir = os.path.join(base_dir, instance_type + '-run')
48+django_logs_dir = os.path.join(base_dir, instance_type + '-logs')
49+if config_data['wsgi_log_file'] or config_data['wsgi_access_logfile']:
50+ install_dir(django_logs_dir, owner=wsgi_user, group=wsgi_group, mode=0755)
51+vcs_clone_dir = os.path.join(base_dir, instance_type)
52 if application_path:
53 working_dir = os.path.join(vcs_clone_dir, application_path)
54 else:
55 working_dir = vcs_clone_dir
56-
57-django_settings_modules = '.'.join([sanitized_unit_name, django_settings])
58-django_settings_modules = django_settings # andy hack
59-django_run_dir = os.path.join(working_dir, "run/")
60-django_logs_dir = os.path.join(working_dir, "logs/")
61 settings_py_path = os.path.join(working_dir, 'settings.py')
62 urls_py_path = os.path.join(working_dir, 'urls.py')
63 settings_dir_path = os.path.join(working_dir, config_data["settings_dir_name"])
64
65=== modified file 'juju-deployer/ppa-assigner.yaml.tmpl'
66--- juju-deployer/ppa-assigner.yaml.tmpl 2014-06-03 18:17:09 +0000
67+++ juju-deployer/ppa-assigner.yaml.tmpl 2014-06-06 20:03:25 +0000
68@@ -13,12 +13,14 @@
69 django_settings: ppa_assigner.settings
70 django_south: True
71 hostname: ppa-assigner
72- python_path: /srv/ci_airline_ppa_django/ci-utils:/srv/ci_airline_ppa_django/ppa-assigner
73+ python_path: /srv/ci_airline_ppa_django/development/ci-utils:/srv/ci_airline_ppa_django/development/ppa-assigner
74 unit-config: include-base64://configs/unit_config.yaml
75 json_status_path: api/v1/status/
76 nagios_check_http_params: -H ppa-assigner -I 127.0.0.1 -e '
77 200 OK' --url='/api/v1/' -p 8080
78 nagios_context: ci-airline-staging
79+ wsgi_log_file: gunicorn.log
80+ wsgi_access_logfile: access.log
81 ci-airline-ppa-postgres:
82 branch: lp:charms/precise/postgresql@84
83 charm: postgresql
84@@ -26,7 +28,7 @@
85 branch: lp:charms/gunicorn@30
86 charm: gunicorn
87 options:
88- python_path: /srv/ci_airline_ppa_django/ci-utils:/srv/ci_airline_ppa_django/ppa-assigner
89+ python_path: /srv/ci_airline_ppa_django/development/ci-utils:/srv/ci_airline_ppa_django/development/ppa-assigner
90 relations:
91 # Relations should be explicit as amulet can't infer them otherwise
92 # even if there is a single one
93
94=== modified file 'juju-deployer/ticket-system.yaml.tmpl'
95--- juju-deployer/ticket-system.yaml.tmpl 2014-06-04 19:40:33 +0000
96+++ juju-deployer/ticket-system.yaml.tmpl 2014-06-06 20:03:25 +0000
97@@ -28,12 +28,14 @@
98 django_south: True
99 django_debug: True
100 hostname: ci-airline.staging.canonical.com
101- python_path: /srv/ci_airline_ts_django/ci-utils:/srv/ci_airline_ts_django/ticket_system
102+ python_path: /srv/ci_airline_ts_django/development/ci-utils:/srv/ci_airline_ts_django/development/ticket_system
103 # this gets shared with gunicorn via a relation-set in this charm
104 wsgi_wsgi_file: ticket_system.wsgi:application
105 nagios_check_http_params: -H ci-airline.staging.canonical.com -I 127.0.0.1 -e '
106 200 OK' --url='/api/v1/' -p 8080
107 nagios_context: ci-airline-staging
108+ wsgi_log_file: gunicorn.log
109+ wsgi_access_logfile: access.log
110 ci-airline-ts-postgres:
111 branch: lp:charms/precise/postgresql@84
112 charm: postgresql
113@@ -41,7 +43,7 @@
114 branch: lp:charms/gunicorn@30
115 charm: gunicorn
116 options:
117- python_path: /srv/ci_airline_ts_django/ci-utils:/srv/ci_airline_ts_django/ticket_system
118+ python_path: /srv/ci_airline_ts_django/development/ci-utils:/srv/ci_airline_ts_django/development/ticket_system
119 ci-airline-rabbit:
120 branch: lp:~canonical-ci-engineering/charms/precise/uci-engine/rabbitmq-server@46
121 charm: rabbitmq

Subscribers

People subscribed via source and target branches