1 00:00:01,070 --> 00:00:05,690 We've now seen how to work with cluster IP services and note port services. 2 00:00:05,700 --> 00:00:10,210 Now we're gonna go around to the rest of the micro services inside of our app specifically comments 3 00:00:10,210 --> 00:00:13,970 carry in moderation and integrate those into our Cuban 80s cluster. 4 00:00:13,970 --> 00:00:15,190 Here's the steps we need to go through. 5 00:00:15,190 --> 00:00:20,420 For each one we're going to go to the source code for each of those three and we're going to update 6 00:00:20,420 --> 00:00:26,030 the or else in each them to make sure that they post events to the event bus SRB because remember right 7 00:00:26,030 --> 00:00:33,250 now they are trying to send events to local Post four thousand five then for each those we will build 8 00:00:33,250 --> 00:00:38,650 an image and push them to Docker Hub will then create a deployment in a cluster IP service for each 9 00:00:38,650 --> 00:00:41,410 of them and apply those all to our cluster. 10 00:00:41,410 --> 00:00:46,750 And then finally we're going to update our event plus code that it once again sends events to comments 11 00:00:46,780 --> 00:00:50,730 query and moderation because we commented out that code just a moment ago. 12 00:00:50,860 --> 00:00:56,170 So the bad news here is that we're going to be essentially doing the same thing three times over or 13 00:00:56,170 --> 00:00:57,540 comments query and moderation. 14 00:00:57,550 --> 00:00:58,630 That's the bad news. 15 00:00:58,660 --> 00:01:03,580 The good news is we're going to get a lot of practice very quickly in creating services and deployments. 16 00:01:03,670 --> 00:01:04,800 So let's get to it. 17 00:01:04,870 --> 00:01:09,160 We're going to first take a look at comments create moderation update your Ls in each of those to reach 18 00:01:09,160 --> 00:01:16,470 out to event plus a Savi whenever they need to create an event or begin inside of comments going to 19 00:01:16,490 --> 00:01:22,840 find the index not just file inside their and then I'm going to scroll through and just look for local 20 00:01:22,840 --> 00:01:23,730 host. 21 00:01:23,800 --> 00:01:30,230 Here's one right here I can replace local host with event bus as Savi. 22 00:01:30,270 --> 00:01:34,300 Then keep going here's another. 23 00:01:34,340 --> 00:01:38,990 So event bus s RV and I think that's it. 24 00:01:39,180 --> 00:01:41,940 To make sure that you have two updates inside of here. 25 00:01:42,050 --> 00:01:47,930 If you do a control F and look for local host you should do or get zero results. 26 00:01:47,950 --> 00:01:51,560 I'll then say this file and close it that's one down. 27 00:01:51,560 --> 00:01:54,770 Let's now move on to moderation inside there. 28 00:01:54,770 --> 00:02:04,040 I'll find the index not ust file is local host once right here I'll update that to event bus s RV. 29 00:02:04,480 --> 00:02:06,830 Save the file and. 30 00:02:06,850 --> 00:02:08,450 OK I think that's it as well. 31 00:02:08,520 --> 00:02:15,700 I'll do another control after local host no issue I'll save that and close it. 32 00:02:15,820 --> 00:02:20,720 And then finally inside of query a fine index not J.S.. 33 00:02:20,950 --> 00:02:29,040 I'll go down inside of here and it looks like we have one right here where we tried to do that kind 34 00:02:29,040 --> 00:02:37,770 of sink operation so I gonna make sure that I replace local hosts with event bus as Savi I'll say the 35 00:02:37,770 --> 00:02:38,100 file 36 00:02:41,570 --> 00:02:41,870 all right. 37 00:02:41,900 --> 00:02:47,330 So now comments moderation and query are all attempting to reach out to the event plus cluster IP service 38 00:02:47,360 --> 00:02:49,000 which is exactly what we want. 39 00:02:49,990 --> 00:02:54,250 So we're not going to go around inside of our terminal to all three of those directories and build images 40 00:02:54,250 --> 00:03:02,750 out of each of them and push them up to Docker Hub back at my terminal I'll first start off inside of 41 00:03:02,760 --> 00:03:11,190 comments I'll do a docker build dash t by Docker I.D. slash comments and then a dot 42 00:03:14,230 --> 00:03:20,290 looks good I'll do a docker push comments 43 00:03:24,570 --> 00:03:32,050 and that should take just a moment or two I'll let it just do its thing very quickly very good that's 44 00:03:32,050 --> 00:03:35,470 it for comments I'm not going to change over to a moderation 45 00:03:38,410 --> 00:03:46,360 I'll do a docker build moderation in their and a docker push 46 00:03:52,870 --> 00:03:56,320 and it looks like that one's gonna do a little bit of an upload so all that is running I'll open up 47 00:03:56,380 --> 00:04:00,910 a another terminal window just to save our selves a little bit of time here so you don't have to watch 48 00:04:00,910 --> 00:04:08,600 my slow upload speed so our last one is going to be for query so I'll change in the query I'll build 49 00:04:08,600 --> 00:04:09,290 that image 50 00:04:15,820 --> 00:04:17,110 and we'll do a docker push 51 00:04:19,690 --> 00:04:20,140 requiring 52 00:04:25,330 --> 00:04:32,650 all right so we have now updated the URLs we built images and pushed them to Docker Hub now lastly we 53 00:04:32,650 --> 00:04:38,360 need to do is create a deployment in a cluster IP service for each one this video might run a little 54 00:04:38,360 --> 00:04:43,760 bit long but I figure let's get all these steps done at least in one video just kind of to kind of get 55 00:04:43,760 --> 00:04:45,900 this busy work out of the way so let's just keep going. 56 00:04:45,900 --> 00:04:49,840 Right now they're getting created deployment and cluster IP service for each one. 57 00:04:50,000 --> 00:04:51,240 We'll do that back inside of our code. 58 00:04:51,250 --> 00:04:57,170 Ed remember we're going to write out a config file to get started for each of those inside my infra 59 00:04:57,170 --> 00:04:58,140 directory. 60 00:04:58,400 --> 00:05:06,900 I will first take care of comments so I'll make a new file called comments devil got Jamil rather than 61 00:05:06,900 --> 00:05:11,520 writing out the entire deployment file from scratch I'll just go and copy paste all the config from 62 00:05:11,520 --> 00:05:17,410 the event bus deployment file because just about all of our config around these deployments are going 63 00:05:17,410 --> 00:05:19,420 to be identical for right now. 64 00:05:19,680 --> 00:05:21,020 So years event bus depot. 65 00:05:21,030 --> 00:05:26,650 I'm to copy everything inside of here including the cluster I.P. service at the very bottom and I'll 66 00:05:26,650 --> 00:05:28,580 paste it into this new comments Dash. 67 00:05:28,580 --> 00:05:37,980 Double and then going to go through here an update event plus to say comments instead so I'll do one 68 00:05:39,640 --> 00:05:52,930 year to year three year for and here's five so make sure that you have no mention of event plus inside 69 00:05:52,930 --> 00:05:54,040 the deployment anymore. 70 00:05:55,070 --> 00:06:08,030 I'll then go down to the cluster IP service and I will replace even bus once Weiss and three times and 71 00:06:08,030 --> 00:06:13,270 then finally remember comments is not listening on port four thousand five Cummins listens on port four 72 00:06:13,270 --> 00:06:14,360 thousand one. 73 00:06:14,480 --> 00:06:15,890 I will update that as well. 74 00:06:15,990 --> 00:06:23,480 Do 4000 and 1 Make sure you don't have forty thousand won just four thousand and one all right. 75 00:06:23,490 --> 00:06:24,550 One down two to go. 76 00:06:24,570 --> 00:06:31,030 So going to say this file will then create another new file inside my gates directory. 77 00:06:31,140 --> 00:06:40,610 I'll call this one moderation dash double I'm going to paste that default config once again and I'll 78 00:06:40,610 --> 00:06:41,950 go through the same thing again. 79 00:06:41,990 --> 00:06:47,310 So event bus this time I'm just going to do a multi select since you just saw me do all those updates. 80 00:06:47,630 --> 00:06:51,320 So event bus 5 times update them all to moderation 81 00:06:54,120 --> 00:06:57,200 and then downside the service. 82 00:06:57,320 --> 00:07:02,530 I'm going to update those three to moderation and then remember moderation listens on port. 83 00:07:02,530 --> 00:07:07,150 What is it four thousand three I think I'll do a quick check inside of the index dot j ust file for 84 00:07:07,150 --> 00:07:08,210 moderation. 85 00:07:08,440 --> 00:07:16,230 So yes four thousand three they'll update the port and target ports to four thousand three gonna say 86 00:07:16,230 --> 00:07:22,670 this file and then finally one last file inside of eights. 87 00:07:22,680 --> 00:07:33,820 I'll do a query double memo in a paste once again and one more multi select there's query five times 88 00:07:33,820 --> 00:07:34,090 through 89 00:07:37,280 --> 00:07:41,930 replace these three with query and then this one is four thousand and two 90 00:07:44,820 --> 00:07:46,950 and I'll save the file. 91 00:07:47,030 --> 00:07:47,250 All right. 92 00:07:47,250 --> 00:07:49,100 That should be at it. 93 00:07:49,140 --> 00:07:52,880 So we've now made updates or created these three new deployment files. 94 00:07:52,890 --> 00:07:59,960 Each one consists of a deployment and a cluster IP service down the last thing we have to do is take 95 00:07:59,960 --> 00:08:01,940 those files and apply them into our cluster. 96 00:08:02,980 --> 00:08:11,670 Let's go back over to our command line going to change into that case in front directory in case and 97 00:08:11,670 --> 00:08:14,280 then we're going to apply all the config files inside of here. 98 00:08:14,400 --> 00:08:19,140 We could apply them all one by one but it would save us just a little bit of time to apply them all 99 00:08:19,140 --> 00:08:23,510 inside of one go to apply multiple config files with one single command. 100 00:08:23,520 --> 00:08:30,270 We write out cube CTO apply dash F and then dot and once again dot means find all the different config 101 00:08:30,270 --> 00:08:35,610 files inside of the current working directory and apply them so it's all run that and then I'll see 102 00:08:35,670 --> 00:08:38,130 a bunch of things being created. 103 00:08:38,320 --> 00:08:43,740 I've now got my query service there's the query deployment a I've got my common service Commons deployment 104 00:08:43,800 --> 00:08:52,020 and so on we can now do a cube Seitel get pods and we should now see some additional pods running and 105 00:08:52,050 --> 00:08:56,900 all them should have a status of running as well if any of them do not have a status of running then 106 00:08:56,920 --> 00:09:02,550 chances are that you made a mistake during pushing these images off to Docker Hub or alternatively maybe 107 00:09:02,550 --> 00:09:04,180 inside of a config file. 108 00:09:04,470 --> 00:09:09,720 So if you see a status of any of these of something like air image back off or air image pull any kind 109 00:09:09,720 --> 00:09:10,860 of air whatsoever. 110 00:09:10,860 --> 00:09:18,420 The first thing to do to debug it is to copy that pods name and then do a cube Seitel describe pod and 111 00:09:18,420 --> 00:09:24,590 then the pods name the run that command and you'll see a series of events down here which hopefully 112 00:09:24,590 --> 00:09:27,800 should give you some more information about what is going on. 113 00:09:27,820 --> 00:09:32,520 We should also make sure that all the different services were created as well so we can do a cube Seitel 114 00:09:32,530 --> 00:09:37,700 get services and we should see comments event bus moderation. 115 00:09:37,830 --> 00:09:44,930 Host cluster OHS which is our node bought and query Well I'd say it looks pretty good. 116 00:09:44,930 --> 00:09:46,330 Now the very last thing we have to do. 117 00:09:47,930 --> 00:09:53,040 Is make sure that we update the event bus to once again send events to comments query and moderation. 118 00:09:53,140 --> 00:09:56,690 So we'll take care of that in just a moment and then start to do a final test of our application.