Merge lp:~ricardokirkner/locolander/celery-stack into lp:locolander

Proposed by Ricardo Kirkner
Status: Merged
Approved by: Ricardo Kirkner
Approved revision: 17
Merged at revision: 13
Proposed branch: lp:~ricardokirkner/locolander/celery-stack
Merge into: lp:locolander
Diff against target: 361 lines (+177/-81)
9 files modified
.bzrignore (+1/-0)
.locolander.yml (+1/-22)
README (+36/-46)
TODO (+43/-0)
config/supervisord.conf (+37/-0)
fabfile.py (+25/-0)
locolander/locolander/settings.py (+9/-10)
locolander/locolander/urls.py (+4/-0)
requirements.txt (+21/-3)
To merge this branch: bzr merge lp:~ricardokirkner/locolander/celery-stack
Reviewer Review Type Date Requested Status
Matias Bordese Approve
Review via email: mp+174567@code.launchpad.net

Commit message

added celery stack for async tasks

To post a comment you must log in.
17. By Ricardo Kirkner

disable TZ-aware datetime objects

Revision history for this message
Matias Bordese (matiasb) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2013-06-21 22:23:29 +0000
3+++ .bzrignore 2013-07-13 17:24:24 +0000
4@@ -1,2 +1,3 @@
5 docker/files/ssh
6 locolander.db
7+supervisord.log
8
9=== modified file '.locolander.yml'
10--- .locolander.yml 2013-06-29 22:14:32 +0000
11+++ .locolander.yml 2013-07-13 17:24:24 +0000
12@@ -1,26 +1,5 @@
13 precise:
14- pip:
15- distribute: 0.6.34
16- Django: 1.5.1
17- github3.py: 0.7.0
18- httplib2: 0.8.0
19- keyring: 1.5.0
20- launchpadlib: 1.10.2
21- lazr.authentication: 0.1.2
22- lazr.restfulclient: 0.13.3
23- lazr.uri: 1.0.3
24- mock: 1.0.1
25- oauth: 1.0.1
26- pep8: 1.4.5
27- pyflakes: 0.7.2
28- PyYAML: 3.10.0
29- requests: 1.2.3
30- simplejson: 3.3.0
31- South: 0.8.1
32- testresources: 0.2.7
33- wadllib: 1.3.2
34- wsgi-intercept: 0.5.1
35- zope.interface: 4.0.5
36+ pip: -r requirements.txt
37
38 metadata:
39 test_script: ./run_tests.sh
40
41=== modified file 'README'
42--- README 2013-06-21 20:26:50 +0000
43+++ README 2013-07-13 17:24:24 +0000
44@@ -1,50 +1,40 @@
45
46+==========
47 LocoLander
48 ==========
49
50-.. image:: locolander/locolanderweb/media/locolander.png
51-
52-
53-To Do
54-=====
55-
56-* automate docker bootstrap
57-
58- - install docker
59- - install squid
60- - setup squid as a global cache
61-
62-* generate Dockerfile
63-
64- - parse custom project file
65- - write Dockerfile for project image
66- - include "env http_proxy http://172.16.42.1:3128" in Dockerfile to use global squid cache
67-
68-* build project images
69-
70- - use generated Dockerfile to run 'docker build'
71-
72- - step1: install base image and system packages
73- - step2: download pip dependencies from PyPI
74- - step3: cut internet access
75- - step4: install pip dependencies from locally downloaded cache
76-
77- - tag built image with project name
78-
79-* main script
80-
81- - get target branch (trunk)
82- - merge source branch into target
83- - run tests
84- - capture output
85- - commit merge and push to target upstream
86-
87-* main process
88-
89- - build project image
90- - run main script in image
91- - extract output from container
92-
93-* prevent inbound/outbound network access inside of container
94-
95-* implement quotas (disk, cpu, mem)
96+.. image::- locolander/locolanderweb/media/locolander.png
97+
98+
99+Installing
100+==========
101+
102+As redis cannot be installed in a virtualenv, you'll need to install it from
103+the system packages
104+::
105+
106+ sudo apt-get install redis-server
107+
108+Everything else can be installed in a virtualenv
109+::
110+
111+ sudo apt-get install fabric
112+ fab bootstrap
113+
114+
115+Running
116+=======
117+
118+Once everything is installed, you can start the full stack easily
119+::
120+
121+ fab start_supervisor
122+
123+
124+Developing
125+==========
126+
127+In order to run the tests, you can just do
128+::
129+
130+ fab test
131
132=== added file 'TODO'
133--- TODO 1970-01-01 00:00:00 +0000
134+++ TODO 2013-07-13 17:24:24 +0000
135@@ -0,0 +1,43 @@
136+To Do
137+=====
138+
139+* automate docker bootstrap
140+
141+ - install docker
142+ - install squid
143+ - setup squid as a global cache
144+
145+* generate Dockerfile
146+
147+ - parse custom project file
148+ - write Dockerfile for project image
149+ - include "env http_proxy http://172.16.42.1:3128" in Dockerfile to use global squid cache
150+
151+* build project images
152+
153+ - use generated Dockerfile to run 'docker build'
154+
155+ - step1: install base image and system packages
156+ - step2: download pip dependencies from PyPI
157+ - step3: cut internet access
158+ - step4: install pip dependencies from locally downloaded cache
159+
160+ - tag built image with project name
161+
162+* main script
163+
164+ - get target branch (trunk)
165+ - merge source branch into target
166+ - run tests
167+ - capture output
168+ - commit merge and push to target upstream
169+
170+* main process
171+
172+ - build project image
173+ - run main script in image
174+ - extract output from container
175+
176+* prevent inbound/outbound network access inside of container
177+
178+* implement quotas (disk, cpu, mem)
179
180=== added directory 'config'
181=== added file 'config/supervisord.conf'
182--- config/supervisord.conf 1970-01-01 00:00:00 +0000
183+++ config/supervisord.conf 2013-07-13 17:24:24 +0000
184@@ -0,0 +1,37 @@
185+; Sample supervisor config file.
186+
187+[supervisord]
188+nodaemon = true
189+loglevel = info
190+logfile = supervisord.log
191+
192+
193+; service configuration sections
194+
195+[program:gunicorn]
196+command = gunicorn_django locolander/locolander/settings.py
197+autostart = true
198+autorestart = true
199+stdout_logfile = supervisord.log
200+redirect_stderr = true
201+
202+[program:redis]
203+command = redis-server
204+autostart = true
205+autorestart = true
206+stdout_logfile = supervisord.log
207+redirect_stderr = true
208+
209+[program:celeryd]
210+command = python locolander/manage.py celeryd
211+autostart = true
212+autorestart = true
213+stdout_logfile = supervisord.log
214+redirect_stderr = true
215+
216+[program:flower]
217+command = python locolander/manage.py celery flower
218+autostart = true
219+autorestart = true
220+stdout_logfile = supervisord.log
221+redirect_stderr = true
222
223=== modified file 'fabfile.py'
224--- fabfile.py 2013-07-09 18:42:01 +0000
225+++ fabfile.py 2013-07-13 17:24:24 +0000
226@@ -24,3 +24,28 @@
227 @virtualenv
228 def test():
229 local('./run_tests.sh')
230+
231+
232+@virtualenv
233+def start_redis():
234+ local('redis-server')
235+
236+
237+@virtualenv
238+def start_gunicorn():
239+ local('gunicorn_django locolander/locolander/settings.py')
240+
241+
242+@virtualenv
243+def start_celery():
244+ manage('celeryd')
245+
246+
247+@virtualenv
248+def start_flower():
249+ manage('celery flower')
250+
251+
252+@virtualenv
253+def start_supervisor():
254+ local('supervisord -c config/supervisord.conf -n')
255
256=== modified file 'locolander/locolander/settings.py'
257--- locolander/locolander/settings.py 2013-06-23 00:00:56 +0000
258+++ locolander/locolander/settings.py 2013-07-13 17:24:24 +0000
259@@ -2,9 +2,6 @@
260
261 import os
262
263-from django.core.urlresolvers import reverse
264-
265-
266 PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))
267
268 DEBUG = True
269@@ -134,6 +131,7 @@
270 # 'django.contrib.admindocs',
271 'locolanderweb',
272 'south',
273+ 'djcelery',
274 )
275
276 # A sample logging configuration. The only tangible logging
277@@ -165,10 +163,11 @@
278 }
279 }
280
281-LOGIN_URL = reverse('login')
282-LOGIN_REDIRECT_URL = reverse('home')
283-
284-try:
285- from local_setting import *
286-except:
287- pass
288+# settings for celery/redis
289+import djcelery
290+djcelery.setup_loader()
291+
292+BROKER_URL = 'redis://localhost:6379/0'
293+
294+LOGIN_URL = '/login/'
295+LOGIN_REDIRECT_URL = '/'
296
297=== modified file 'locolander/locolander/urls.py'
298--- locolander/locolander/urls.py 2013-06-23 00:00:56 +0000
299+++ locolander/locolander/urls.py 2013-07-13 17:24:24 +0000
300@@ -1,5 +1,6 @@
301 from django.conf.urls import patterns, include, url
302 from django.contrib import admin
303+from django.contrib.staticfiles.urls import staticfiles_urlpatterns
304 admin.autodiscover()
305
306
307@@ -14,3 +15,6 @@
308 # Uncomment the next line to enable the admin:
309 url(r'^admin/', include(admin.site.urls)),
310 )
311+
312+# enable staticfiles for gunicorn
313+urlpatterns += staticfiles_urlpatterns()
314
315=== modified file 'requirements.txt'
316--- requirements.txt 2013-07-13 15:38:09 +0000
317+++ requirements.txt 2013-07-13 17:24:24 +0000
318@@ -1,22 +1,40 @@
319-distribute==0.6.34
320+amqp==1.0.12
321+anyjson==0.3.3
322+billiard==2.7.3.31
323+bzr==2.6b2
324+celery==3.0.21
325+cssselect==0.8
326 Django==1.5.1
327+django-celery==3.0.17
328+flower==0.5.2
329 github3.py==0.7.0
330+gunicorn==17.5
331 httplib2==0.8
332 keyring==1.5
333+kombu==2.5.12
334 launchpadlib==1.10.2
335 lazr.authentication==0.1.2
336 lazr.restfulclient==0.13.3
337 lazr.uri==1.0.3
338+lxml==3.2.1
339+meld3==0.6.10
340 mock==1.0.1
341 oauth==1.0.1
342-pep8==1.4.5
343-pyflakes==0.7.2
344+pep8==1.4.6
345+pyflakes==0.7.3
346 pyquery==1.2.4
347+python-dateutil==2.1
348+pytz==2013b
349 PyYAML==3.10
350+redis==2.7.6
351 requests==1.2.3
352 simplejson==3.3.0
353+six==1.3.0
354 South==0.8.1
355+supervisor==3.0b2
356 testresources==0.2.7
357+tornado==3.1
358 wadllib==1.3.2
359 wsgi-intercept==0.5.1
360+wsgiref==0.1.2
361 zope.interface==4.0.5

Subscribers

People subscribed via source and target branches

to all changes: