1 00:00:04,350 --> 00:00:09,480 ‫Now that you've seen all the ways to create secrets in our stack, I'm going to give you a little 2 00:00:09,480 --> 00:00:14,610 ‫assignment on using secrets with a previous stack you've used. 3 00:00:14,610 --> 00:00:19,370 ‫You remember our friend Drupal, the compose file we used earlier, in compose assignment 2. 4 00:00:19,590 --> 00:00:24,050 ‫I want you to take that, and we're going to actually extend it and make it stack ready. 5 00:00:24,900 --> 00:00:27,260 ‫First, we're not going to build a custom image right now. 6 00:00:27,270 --> 00:00:29,880 ‫We're just going to use the default Drupal. 7 00:00:30,060 --> 00:00:35,000 ‫Then you would need to remove the build section from your compose file. Then I'd like you to 8 00:00:35,030 --> 00:00:42,390 ‫add the secret at the bottom, and when you do that, instead of using a file-based secret, put in external. 9 00:00:42,460 --> 00:00:45,170 ‫You can also look that up in the resources for this section. 10 00:00:45,180 --> 00:00:48,750 ‫It'll be the documentation on Docker's website all about secrets. 11 00:00:48,820 --> 00:00:53,420 ‫It'll show you the formatting in there of a compose file. So you use external, which means we actually 12 00:00:53,420 --> 00:00:59,840 ‫have to use the CLI to put that secret in. Then you're going to pass the password file, 13 00:00:59,920 --> 00:01:03,930 ‫that is the secret file, into postgres, using the environment variable. 14 00:01:04,090 --> 00:01:07,290 ‫So, you'll need to add that to the postgres section. 15 00:01:07,300 --> 00:01:12,520 ‫Then before we actually deploy the stack, you need to actually put the secret into the swarm. 16 00:01:12,520 --> 00:01:18,250 ‫This will be a case where we're not using a secret file. We're simply going to manually, as an operator, 17 00:01:18,550 --> 00:01:22,280 ‫add the secret to our swarm. Then in the stack file, 18 00:01:22,390 --> 00:01:26,920 ‫we're going to actually specify that, using the external at the bottom. 19 00:01:26,920 --> 00:01:31,570 ‫Once you've got it all edited the way you think it's correct and you're ready to test it, just copy it 20 00:01:31,570 --> 00:01:38,910 ‫into a new YAML file on your swarm node1. Try and do a stack deploy and see if it works. 21 00:01:38,980 --> 00:01:41,060 ‫You may not get it right the first time, and that's fine. 22 00:01:41,050 --> 00:01:42,600 ‫A lot of times I won't either. 23 00:01:42,610 --> 00:01:47,440 ‫I have to go back and revise it, and then try a deployment again. The errors that you'll get back 24 00:01:47,440 --> 00:01:50,310 ‫are usually pretty good at telling you what your problems are. 25 00:01:50,320 --> 00:01:54,460 ‫For me, it's usually that my YAML isn't formatted correctly or something silly like that. 26 00:01:54,700 --> 00:01:59,200 ‫If you have any issues, don't hesitate to just watch the video after this where I actually walk through 27 00:01:59,200 --> 00:02:00,420 ‫this assignment for you. 28 00:02:00,490 --> 00:02:04,750 ‫But I think your brain will work better if you try it yourself and get your mind working about how you 29 00:02:04,750 --> 00:02:06,880 ‫would actually solve this assignment yourself. 30 00:02:06,880 --> 00:02:08,700 ‫Good luck, and I'll see in the next lecture.