You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: chapter_09_docker.asciidoc
+59-78
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
****
6
6
With Early Release ebooks, you get books in their earliest form—the author's raw and unedited content as they write—so you can take advantage of these technologies long before the official release of these titles.
7
7
8
-
This will be the 9th chapter of the final book. The GitHub repo is available at https://github.com/hjwp/book-example.
8
+
This will be the 9th chapter of the final book. The GitHub repo is available at https://github.com/hjwp/book-example/tree/chapter_09_docker.
9
9
10
10
If you have comments about how we might improve the content and/or examples in this book, or if you notice missing material within this chapter, please reach out to the author at [email protected].
11
11
****
@@ -51,11 +51,11 @@ on the actual internet.
51
51
Give it a buzzword name like "DevOps"
52
52
if that's what it takes to convince you it's worth it.
53
53
54
-
.Warning, chapter under construction
54
+
.New content alert! Pls send feedback.
55
55
****
56
56
As part of my work on the third edition of the book,
57
-
I'm making big changes to the deployment chapters,
58
-
and this is a very new draft.
57
+
I've made big changes to the deployment chapters,
58
+
so this stuff is all very fresh.
59
59
60
60
What that means is that I'd, really, really love feedback from readers.
61
61
Please have a go at following along and let me know what you think!
@@ -70,7 +70,7 @@ or if any of the instructions don't work for you.
70
70
I hope you enjoy the new version!
71
71
****
72
72
73
-
=== TDD and the Danger Areas of Deployment
73
+
=== The Danger Areas of Deployment
74
74
// XUAN: I read the title as meaning _TDD and_ the danger areas of deployment, but the following section seems to be talking about the danger areas of deployment?
75
75
76
76
Deploying a site to a live web server can be a tricky topic.
@@ -107,6 +107,14 @@ Security and Configuration::
107
107
become dangerous in production
108
108
(because they expose our source code in tracebacks).
109
109
110
+
Reproducibility and Divergence between local dev and prod::
111
+
All of the above add up to differences between your local development environemnt
112
+
and the way code runs in production.
113
+
We want to be able to reproduce the way things work on our machine,
114
+
as closely as possible, in production (and vice-versa)
115
+
to give us as much confidence as possible that
116
+
"it works on my machine" means "it's going to work in production".
117
+
110
118
111
119
One way to approach the problem is to get a server
112
120
and start manually configuring and installing everything,
@@ -126,6 +134,8 @@ before we actually take the plunge?
126
134
Can we then make small changes one at a time,
127
135
solving problems one by one,
128
136
rather than having to bite off everything in one mouthful?
137
+
Can we use our existing test suite to make sure things
138
+
work on the server, as well as locally?
129
139
130
140
Absolutely we can. And from the title of the chapter,
131
141
I'm sure you're already guessing that Docker is going
@@ -210,8 +220,8 @@ NOTE: If you're new to all this, I know it's a lot to wrap your head around!
210
220
It takes a while to build a good mental model of what's happening.
211
221
Have a look at
212
222
https://www.docker.com/resources/what-container/[Docker's resources on containers]
213
-
for more explanation,
214
-
and hopefully, following along with these chapters and seeing them working in practice
223
+
for more explanation.
224
+
Hopefully, following along with these chapters and seeing them working in practice
215
225
will help you to better understand the theory.
216
226
217
227
@@ -246,81 +256,16 @@ which, as always, is:
246
256
For the purposes of this book,
247
257
that's not such a bad justification really!
248
258
249
-
Yes, I think it's going to be a nice way to have a "pretend"
259
+
Yes, it's going to be a nice way to have a "pretend"
250
260
deployment on our own machine, before we try the real one--but
251
261
also, containers are so popular nowadays,
252
262
that it's very likely that you're going to encounter them at work
253
263
(if you haven't already).
254
264
For many working developers, a container image is the final artifact of their work,
255
265
it's what they "deliver",
256
-
and most of the rest of the deployment process is taken care of by someone else.
257
-
258
-
259
-
=== Docker and the Danger Areas of Deployment
260
-
261
-
How will containerizing our software help with the danger areas?
262
-
// XUAN: I was expecting this section to give a brief high-level overview of how containerization can help address each one of the danger areas, but the following bullet points don't seem to do that
263
-
264
-
* Containers can be like little virtual servers and this is how
265
-
we will use them,
266
-
so they will force us to address many of the problems
267
-
like dependency management and configuration.
268
-
269
-
* We can use the containers to package up as much
270
-
of the functionality of our application as possible,
271
-
like a production-ready web server and static files system.
272
-
This in turn will minimise the amount of configuration
273
-
we need to do to our actual servers.
274
-
275
-
* We can test our containers work by running our functional tests
276
-
against them.
277
-
278
-
* Later, when we deploy our containers to a staging server,
279
-
we can run the FTs against that too.
280
-
// XUAN: "FTs" = "functional tests"?
281
-
// XUAN: This is the first time this chapter mentions "staging", which seems a bit out of the blue. Can you elaborate on what problems does having a staging server solve for the initial list of danger areas of deployment?
282
-
283
-
* If we automate container creation and deployment to staging,
284
-
and we've tested both those things, then we will have
285
-
minimised the risk of deployment to production.
286
-
287
-
// TODO: consider getting rid of the staging server??
288
-
// CSANAD: I would keep the staging server.
289
-
// SEBASTIAN: I second that.
290
-
291
-
////
292
-
293
-
old content follows. is there anything we want to rescue from here?
294
-
295
-
But there are solutions to all of these. In order:
296
-
297
-
((("staging sites", "benefits of")))
298
-
* Using a 'staging site', on the same infrastructure as the production site,
299
-
can help us test out our deployments and get things right before we go to
300
-
the "real" site.
301
-
302
-
* We can also 'run our functional tests against the staging site'. That will
303
-
reassure us that we have the right code and packages on the server, and
304
-
since we now have a "smoke test" for our site layout, we'll know that the
305
-
CSS is loaded correctly.
266
+
and often the rest of the deployment process is something they rarely have to think about.
0 commit comments