#100DaysOfWeb in Python Transcripts
Chapter: Days 97-100: Docker and Docker Compose
Lecture: Running the system as a whole
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
It's time to put it all together. We want to run the front end. We want to run the services and have them talk to each other.
0:08
We pretty much have the communication working if we expose the ports. But how do we run them all? And how do we do this is a nice reproducible way?
0:18
So, I know we said docker run and then we said if there were a services latest. And what was the command for that one? Was it /app? Then app.py?
0:30
Or just app.py? I don't recall. So, we still have one more concept to make this a little bit cleaner here. So let's give over to PyCharm.
0:41
And the file thing we haven't touched on yet are entry point. And entry points are the command that is going
0:46
to run if you just run the container without any options. For this one, this is a service one, what we wanted to do is say /venv/bin/Python.
0:57
And we're going to run /app/app.py. That's what we want to do. So, first thing we have to do is we have to do a docker build. We're in the services.
1:09
Notice it's built this entry point bit here. Okay. That's all good. Now lets do the same thing for front end. And it's over in this file.
1:20
And we can add an entry point on this one. Now for this entry point, remember what we are running is nginx -g "daemon off;"
1:32
Don't forget the semicolon. Right? You don't want to have to remember to type this. So those are the commands that we're just going to run.
1:39
And now I got to do a docker build. Frontend's great. Looks like it added that entry point. So we're going to say run for services.
1:51
Remember we did the ports. Seven out of seven. Seven out of seven. Good. Now it's docker run. Frontends. And on the front ends
2:02
we'll do 80 to 80. Super. And if we do a docker ps you can see we have the frontend listening on port 80.
2:09
And we have the services listening on port 7007. This should work. Let's help it up here and we'll go local host. Just like that. Boom, look at this.
2:21
It is absolutely working. So we've got our crime. We've got out drama. What else we got? Thriller. All right we can search for success. Bamboozled.
2:32
Doesn't sound successful to me. But this website, that is absolutely successful. And if we go over here to seven out of seven you can see our service
2:43
running over here talking to it. And on this one we're just going back to those same services. We now have our movie exploder front end
2:54
and our service running in the background working in these two docker containers. Just like that. Well, that was a lot of work. Wasn't it?
3:06
We had to remember to start maybe the services first and then the frontend. We had to, even though we set the entry points
3:11
which is great, we still need to figure out all the details. So while this is pretty good we need something better.
3:18
This is where things like Kubernetes or Docker Compose or Swarm or those things that orchestrate across containers comes in.
3:26
We're going to talk about Docker Compose. And we're going to put this thing together into a single cluster, single command. It's going to be beautiful.
3:32
But we're just not quite ready yet. But we do have our individual pieces working together if we're willing to type out the commands by hand
3:40
like this, right?