-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
executable file
·416 lines (358 loc) · 11.9 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
<!DOCTYPE html>
<!--
Google HTML5 slide template
Authors: Luke Mahe (code)
Marcin Wichary (code and design)
Dominic Mazzoni (browser compatibility)
Charles Chen (ChromeVox support)
URL: http://code.google.com/p/html5slides/
-->
<html>
<head>
<title>FOSDEM git-deploy talk</title>
<meta charset='utf-8'>
<script
src='./slides.js'></script>
</head>
<body style='display: none'>
<section class='slides layout-regular template-default'>
<!-- Your slides (<article>s) go here. Delete or comment out the
slides below. -->
<article>
<h1>
Rapid real-world testing using git-deploy
</h1>
<p>
Ævar Arnfjörð Bjarmason <<a href="mailto:[email protected]">[email protected]</a>>
<br>
FOSDEM – February 5, 2012
</p>
</article>
<article>
<h2>
What is git-deploy?
</h2>
<ul class='build'>
<li>
A deployment tool conceived and introduced at Booking.com in 2008
</li>
<li>
We've made it open source, clone it on GitHub.
</li>
<li>
You should use it, and here's why...
</li>
</ul>
</article>
<article>
<h3>
It's a tool to make deployments really easy
</h3>
<p>
We've gone from deployments being a hard manual process, to
doing dozens of them a day.
</p>
<p>
<img style='height: 500px' src='images/deploys-per-month.png' alt='deploys per month at Booking.com'>
</p>
</article>
<article>
<h3>
It's highly configurable and pluggable
</h3>
<p>
<img src='images/pushing_your_boundaries_1.jpg' alt='this image is of no significance except to fill up space'>
</p>
<ul class='build'>
<li>
We use it to deploy around 20 environments.
</li>
<li>
Those 20 environments have around 60 hooks between them to
customize deployments.
</li>
</ul>
</article>
<article>
<h3>
What's the core concept behind it?
</h3>
<ul class='build'>
<li>
git-deploy will create an annotated git tag for all your
rollouts.
</li>
<li>
This gives you permanent git-level history of all your
rollouts..
</li>
</ul>
<p>
<img src='images/tag-all-the-deploys.jpg' class='centered' alt='TAG - ALL THE DEPLOYS (meme)'>
</p>
</article>
<article>
<h3>So how does it actually work</h3>
<ul class='build'>
<li>
Rollouts are done from a designated git repository cloned
from your main repository.
</li>
<li>
Only one user can do a rollout at a time.
</li>
<li>
Once you've locked the deployment server you can perform
any git operation you want (<code>git
pull/commit/cherry-pick/reset</code>).
</li>
<li>
When you're ready you <i>sync</i>. This creates <b>a
tag</b>.
</li>
<li>
This calls <b>your</b> sync hook.
</li>
<li>
When that's done you <i>finish</i>, which unlocks
deployments, pushes the tags, sends E-Mail etc.
</li>
</ul>
</article>
<article>
<h3>Step 1: <i>start</i></h3>
<ul class='build'>
<li>
Creates a <code>.git/deploy/lock</code> file in your
deployment repository.
</li>
<li>
Does a <code>git pull</code> for you.
</li>
<li>
Runs any <i>start</i> hooks.
<pre>
# checks that we're on "master"
cron/pre-start.001_nobranch_rollout.pl
</pre>
<li>
You can also do hotfix, it's just a <i>start</i> without
the <code>git pull</code> and the start hooks.
</li>
<li>
You can always <i>abort</i> the deploy at this point
before you <i>sync</i>.
</li>
</ul>
</article>
<article>
<h3>Step 1: <i>start</i> - example of someone already deploying</h3>
<q>I'm sorry Dave, I'm afraid I can't do that</q>
<ul class='build'>
<li>
<pre>
$ git-deploy start
# INFO : Starting step 'start' at 2012-02-02 16-22-01
# FATAL: You may not start a new rollout as it looks like one is already in progress!
# FATAL: Failed to create lock dir '.git/deploy' because 'File exists'
# FATAL: Log:
# FATAL: start: 2012-02-02 16:19:28 trunk 110bc23d8204dae87b2af259a02d47cd08711589 717 slanning
</pre>
</li>
</ul>
</article>
<article>
<h3>Step 1: <i>start</i> - example of a successful <i>start</i></h3>
<ul class='build'>
<li>
Output truncated, runs staging webserver restart hooks and
has more useful output:
<pre>
$ git-deploy start
# INFO : Starting step 'start' at 2012-02-02 16-30-12
# INFO : Working directory was checked out to tag 'app-20120202-160118', will restore this tag on abort
# INFO : Step 'start' concluded at 2012-02-02 16:30:12 took 29 seconds to complete
# YAY : 'start' for 'app' completed successfully
</pre>
</li>
<li>
Now ready for the <i>sync</i> step:
<pre>
$ git-deploy status
# NOTE : app rollout started - not synced yet (app-20120202-160118)
# NOTE : start: 2012-02-02 16:30:12 trunk 639022c78daf1b85b76d4816803a6d37bef67e10 3374 aearnfjord
</pre>
</li>
</ul>
</article>
<article>
<h3>Step 2: <i>sync</i></h3>
<ul class='build'>
<li>
This is when you've decided that what you have staged is
good enough.
</li>
<li>
It creates a tag to permanently tag this commit as having
been rolled out in this environment at this time.
</li>
<li>
The tag will be: <code><b>prefix</b>-YYYYMMDD-HHMMSS</code>
<li>
Calls a <i>sync hook</i> that you define.
</li>
<li>
If your sync hook has an error at this point it's up to you to resolve it.
</li>
</ul>
</article>
<article>
<h3>Step 3: <i>finish</i></h3>
<ul class='build'>
<li>
Run for you when <i>sync</i> finishes successfully, or
manually if your <i>sync hook</i> had an error.
</li>
<li>
Pushes your shiny new tag to your main repository.
</li>
<li>
Sends out an E-Mail announcing your new rollout if you've
configured it to do so.
</li>
<li>
Unlocks the staging server so you can do another rollout.
</li>
</ul>
</article>
<article>
<h3>Step 4: <i>panic</i></h3>
<q>OMGWTFBBQ we're spewing errors</q>
</article>
<article class='smaller'>
<h3>
git-deploy revert -- re-sync out a previous version
</h3>
<pre>
$ git-deploy revert
# INFO : Starting step 'revert' at 2012-02-03 12-09-50
# INFO : Working directory was checked out to tag 'frob-20120203-111220', will restore this tag on abort
# INFO :
The following commits are available to revert the site to:
# INFO : Filtering list by m/^frob/ (use `git-deploytool show .` to see all).
# INFO : SHA1........ tag: PREFIX-YYYYMMDD-HHMM == Original rollout of same sha1
# INFO : Tags against active commit are marked with a '*' and are highlighted differently
1. ac6152d369 *tag: frob-20120203-111220 == office-20120203-110941
2. 639022c78d tag: frob-20120202-160118
3. fc29e97c43 tag: frob-20120202-132719
4. 77b932ea11 tag: frob-20120201-164625
5. f2ffb24388 tag: frob-20120201-163350 == book-20120201-162541
6. a7bf6eb7c8 tag: frob-20120201-140814
7. ee728fa093 tag: frob-20120201-110816 == frob-20120131-145422 frob-20120131-121103 frob-20120130-171544 frob-20120130-121126
8. cb3189bf21 tag: frob-20120201-105349 == admin-20120201-103938
9. ee728fa093 tag: frob-20120131-145422 == frob-20120131-121103 frob-20120130-171544 frob-20120130-121126
10. e987ca15e1 tag: frob-20120131-143318
# INFO : Showing first 10, *bignum* of *bignum* not shown (111 filtered). Use --count=N or different filter to show more (N=0 shows all)
Please select a commit from 1-10 to revert to, or 'quit' to not do anything: quit
</pre>
</article>
<article>
<h3>
Why use it?
</h3>
<ul class='build'>
<li>
It makes reverts really easy. Helpful when you've just
broken something.
</li>
<li>
You can see your your entire deployment history at the git level.
</li>
<li>
It does really exhaustive error checking -- added over
years of trial and error as its inexperienced users have
tried to screw up rollouts in every way possible.
</li>
<li>
It ensures that the appropriate tags are created, and that
they're pushed.
</li>
<li>
Extensive puppet-friendly configuration file using <code>git-config(1)</code>
</li>
<li>
Extensive hook support for hooking into every step of deployments.
</li>
</ul>
</article>
<article>
<h3>
What doesn't it do?
</h3>
<ul class='build'>
<li>
Worry about how your code is synced out, that's your job.
</li>
<li>
<code>git push</code>
</li>
<li>
rsync it.
</li>
<li>
make a <code>Debian</code> or <code>RPM</code> package out
of it.
</li>
<li>
tar it up, gpg sign it and mail it around.
</li>
<li>
strap it to a pigeon.
</li>
<li>
This means you can most likely use it with your existing
deployment infrastructure.
</li>
</ul>
</article>
<article>
<h3>
Why does it work for us / Why do we need it?
</h3>
<ul class='build'>
<li>
We do Deployment-Driven-Development
<p>
<img src='images/warnings-on-app.png' alt='warnings on app servers after a deploy'>
</p>
</li>
<li>
Who cares if it passes the tests? Do customers like it?
</li>
<li>
Which means less emphasis on unit testing.
</li>
<li>
Which means more frequent deploys to see if you're still OK.
</li>
<li>
...and rapid rollbacks if you're not.
</li>
<li>
Enough monitoring can replace testing, but testing can never replace monitoring.
</li>
</ul>
</article>
<article>
<h1 class='centered'>
Thank you!, questions?
</h1>
<ul>
<li>Source and documentation: <a href="http://github.com/git-deploy">http://github.com/git-deploy</a></li>
<li>This talk is available online at <a href="http://git-deploy.github.com">git-deploy.github.com</a></li>
<li>Contact me at <a href="mailto:[email protected]">github.com/avar</a></li>
</ul>
</article>
</section>
</body>
</html>