This repository was archived by the owner on Mar 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
executable file
·229 lines (199 loc) · 6.91 KB
/
index.html
File metadata and controls
executable file
·229 lines (199 loc) · 6.91 KB
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
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Data Snapshots</title>
<meta name="description" content="TODO: THIS">
<meta name="author" content="Clif Reeder">
<meta name="viewport" content="width=960">
<link rel="stylesheet" href="./core/deck.core.css">
<link rel="stylesheet" href="./extensions/navigation/deck.navigation.css">
<link rel="stylesheet" href="./extensions/menu/deck.menu.css">
<link rel="stylesheet" href="./extensions/status/deck.status.css">
<link rel="stylesheet" href="./themes/style/web-2.0.css">
<link rel="stylesheet" href="./themes/transition/horizontal-slide.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.5.3/modernizr.min.js"></script>
</head>
<body class="deck-container">
<article>
<section class="slide">
<h1>Developing With Production Data</h1>
</section>
<section class="slide">
<h2>Problems</h2>
<ul>
<li>What does a developer see when they first start the app?</li>
<li>What kind of data is a designer using for example?</li>
<li>What data does a QA tester use?</li>
</ul>
</section>
<section class="slide">
<h1>Who are you, anyway?</h1>
</section>
<section class="slide">
<h2>Vox Media</h2>
<ul>
<li>The Verge</li>
<li>SBNation.com</li>
<li>320+ sports blogs</li>
<li>21 Regional Sites</li>
<li>One big CMS, with lots of user generated content w/ different styles</li>
</ul>
</p>
</section>
<section class="slide">
<h2>Solutions</h2>
<pre>
<code>5.times.each do |j|
Story.create!(
:user => users[:author],
:community => community,
:title => title(j),
:body => lorem_ipsum()
)
end</code></pre>
</section>
<section class="slide">
<h2>What if we could use REAL data?</h2>
</section>
<section class="slide">
<h2> This is my dev environment</h2>
<img src="https://img.skitch.com/20120326-n6iw38u5e4498had9nn2sjiqf1.jpg" alt='example' style='height:400px'/>
</section>
<section class="slide">
<h2>Complications</h2>
<p><em>Size</em> - Production database is > 100 GB, so that's not really an option. How do we get a subset?</p><br/>
<p><em>Assets</em> - How do we share external assets and make that work? (S3, etc)</p><br/>
<p><em>Services</em> - How do we make internal, external services play nice? (Staircar)</p>
</section>
<section class="slide">
<h2>Alternative talk titles</h2>
<ul>
<li>Creating a representative subset of production data</li>
<li>Imperfect, hacky SQL that greatly improves developers lives</li>
</ul>
</section>
<section class="slide">
<h2>Results</h2>
<ul>
<li>Production DB is 118 GB</li>
<li>Development DB is 4.7 GB </li>
<li>Gzipped SQL is 650 MB</li>
</ul>
</section>
<!--
<section class="slide">
<h2>How is it used? Rake.</h2>
<p>
AWKWARD
<ul>
<li>Rake task to create</li>
<li>Rake task to download/import</li>
</ul>
</p>
</section>
-->
<section class="slide">
<h2>Prerequisites</h2>
<p>
<ul>
<li>You actually have this problem</li>
<li>Slave DB is a must</li>
<li>Figure out what you're largest tables are, and approximate what a meaningul subset would be.</p>
</ul>
</p>
</section>
<section class="slide">
<h2>General Process</h2>
<p>
<ul>
<li>Connect AR to DB slave</li>
<li>For every table, mysqldump to file. A subset, if its a big table</li>
<li>Import that dump into a temporary DB</li>
<ul>
<li>Why? Because we need to anonymize/delete things.</li>
</ul>
<li>For every big model</li>
<ul>
<li>For every table</li>
<ul>
<li>If foreign keys to big table, DELETE things that are missing</li>
</ul>
<li>end</li>
</ul>
<li>end</li>
</ul>
</p>
</section>
<section class="slide">
<h2>It's a Trap!</h2>
<ul>
<li>Need a list of all models. Can be tricky w/ namespaces and inheritence</li>
<li>def self.has_belongs_relationship_to?(model)</li>
<ul>
<li>self.reflect_on_all_associations.select{ |x| x.macro == :belongs_to }</li>
<li>Detect polymorphism</li>
</ul>
<li>Always raw SQL if possible - but don't let AR go to sleep</li>
</ul>
</section>
<section class="slide">
<h2> Process conintuned...</h2>
<ul>
<li>Anonymize user data</li>
<li>Change all passwords to known crypted/salt</li>
<li>Wipe all stored ip adresses</li>
<li>Wipe all stored analytics related data</li>
<li>Anonymize all emails, etc, etc</li>
<li>Dump that temporary DB, gzip, upload to S3</li>
</ul>
</section>
<section class="slide">
<h2>Assets</h2>
<ul>
<li>Every non-production environment assumes assets are from production</li>
<li>Append token to start of newly created asset filenames</li>
<li>Check for token when generating url. If local, use non-production S3 settings</li>
</ul>
</section>
<section class="slide">
<h2>Services</h2>
<ul>
<li>Non-production environments all point to staging</li>
<li>Append token to start of newly created asset filenames</li>
<li>Check for token when generating url. If local, use non-production S3 settings</li>
</ul>
</section>
<section class="slide">
<h2>We're Hiring</h2>
<p>We need developers (and designers if that's your thing)</p>
<h4><a href='http://jobs.voxmedia.com'>jobs.voxmedia.com</a></h4>
</section>
<section class="slide">
<h2>Questions?</h2>
<p>Email: <a href='mailto:clif@voxmedia.com'>clif@voxmedia.com</a></p>
<p>Twitter: <a href='https://twitter.com/#!/clifreeder'>@clifreeder</a></p>
<p>Blog: <a href='http://blog.clifreeder.com'>blog.clifreeder.com</a></p>
<section>
</article>
<footer>
<img src="http://i.imgur.com/IsEvG.png" alt='vox-media-logo'/ style="width:350px; position:absolute; bottom:10px; right:48px">
</footer>
<!-- Grab CDN jQuery, with a protocol relative URL; fall back to local if offline -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="./jquery-1.7.min.js"><\/script>')</script>
<script src="./core/deck.core.js"></script>
<script src="./extensions/navigation/deck.navigation.js"></script>
<script src="./extensions/menu/deck.menu.js"></script>
<script src="./extensions/status/deck.status.js"></script>
<script>
$(function() {
$.deck('.slide');
});
</script>
</body>
</html>