1 00:00:02,520 --> 00:00:10,340 ‫All right. For this assignment, I want you to go through the actions of creating a compose file from scratch. 2 00:00:10,530 --> 00:00:17,070 ‫This is a very normal, everyday, basic compose file. It's an exercise you'll go through a lot in 3 00:00:17,250 --> 00:00:20,910 ‫building on applications that you need to work on, or test, or develop on. 4 00:00:20,910 --> 00:00:26,580 ‫As you get used to Compose, you'll actually kind of prefer it locally. It's just so easy to use and 5 00:00:26,580 --> 00:00:29,590 ‫it makes the docker commands so much easier to remember 6 00:00:29,610 --> 00:00:31,070 ‫inside of that compose file. 7 00:00:31,080 --> 00:00:36,720 ‫On this one, you're actually going to build a basic Drupal content management site. 8 00:00:36,720 --> 00:00:40,980 ‫If you're not familiar with Drupal, it's an open source content management server, which is basically 9 00:00:40,980 --> 00:00:46,080 ‫just a website builder. You don't have to know a lot about Drupal, but it's a good example of a fully 10 00:00:46,080 --> 00:00:49,620 ‫functional web app, and it needs a database running behind it. 11 00:00:49,620 --> 00:00:56,100 ‫You're going to need to look up the Drupal images, and the postgres image on Docker Hub, and read 12 00:00:56,100 --> 00:00:58,470 ‫a little bit through their documentation. 13 00:00:58,470 --> 00:01:03,240 ‫Of course I recommend using the official images, and there are some other things there. You'll want to 14 00:01:03,300 --> 00:01:08,560 ‫use the ports inside the compose file to actually expose Drupal. 15 00:01:08,580 --> 00:01:14,100 ‫I recommend just doing it on 8080. You can really do it on any port you want, but let's just pick 8080 for 16 00:01:14,100 --> 00:01:15,110 ‫this assignment. 17 00:01:15,330 --> 00:01:19,440 ‫You're going to end up with two services. I recommend version 2 at the very top your file. You'll have 18 00:01:19,440 --> 00:01:24,090 ‫those two services underneath it. One for Drupal, one for postgres. You can call the services whatever 19 00:01:24,090 --> 00:01:29,540 ‫you want. Inside the postgres service, you're going to need to make sure you set a password for it. 20 00:01:29,850 --> 00:01:35,490 ‫And then the way that Drupal works is that once you've started it with docker compose up, you'll actually 21 00:01:35,490 --> 00:01:41,520 ‫open up your browser and walk through the setup. Drupal has a nice, web-based setup. It'll ask you some 22 00:01:41,520 --> 00:01:42,490 ‫questions. 23 00:01:42,840 --> 00:01:48,660 ‫A tip there is that the way these containers work in compose files is, remember, that it uses the 24 00:01:48,660 --> 00:01:52,990 ‫service name as the DNS name for one container to talk to the other. 25 00:01:53,010 --> 00:01:58,620 ‫As you're setting it up, one of the options you'll see under advanced is where the database server 26 00:01:58,620 --> 00:02:03,240 ‫is. It defaults to localhost, and that's not going to work because that would mean that you'd have 27 00:02:03,240 --> 00:02:07,710 ‫to have your database and your web server in the same container. 28 00:02:07,710 --> 00:02:10,540 ‫And that's not really a best practice for Docker. 29 00:02:10,560 --> 00:02:14,970 ‫In that case, you're going to need to change the localhost to whatever you call the Drupal service. 30 00:02:15,060 --> 00:02:20,850 ‫Then the Drupal web server will actually talk over the Docker network to the database server. 31 00:02:21,070 --> 00:02:24,280 ‫If you want to go a little bit extra credit, there's an option 32 00:02:24,330 --> 00:02:30,420 ‫that you'll see on the Drupal documentation on Docker Hub, about using volumes to store the unique data, like 33 00:02:30,420 --> 00:02:35,640 ‫the template data, and the uploads, and the add-ons for Drupal that are called modules, you'll see that 34 00:02:35,640 --> 00:02:40,440 ‫some documentation around that. I recommend you experiment with that and see if you can get it working 35 00:02:40,440 --> 00:02:41,680 ‫in the compose file. 36 00:02:41,730 --> 00:02:45,580 ‫Then after you started it, going and listing out the volumes to see if you can see them there, and that 37 00:02:45,600 --> 00:02:46,720 ‫they look correct. 38 00:02:47,190 --> 00:02:51,260 ‫This should be a fairly short compose file, probably 10 or so lines. 39 00:02:51,330 --> 00:02:56,100 ‫Of course, if you get stuck, no worries. The next lecture will have me walking through the same exercise 40 00:02:56,100 --> 00:02:57,010 ‫you're about to go through. 41 00:02:57,150 --> 00:02:58,300 ‫So, good luck, and have some fun.