Skip to content

Commit a94e44d

Browse files
committed
some follow-on stuff after merging stephanie's pr
1 parent f7ac313 commit a94e44d

File tree

1 file changed

+15
-22
lines changed

1 file changed

+15
-22
lines changed

chapter_10_production_readiness.asciidoc

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,8 @@ Believe it or not, this pun didn't actually hit me until I was rewriting this ch
212212
For 10 years it was right under my nose. I think that makes it funnier actually.]
213213
files from Python.
214214

215-
First we install whitenoise into our local environment:
215+
First we install Whitenoise into our local environment:
216216

217-
[source,python]
218217
----
219218
pip install whitenoise
220219
----
@@ -262,10 +261,6 @@ $ *docker build -t superlists . && docker run \
262261
And if you take another manual look at your site, things should look much healthier.
263262
Let's rerun our FTs to confirm:
264263

265-
// DAVID: Incidentally as per your suggestion Harry I have just been skipping
266-
// the requirements.txt and instead just amending the pip install in the Dockerfile.
267-
// If we do that, however, we'll need to make sure readers rebuild the image each time
268-
// we add a requirement - such as at this point.
269264

270265
[role="small-code"]
271266
[subs="specialcharacters,macros"]
@@ -443,14 +438,6 @@ TIP: Forgetting the `-r` and running `pip install requirements.txt`
443438
It's a mistake I still make, _all the time_.
444439

445440

446-
// CSANAD: It's fine for now, but I would definitely put the requirements under
447-
// /tmp and then `rm` it after `pip install`. Also, using a non-privileged
448-
// user is important, something like:
449-
// `adduser --no-create-home --disabled-password todoapp`
450-
// and then setting the user in the Dockerfile with `USER todoapp`.
451-
// But we can cover this in a later chapter (the next one looks like a good fit,
452-
// since it's related to the app being production ready).
453-
// TODO yep let's definitely do this.
454441

455442
Let's build & run:
456443

@@ -773,6 +760,7 @@ $ *docker build -t superlists . && docker run \
773760
-it superlists*
774761
----
775762

763+
and...
776764

777765
[role="small-code"]
778766
[subs="specialcharacters,macros"]
@@ -801,24 +789,28 @@ $ *git status*
801789
$ *git commit -am "Add collectstatic to dockerfile, and new location to gitignore"*
802790
----
803791

804-
// CSANAD: now would be a good time to check our changes and notice git marked
805-
// src/static as unstaged, so we should update .gitignore accordingly:
806-
// from `static` to `src/static`.
807-
// Or we could add this step to Chapter 09 at "Move all our code into a src
808-
// folder"
809792

810793

811794
=== Switching to a nonroot user
812795

813-
TODO: WIP, this is definitely a good idea for security, needs writing up.
796+
// CSANAD: It's fine for now, but I would definitely put the requirements under
797+
// /tmp and then `rm` it after `pip install`. Also, using a non-privileged
798+
// user is important, something like:
799+
// `adduser --no-create-home --disabled-password todoapp`
800+
// and then setting the user in the Dockerfile with `USER todoapp`.
801+
// But we can cover this in a later chapter (the next one looks like a good fit,
802+
// since it's related to the app being production ready).
803+
// TODO yep let's definitely do this.
804+
805+
TODO: apologies, WIP, this is definitely a good idea for security, needs writing up.
814806

815807
Dockerfile should gain some lines a bit like this:
816808

817809
.Dockerfile (ch10l0XX)
818810
====
819811
[source,dockerfile]
820812
----
821-
RUN addgroup --system nonroot && adduser --system --group nonroot
813+
RUN addgroup --system nonroot && adduser --system --no-create-home --disabled-password --group nonroot
822814
823815
USER nonroot
824816
----
@@ -899,7 +891,8 @@ but sometimes you just wanna say "just print stuff to stdout pls",
899891
and you wish that configuring the simplest thing was a little easier.].
900892

901893
Here's pretty much the simplest possible logging config
902-
which just prints everything to the console (i.e. standard out). I've added this code to the very end of the settings.py file.
894+
which just prints everything to the console (i.e. standard out).
895+
I've added this code to the very end of the settings.py file.
903896

904897

905898
[role="sourcecode"]

0 commit comments

Comments
 (0)