Modern Python Projects Transcripts
Chapter: Deployment
Lecture: Docker Compose

Login or purchase this course to watch this video and the rest of the course contents.
0:00 We only really scratch the surface of what the Docker can do.
0:04 Our usage was very basic because all we had to do was to start a
0:09 gunicorn server and that was it.
0:12 We didn't have to connect to any database.
0:15 We didn't have to store files in Amazon s3 bucket or set up redis for
0:20 caching. However, once your application starts growing,
0:24 you will need to add more things.
0:27 And this is where you will need to use something like Docker Compose.
0:31 Docker Compose lets you configure different services like a Web server or a database and
0:37 make them work together. So you would have one Docker file for,
0:41 Let's say, gunicorn, another Docker file for Postgres or mySQL database
0:46 And then you would use docker compose file to connect them together,
0:51 open some ports and let them talk to each other.
0:54 Covering Docker Compose is a material for a whole new course,
0:58 So I'm not going to get into that,
1:01 especially since this chapter is already long.
1:04 But if you go to the Docker documentation,
1:06 you will see that there is a section dedicated to Docker Composedand one of the
1:10 things there is an example of how to use Docker compose with Django.
1:15 So, if you go here, you can see that we have a Docker file.
1:21 And then we have the Docker compose file,
1:23 where we specify that we have two different services.
1:27 One is a database that is using the postgres image.
1:31 It's defining some environment variable for the user name and password.
1:35 And then we have the Web service,
1:36 which basically starts a Web server mounts on volumes,
1:41 open some ports, and it depends on the database.
1:45 So, obviously, Docker documentation is the best place to get started.
1:49 But usually what people are looking for are some good examples of existing docker compose configurations.
1:54 And for that you can goto awesome-compose,
1:58 GitHub repository. This is a repository that contains examples of different Docker compose configurations
2:03 The good news is that it contains a lot of different configurations,
2:12 and each of them has a nice read me explaining how to use it.
2:17 The bad news is that for python,
2:19 you only have the NGINX,Flask and mongo DB or my SQL combination.
2:25 So I suggest you take a look at how the existing Docker compose file might look
2:30 like, and then you can make the necessary changes and that concludes our deployment chapter.