‫All right. For this assignment, I want you to go through the actions of creating a compose file from scratch.
‫This is a very normal, everyday, basic compose file. It's an exercise you'll go through a lot in
‫building on applications that you need to work on, or test, or develop on.
‫As you get used to Compose, you'll actually kind of prefer it locally. It's just so easy to use and
‫it makes the docker commands so much easier to remember
‫inside of that compose file.
‫On this one, you're actually going to build a basic Drupal content management site.
‫If you're not familiar with Drupal, it's an open source content management server, which is basically
‫just a website builder. You don't have to know a lot about Drupal, but it's a good example of a fully
‫functional web app, and it needs a database running behind it.
‫You're going to need to look up the Drupal images, and the postgres image on Docker Hub, and read
‫a little bit through their documentation.
‫Of course I recommend using the official images, and there are some other things there. You'll want to
‫use the ports inside the compose file to actually expose Drupal.
‫I recommend just doing it on 8080. You can really do it on any port you want, but let's just pick 8080 for
‫this assignment.
‫You're going to end up with two services. I recommend version 2 at the very top your file. You'll have
‫those two services underneath it. One for Drupal, one for postgres. You can call the services whatever
‫you want. Inside the postgres service, you're going to need to make sure you set a password for it.
‫And then the way that Drupal works is that once you've started it with docker compose up, you'll actually
‫open up your browser and walk through the setup. Drupal has a nice, web-based setup. It'll ask you some
‫questions.
‫A tip there is that the way these containers work in compose files is, remember, that it uses the
‫service name as the DNS name for one container to talk to the other.
‫As you're setting it up, one of the options you'll see under advanced is where the database server
‫is. It defaults to localhost, and that's not going to work because that would mean that you'd have
‫to have your database and your web server in the same container.
‫And that's not really a best practice for Docker.
‫In that case, you're going to need to change the localhost to whatever you call the Drupal service.
‫Then the Drupal web server will actually talk over the Docker network to the database server.
‫If you want to go a little bit extra credit, there's an option
‫that you'll see on the Drupal documentation on Docker Hub, about using volumes to store the unique data, like
‫the template data, and the uploads, and the add-ons for Drupal that are called modules, you'll see that
‫some documentation around that. I recommend you experiment with that and see if you can get it working
‫in the compose file.
‫Then after you started it, going and listing out the volumes to see if you can see them there, and that
‫they look correct.
‫This should be a fairly short compose file, probably 10 or so lines.
‫Of course, if you get stuck, no worries. The next lecture will have me walking through the same exercise
‫you're about to go through.
‫So, good luck, and have some fun.