-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
581 lines (446 loc) · 18.6 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
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=1024" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>Docker Based Dev Envs</title>
<meta name="description" content="A presentation about Docker based dev envs" />
<meta name="author" content="René Olivo" />
<link href="http://fonts.googleapis.com/css?family=Varela+Round|Open+Sans:regular,semibold,italic,italicsemibold|PT+Sans:400,700,400italic,700italic|PT+Serif:400,700,400italic,700italic" rel="stylesheet" />
<link href="css/impress-demo.css" rel="stylesheet" />
<link href="css/animations.css" rel="stylesheet" />
<link rel="shortcut icon" href="favicon.png" />
<link rel="apple-touch-icon" href="apple-touch-icon.png" />
</head>
<body class="impress-not-supported">
<div class="fallback-message">
<p>Your browser <b>doesn't support the features required</b> by impress.js, so you are presented with a simplified version of this presentation.</p>
<p>For the best experience please use the latest <b>Chrome</b>, <b>Safari</b> or <b>Firefox</b> browser.</p>
</div>
<div id="impress">
<div id="intro" class="slide step" data-x="-2000" data-y="-2000" data-scale="3">
<img class="float" src="images/docker-logo.jpg" alt="Docker" width="400" />
<h1 class="float">Based Dev Envs</h1>
</div>
<div id="about-me" class="step slide columns" data-x="0" data-y="-2000" data-scale="1" data-rotate="-90">
<h2>About me:</h2>
<div class="column center">
<img class="rounded" src="images/rene-olivo.png" alt="René Olivo" />
<a href="https://twitter.com/rene_olivo">@rene_olivo</a>
</div>
<div class="column">
<h3>René Olivo</h3>
<p>
Has been around since GIFs were popular.
Loves front-end development, learning, sharing, and beer (a bit too much).
</p>
</div>
</div>
<div id="contents" class="step slide" data-x="2000" data-y="-2000" data-scale="2" data-rotate="-180">
<h2>Contents</h2>
<ul>
<li>Why should you be using Docker?</li>
<li>How can Docker help your team?</li>
<li>Dockerfile / Docker-compose.</li>
<li>Tips and tricks.</li>
</ul>
</div>
<div id="why-should-you-use-docker" class="step slide" data-x="0" data-y="100" data-scale="4">
<p>Why you should be using</p>
<h2>Docker</h2>
</div>
<div class="step" data-x="-1100" data-y="500" data-rotate="0" data-scale="1">
<p>Your software stack can be quite complex</p>
<div class="images-slide-up two-per-row">
<img src="images/logos/python.png" alt="Python Logo" width="150" />
<img src="images/logos/postgresql.png" alt="PostgreSQL Logo" width="150" />
<img src="images/logos/redis.png" alt="Redis Logo" width="150" />
<img src="images/logos/js.jpg" alt="Javascript Logo" width="150" />
</div>
</div>
<div class="step" data-x="0" data-y="500" data-rotate="0" data-scale="1">
<p>And your team can be very diverse and specialized</p>
<div class="images-slide-up">
<img src="images/devs/a.png" alt="Developer" />
<img src="images/devs/b.png" alt="Developer" />
<img src="images/devs/c.png" alt="Developer" />
<img src="images/devs/d.png" alt="Developer" />
</div>
</div>
<div class="step" data-x="1000" data-y="420" data-rotate="0" data-scale="1">
<p>This can lead to a fractured development process</p>
<img class="float" src="images/devs/fractured-team.png" alt="Fractured Development Team" />
</div>
<div class="step slide" data-x="100" data-y="2400" data-z="3000" data-rotate="-360" data-scale="1">
<div class="column wide-x-3">
<p>And this is where Docker <b>shines</b>!</p>
<small>It can provide a group of containers with all the services required by the project,
delivering a development environment that everyone in the team can benefit from.</small>
</div>
<br />
<div class="column center">
<img src="images/logos/docker-crate.png" alt="Docker Container" width="200" />
</div>
</div>
<div class="step slide" data-x="100" data-y="2400" data-z="-3000" data-rotate="0">
<img class="float-left" src="images/cowboy-hat.png" alt="Riding solo developer" width="200" />
<ul>
<li>Riding <b>solo</b>?</li>
<li>Only <b>developer</b> on the project?</li>
</ul>
<img class="tumbleweed" src="images/tumbleweed.png" alt="tumbleweed" width="140" />
</div>
<div class="step slide center" data-x="100" data-y="2400" data-z="-44000" data-rotate="-360" data-scale="1">
<img src="images/pc-bloat.png" alt="PC Services bloat" />
<p>Docker can help you reduce <b>PC bloat</b>!</p>
</div>
<div id="ing" class="step" data-x="3500" data-y="-200" data-rotate="270" data-scale="6">
<p>
How can <b>teams</b>, integrate <b>Docker</b>
into their <b>Development Process</b>?
</p>
</div>
<div class="step slide" data-x="2500" data-y="1800" data-rotate="270" data-scale="1">
<h2>Running <u>One Off</u> commands:</h2>
<pre>
docker run -it --rm \
--user "$(id -u):$(id -g)" \
-v "$PWD":/usr/src/app \
-w /usr/src/app \
django django-admin.py startproject <b>project_name</b>
</pre>
</div>
<div class="step slide columns" data-x="3000" data-y="1800" data-rotate="270" data-scale="1">
<h2>Defining our environemnts</h2>
<p>We can define our environment with the help of these two types of files:</p>
<div class="column center">
<img src="images/doc.png" alt="Dockerfile document" />
<h4>Dockerfile</h4>
<p>
Defines a container and sets it in an known state.<br />
For example, install a service and configure its default values.
</p>
</div>
<div class="column center">
<img src="images/doc.png" alt="docker-compose.yml document" />
<h4>docker-compose.yml</h4>
<p>
Simplifies the startup process of all the containers, the ports bindings,
and the disk volumes to synchronize locally.
</p>
</div>
</div>
<div class="step slide" data-x="3700" data-y="1800" data-rotate="270" data-rotate-y="90" data-scale="1">
<h2>Dockerfile</h2>
<pre>
FROM django:1.9.2
ADD ./requirements.txt /usr/src/app/requirements.txt
WORKDIR /usr/src/app
RUN pip install -r requirements.txt
ADD ./manage.py /usr/src/app/manage.py
</pre>
</div>
<div class="step slide" data-x="3700" data-y="1800" data-z="-400" data-rotate="270" data-rotate-y="90" data-scale="1">
<h2>docker-compose.yml</h2>
<pre>
hello_django_app:
build: .
volumes:
- ./hello_django:/usr/src/app/hello_django
ports:
- 8000:8000
command: python manage.py runserver 0.0.0.0:8000
</pre>
</div>
<div class="step slide" data-x="4000" data-y="1800" data-z="-1300" data-rotate="270" data-rotate-y="0" data-scale="1">
<h2>Creating and starting the services</h2>
<pre class="small">
docker-compose build
docker-compose up
</pre>
</div>
<div class="step slide" data-x="3700" data-y="1800" data-z="-900" data-rotate="270" data-rotate-y="90" data-scale="1">
<h2>Linking a Postgres DB</h2>
<pre class="small">
hello_django_app:
build: .
volumes:
- ./hello_django:/usr/src/app/hello_django
ports:
- 8000:8000
command: sh ./init.sh
links:
- hello_django_db
hello_django_db:
image: postgres:latest
ports:
- 5432:5432
environment:
- POSTGRES_DB=hello_django_db
extends:
file: env-vars.yml
service: hello_django_env_vars
</pre>
</div>
<div class="step slide no-future" data-x="3700" data-y="1800" data-z="-900" data-rotate="270" data-rotate-y="90" data-scale="1">
<h2>Linking a Postgres DB</h2>
<pre class="small">
hello_django_app:
build: .
volumes:
- ./hello_django:/usr/src/app/hello_django
ports:
- 8000:8000
command: sh ./init.sh
<b class="highlight">links:
- hello_django_db</b>
<b class="highlight">hello_django_db:</b>
image: postgres:latest
ports:
- 5432:5432
environment:
- POSTGRES_DB=hello_django_db
extends:
file: env-vars.yml
service: hello_django_env_vars
</pre>
</div>
<div class="step slide no-future" data-x="3700" data-y="1800" data-z="-900" data-rotate="270" data-rotate-y="90" data-scale="1">
<h2>Linking a Postgres DB</h2>
<pre class="small">
hello_django_app:
build: .
volumes:
- ./hello_django:/usr/src/app/hello_django
ports:
- 8000:8000
command: sh ./init.sh
links:
- hello_django_db
hello_django_db:</b>
image: postgres:latest
ports:
- 5432:5432
<b class="highlight">environment:
- POSTGRES_DB=hello_django_db
extends:
file: env-vars.yml
service: hello_django_env_vars</b>
</pre>
</div>
<div class="step slide" data-x="3700" data-y="900" data-z="-900" data-rotate="270" data-rotate-y="90" data-scale="1">
<h2>Private environment file</h2>
<pre>
<span class="muted"># env-vars.yml</span>
hello_django_env_vars:
environment:
- POSTGRES_USER=admin
- POSTGRES_PASSWORD=super-secret-password
</pre>
</div>
<div class="step slide" data-x="3700" data-y="900" data-z="-1300" data-rotate="270" data-rotate-y="90" data-scale="1">
<h2>Python settings</h2>
<pre class="small">
<span class="muted"># settings.py</span>
from os import environ
<span class="muted"># ...</span>
DATABASES = {
<span class="string">'default'</span>: {
<span class="string">'ENGINE'</span>: <span class="string">'django.db.backends.postgresql_psycopg2'</span>,
<span class="string">'NAME'</span>: <span class="string">'hello_django_db'</span>,
<span class="string">'USER'</span>: environ.get(<span class="string">'HELLO_DJANGO_DB_ENV_POSTGRES_USER'</span>),
<span class="string">'PASSWORD'</span>: environ.get(<span class="string">'HELLO_DJANGO_DB_ENV_POSTGRES_PASSWORD'</span>),
<span class="string">'HOST'</span>: environ.get(<span class="string">'HELLO_DJANGO_DB_PORT_5432_TCP_ADDR'</span>),
<span class="string">'PORT'</span>: environ.get(<span class="string">'HELLO_DJANGO_DB_PORT_5432_TCP_PORT'</span>),
}
}
</pre>
<!-- yes, I know I'll die in hell for using 2 spaces
instead of 4 for python code, but there's just no space!!! -->
</div>
<div class="step slide" data-x="3700" data-y="900" data-z="-1850" data-rotate="270" data-rotate-y="90" data-scale="1">
<h2>When in doubt: printenv</h2>
<pre>
docker-compose run hello_django_app printenv
</pre>
<br />
<p><small>* The container must be up when running this command</small></p>
</div>
<div class="step slide no-future" data-x="3700" data-y="1800" data-z="-900" data-rotate="270" data-rotate-y="90" data-scale="1">
<h2>Linking a Postgres DB</h2>
<pre class="small">
hello_django_app:
build: .
volumes:
- ./hello_django:/usr/src/app/hello_django
ports:
- 8000:8000
<b class="highlight">command: sh ./init.sh</b>
links:
- hello_django_db
hello_django_db:
image: postgres:latest
ports:
- 5432:5432
environment:
- POSTGRES_DB=hello_django_db
extends:
file: env-vars.yml
service: hello_django_env_vars
</pre>
</div>
<div class="step slide" data-x="3700" data-y="2700" data-z="-900" data-rotate="270" data-rotate-y="90" data-scale="1">
<h2>Waiting for other services to start</h2>
<pre>
<span class="muted"># init.sh</span>
RUN until netcat -z -v localhost 5432; do
echo "$(date) - waiting for postgres...";
sleep 1;
python ./manage.py makemigrations
python ./manage.py migrate auth
python ./manage.py migrate
python ./manage.py runserver 0.0.0.0:8000
</pre>
</div>
<div class="step slide" data-x="4400" data-y="1800" data-z="-1300" data-rotate="270" data-rotate-y="0" data-scale="1">
<h2>Running commands inside services</h2>
<pre class="small">
docker-compose run hello_django_app python manage.py createsuperuser
</pre>
</div>
<div class="step slide" data-x="4600" data-y="1800" data-z="-1700" data-rotate="270" data-rotate-y="90" data-scale="1">
<h2>Saving DB data outside the container</h2>
<p>
The data inside the DB container is stored there as long as the container is not rebuilt.
If you need the data to persist, you can store it locally.
</p>
</div>
<div class="step slide" data-x="4600" data-y="1800" data-z="-2000" data-rotate="270" data-rotate-y="90" data-scale="1">
<h2>Saving DB data outside the container</h2>
<pre class="small">
<b class="muted"># ./docker-compose.yml</b>
hello_django_db:
image: postgres:latest
<b class="highlight">volumes:
- ./db-data:/var/lib/postgresql/data</b>
ports:
- 5432:5432
environment:
- POSTGRES_DB=hello_django_db
extends:
file: env-vars.yml
service: hello_django_env_vars
</pre>
</div>
<div class="step slide" data-x="4900" data-y="1800" data-z="-2300" data-rotate="270" data-rotate-y="0" data-scale="1">
<h2>Bringing in the front-end devs</h2>
<p>We can add a container that provides <b>Bower</b>, <b>SASS</b>, and/or <b>Gulp</b>, etc.</p>
<br />
<pre class="smaller">
<b class="muted"># ./docker-compose.yml</b>
node:
image: digitallyseamless/nodejs-bower-grunt:0.12
volumes:
- ./bower.json:/data/bower.json
- ./.bowerrc:/data/.bowerrc
- ./hello_django/static/vendors:/data/hello_django/static/hello/vendors
</pre>
</div>
<div class="step slide" data-x="5400" data-y="1800" data-z="-2300" data-rotate="270" data-rotate-y="0" data-scale="1">
<h2>Bringing in the front-end devs</h2>
<p>And running it as such:</p>
<br />
<pre>
docker-compose run node bower install
</pre>
</div>
<div id="its-in-3d" class="step" data-x="6200" data-y="4300" data-z="-100" data-rotate-x="-40" data-rotate-y="10" data-scale="2">
<h1>Thanks for listening!</h1>
<p>Questions: <a href="https://twitter.com/rene_olivo">@rene_olivo</a></p>
</div>
<div id="overview" class="step" data-x="3000" data-y="1500" data-scale="10">
</div>
</div>
<!--
Hint is not related to impress.js in any way.
But it can show you how to use impress.js features in creative way.
When the presentation step is shown (selected) its element gets the class of "active" and the body element
gets the class based on active step id `impress-on-ID` (where ID is the step's id)... It may not be
so clear because of all these "ids" in previous sentence, so for example when the first step (the one with
the id of `bored`) is active, body element gets a class of `impress-on-bored`.
This class is used by this hint below. Check CSS file to see how it's shown with delayed CSS animation when
the first step of presentation is visible for a couple of seconds.
...
And when it comes to this piece of JavaScript below ... kids, don't do this at home ;)
It's just a quick and dirty workaround to get different hint text for touch devices.
In a real world it should be at least placed in separate JS file ... and the touch content should be
probably just hidden somewhere in HTML - not hard-coded in the script.
Just sayin' ;)
-->
<!--
<div class="hint">
<p>Use a spacebar or arrow keys to navigate</p>
</div>
-->
<script>
if ("ontouchstart" in document.documentElement) {
document.querySelector(".hint").innerHTML = "<p>Tap on the left or right to navigate</p>";
}
</script>
<!--
Last, but not least.
To make all described above really work, you need to include impress.js in the page.
I strongly encourage to minify it first.
In here I just include full source of the script to make it more readable.
You also need to call a `impress().init()` function to initialize impress.js presentation.
And you should do it in the end of your document. Not only because it's a good practice, but also
because it should be done when the whole document is ready.
Of course you can wrap it in any kind of "DOM ready" event, but I was too lazy to do so ;)
-->
<script src="js/impress.js"></script>
<script>impress().init();</script>
<!--
The `impress()` function also gives you access to the API that controls the presentation.
Just store the result of the call:
var api = impress();
and you will get three functions you can call:
`api.init()` - initializes the presentation,
`api.next()` - moves to next step of the presentation,
`api.prev()` - moves to previous step of the presentation,
`api.goto( idx | id | element, [duration] )` - moves the presentation to the step given by its index number
id or the DOM element; second parameter can be used to define duration of the transition in ms,
but it's optional - if not provided default transition duration for the presentation will be used.
You can also simply call `impress()` again to get the API, so `impress().next()` is also allowed.
Don't worry, it wont initialize the presentation again.
For some example uses of this API check the last part of the source of impress.js where the API
is used in event handlers.
-->
</body>
</html>
<!--
Now you know more or less everything you need to build your first impress.js presentation, but before
you start...
Oh, you've already cloned the code from GitHub?
You have it open in text editor?
Stop right there!
That's not how you create awesome presentations. This is only a code. Implementation of the idea that
first needs to grow in your mind.
So if you want to build great presentation take a pencil and piece of paper. And turn off the computer.
Sketch, draw and write. Brainstorm your ideas on a paper. Try to build a mind-map of what you'd like
to present. It will get you closer and closer to the layout you'll build later with impress.js.
Get back to the code only when you have your presentation ready on a paper. It doesn't make sense to do
it earlier, because you'll only waste your time fighting with positioning of useless points.
If you think I'm crazy, please put your hands on a book called "Presentation Zen". It's all about
creating awesome and engaging presentations.
Think about it. 'Cause impress.js may not help you, if you have nothing interesting to say.
-->
<!--
Are you still reading this?
For real?
I'm impressed! Feel free to let me know that you got that far (I'm @bartaz on Twitter), 'cause I'd like
to congratulate you personally :)
But you don't have to do it now. Take my advice and take some time off. Make yourself a cup of coffee, tea,
or anything you like to drink. And raise a glass for me ;)
Cheers!
-->