This repository has been archived by the owner on Oct 16, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
485 lines (403 loc) · 15.5 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>webcamp zg 2012</title>
<meta name="description" content="webcamp 2012 presentation">
<meta name="author" content="Aljosa Mohorovic">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<link href='http://fonts.googleapis.com/css?family=Titillium+Web&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/theme/default.css" id="theme">
<!-- For syntax highlighting -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<script>
// If the query includes 'print-pdf' we'll use the PDF print sheet
document.write( '<link rel="stylesheet" href="css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Used to fade in a background when a specific slide state is reached -->
<div class="state-background"></div>
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<h2>WebCampZg 2012</h2>
<h1>Kako pretjerati sa jednostavnom idejom?</h1>
<p>
...
</p>
<h2 style="font-family:'Titillium Web', sans-serif; font-size:1.1em;">Aljoša Mohorović</h2>
<p>
<i>
<small>
<a target="_blank" href="https://github.com/aljosa">github.com/aljosa</a>
/
<a target="_blank" href="https://twitter.com/maljosa">twitter.com/maljosa</a>
<br />
<a target="_blank" href="mailto:[email protected]">[email protected]</a>
</small>
</i>
</p>
</section>
<section>
<h2>Python</h2>
<p>...</p>
<h2>Heroku</h2>
<p>...</p>
<h2>jednostavna ideja?</h2>
</section>
<section>
<h1>ideja!</h1>
<br />
<h2>Github repo ➔ AWS S3</h2>
</section>
<section data-markdown>
# shell
<pre>
<code contenteditable>
$ git clone repo
$ tar -cjf repo.tar.bz2 repo
$ s3put [...]
</code>
</pre>
</section>
<section>
<h1>servis</h1>
<h3>Python/Django projekt</h3>
<ul>
<li>servis ➔ Github API (user/repo info)</li>
<li>servis ➔ async. kopiraj github repo</li>
<li>servis ➔ async. spremi na AWS S3</li>
</ul>
</section>
<section data-markdown>
# Python setup
<p>
<a target="_blank" href="http://www.python.org">www.python.org</a>
</p>
<pre>
<code contenteditable>
$ virtualenv env
$ source env/bin/activate
$ pip install Django ...
</code>
</pre>
</section>
<section data-markdown>
# Django setup
<p>
<a target="_blank" href="https://www.djangoproject.com">www.djangoproject.com</a>
</p>
<pre>
<code contenteditable>
$ django-admin.py startproject gh_archive
$ django-admin.py startapp accounts
... settings ...
$ django-admin.py syncdb
$ django-admin.py runserver
</code>
</pre>
</section>
<section data-markdown>
# Github / requests
<p>
<a target="_blank" href="http://python-requests.org">python-requests.org</a>
</p>
<pre>
<code contenteditable>
$ pip install requests
# code:
def get_token(code):
...
resp = requests.post(url, data=payload, headers=...)
data = json.loads(resp.text)
...
token = data['access_token']
return token
def get_repos(token):
...
resp = requests.get(repos_url, headers=headers)
data = json.loads(resp.text)
...
return data
</code>
</pre>
</section>
<section data-markdown>
# AWS S3 / boto
<p>
<a target="_blank" href="http://boto.cloudhackers.com">boto.cloudhackers.com</a>
</p>
<pre>
<code contenteditable>
$ pip install boto
# code:
def create_bucket():
...
s3 = boto.connect_s3()
bucket = s3.create_bucket(bucket_name)
return bucket_name
</code>
</pre>
</section>
<section data-markdown>
# (Async) repo ➔ AWS S3
<p>
<a target="_blank" href="http://www.celeryproject.org">www.celeryproject.org</a>
</p>
<pre>
<code contenteditable>
$ pip install celery
# code:
from celery import Celery
from django.conf import settings
celery = Celery("tasks", broker=settings.BROKER_URL)
@celery.task
def clone_repo(clone_url, token):
...
def backup_repo(request, owner, repo):
...
clone_repo.delay(clone_url, token)
...
</code>
</pre>
</section>
<section data-markdown>
# code ➔ github
<pre>
<code contenteditable>
$ pip freeze > requirements.txt
$ git init
$ git add ...
$ git commit -m "initial files"
$ git remote add origin [email protected]:...
$ git push origin master
</code>
</pre>
</section>
<section data-markdown>
# hosting? deployment?
<p>
<a target="_blank" href="http://www.heroku.com">www.heroku.com</a>
</p>
<pre>
<code contenteditable>
$ cat Procfile
web: gunicorn wsgi:application [...]
celery: celery -A accounts.tasks worker [...]
$ heroku create
$ git push heroku master
</code>
</pre>
</section>
<section data-markdown>
# db? async? ...?
<p>
<a target="_blank" href="https://addons.heroku.com">addons.heroku.com</a>
</p>
<pre>
<code contenteditable>
# http://www.postgresql.org
$ heroku addons:add heroku-postgresql:PLAN
# http://www.rabbitmq.com
$ heroku addons:add cloudamqp:PLAN
# code:
... settings ...
$ git push heroku master
</code>
</pre>
</section>
<section>
<h1>heroku dyno</h1>
<p>
<a target="_blank" href="https://devcenter.heroku.com/articles/dynos">https://devcenter.heroku.com/articles/dynos</a>
</p>
<h3>LXC (Linux Container)</h3>
<h3>non persistent filesystem</h3>
<h3>512MB ram / 1G swap</h3>
</section>
<section>
<h1>heroku slug</h1>
<p>
<a target="_blank" href="https://devcenter.heroku.com/articles/slug-compiler">https://devcenter.heroku.com/articles/slug-compiler</a>
</p>
<p>
<strong>kod</strong> bez nepotrebnih stvari i sve
<br />
iz <strong>requirements.txt</strong> strpano u
<br />
jednu <strong>arhivu</strong>
</p>
</section>
<section data-markdown>
# git push, dyno, slug, ...?
<p>
<a target="_blank" href="https://devcenter.heroku.com/articles/scaling">https://devcenter.heroku.com/articles/scaling</a>
</p>
<p>
jednostavno i brzo scale-anje
</p>
<pre>
<code contenteditable>
$ heroku ps:scale web=2 celery=5
Scaling web processes... done, now running 2
Scaling celery processes... done, now running 5
</code>
</pre>
</section>
<section data-markdown>
# heroku runtime
<p>
<a target="_blank" href="https://devcenter.heroku.com/articles/buildpacks">https://devcenter.heroku.com/articles/buildpacks</a>
</p>
<pre>
<code contenteditable>
# default python buildpack
$ heroku config:add BUILDPACK_URL=\
git://github.com/heroku/heroku-buildpack-python.git
# custom buildpack, npr. PyPy
$ heroku config:add BUILDPACK_URL=\
git://github.com/mtigas/heroku-buildpack-pypy.git
</code>
</pre>
</section>
<section data-markdown>
# heroku run
<p>
<a target="_blank" href="https://devcenter.heroku.com/articles/oneoff-admin-ps">https://devcenter.heroku.com/articles/oneoff-admin-ps</a>
</p>
<pre>
<code contenteditable>
$ heroku run bash
$ heroku run django-admin.py syncdb
$ heroku run django-admin.py shell
</code>
</pre>
</section>
<section data-markdown>
# heroku logs
<p>
<a target="_blank" href="https://devcenter.heroku.com/articles/logging">https://devcenter.heroku.com/articles/logging</a>
</p>
<pre>
<code contenteditable>
$ heroku logs
$ heroku logs --tail
$ heroku logs -t -p web
$ heroku logs -t -p celery
$ heroku logs --help
</code>
</pre>
</section>
<section data-markdown>
# heroku releases
<p>
<a target="_blank" href="https://devcenter.heroku.com/articles/releases">https://devcenter.heroku.com/articles/releases</a>
</p>
<pre>
<code contenteditable>
$ heroku releases
=== app-name Releases
v168 Deploy dd0953b aljosa[...] 2012/11/09 16:01:56
v167 Deploy 9623355 aljosa[...] 2012/11/09 15:55:16
v166 Deploy 46b63cf aljosa[...] 2012/11/08 16:29:55
v165 Deploy 3923bbf aljosa[...] 2012/11/08 16:25:28
v164 Deploy 804393c aljosa[...] 2012/11/08 16:15:12
v163 Deploy e386d5b aljosa[...] 2012/11/08 15:54:42
v162 Deploy ca05c71 aljosa[...] 2012/11/08 14:30:04
v161 Deploy 3139f43 aljosa[...] 2012/11/08 13:57:57
v160 Deploy 069ac6a aljosa[...] 2012/11/08 13:44:08
$ heroku rollback v165
Rolled back to v165
</code>
</pre>
</section>
<section data-markdown>
# heroku plugins
<p>
<a target="_blank" href="https://devcenter.heroku.com/articles/using-cli-plugins">https://devcenter.heroku.com/articles/using-cli-plugins</a>
</p>
<pre>
<code contenteditable>
$ heroku plugins:install \
git://github.com/ddollar/heroku-accounts.git
$ heroku accounts:set work
$ heroku accounts:set personal
$ heroku plugins:install \
git://github.com/heroku/heroku-pg-extras.git
$ heroku pg:locks
</code>
</pre>
</section>
<section>
<h1>problemi!</h1>
<h3>heroku je skup (min. $50/m)</h3>
<h3>heroku koristi AWS (upitno?)</h3>
</section>
<section>
<h1>cilj je proizvod</h1>
<h3>ne razvoj procesa</h3>
<h3>ne razvoj servisa potrebnih za razvoj proizvoda</h3>
<h3>ne kompromisi pri odabiru tehnologija</h3>
</section>
<section>
<h2>WebCampZg 2012</h2>
<h1>Kako pretjerati sa jednostavnom idejom?</h1>
<p>
...
</p>
<h2 style="font-family:'Titillium Web', sans-serif; font-size:1.1em;">Aljoša Mohorović</h2>
<p>
<i>
<small>
<a target="_blank" href="https://github.com/aljosa">github.com/aljosa</a>
/
<a target="_blank" href="https://twitter.com/maljosa">twitter.com/maljosa</a>
<br />
<a target="_blank" href="mailto:[email protected]">[email protected]</a>
</small>
</i>
</p>
</section>
</div>
<!-- The navigational controls UI -->
<aside class="controls">
<a class="left" href="#">◄</a>
<a class="right" href="#">►</a>
<a class="up" href="#">▲</a>
<a class="down" href="#">▼</a>
</aside>
<!-- Presentation progress bar -->
<div class="progress"><span></span></div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.min.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
theme: Reveal.getQueryHash().theme || 'beige', // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/linear(2d)
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'lib/js/highlight.js', async: true, callback: function() { window.hljs.initHighlightingOnLoad(); } },
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'lib/js/showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'lib/js/data-markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: '/socket.io/socket.io.js', async: true, condition: function() { return window.location.host === 'localhost:1947'; } },
{ src: 'plugin/speakernotes/client.js', async: true, condition: function() { return window.location.host === 'localhost:1947'; } },
]
});
</script>
</body>
</html>