1 00:00:00,960 --> 00:00:05,130 In this video we're going to go into our post application and update all the requests that we're making 2 00:00:05,130 --> 00:00:09,900 over a two hour event us to use the name of the event bus service. 3 00:00:09,900 --> 00:00:13,830 Well then do the same thing with the event bus so we'll open up the event bus code and each time we 4 00:00:13,830 --> 00:00:17,710 try to make a request over to our post service or the post application. 5 00:00:17,790 --> 00:00:21,070 We'll make sure we update that you all as well as you can guess. 6 00:00:21,090 --> 00:00:28,350 We are going to start to add in eventually some new pods for our comet stuff for moderation and query. 7 00:00:28,350 --> 00:00:31,470 Those are all going to need some services to be created as well. 8 00:00:31,470 --> 00:00:35,670 And we're going to need to make sure that for each of those services we update all the appropriate URLs 9 00:00:35,670 --> 00:00:37,290 inside of our codebase too. 10 00:00:37,320 --> 00:00:40,030 So eventually we're going to have to update a lot of your else. 11 00:00:40,050 --> 00:00:45,740 But right now let's just focus on posts and event buzz and just get those two things working. 12 00:00:45,920 --> 00:00:46,130 All right. 13 00:00:46,310 --> 00:00:50,680 So inside of our code Ed we're going to find our postal application once again and find the index not 14 00:00:50,690 --> 00:00:57,400 just file but here's where we are making a post request to slash posts or we had the handler for it 15 00:00:59,070 --> 00:01:01,680 and this is where we reach out to revamp US. 16 00:01:01,680 --> 00:01:04,260 So no longer are we going to make a request to local host. 17 00:01:04,260 --> 00:01:09,810 Instead we make a request to the service that is governing access to the event bus. 18 00:01:09,810 --> 00:01:17,750 So it will be event bus as Savi and it's absolutely always worth when you type in one of these service 19 00:01:17,750 --> 00:01:18,950 names inside of your code. 20 00:01:18,950 --> 00:01:21,070 Always worth going over to your terminal. 21 00:01:21,140 --> 00:01:22,710 Doing a quick cube Seitel. 22 00:01:22,720 --> 00:01:29,300 Get services and just double checking the spelling and also double checking the port as well. 23 00:01:29,450 --> 00:01:34,630 The event bus SRB at port four thousand and five does that line up. 24 00:01:35,050 --> 00:01:41,990 Yes it does then continue down and see if there are any other requests being issued in here to our event 25 00:01:41,990 --> 00:01:43,100 bus. 26 00:01:43,130 --> 00:01:44,890 No I don't think there are. 27 00:01:44,970 --> 00:01:51,710 It's all save this file and close it all then go over to my event bus all about the index not just file 28 00:01:51,710 --> 00:01:53,890 inside there as well. 29 00:01:53,930 --> 00:01:58,640 This is where we are making our series of request to all the different sub or micro services we have 30 00:01:58,640 --> 00:02:01,100 inside of our at so at present. 31 00:02:01,110 --> 00:02:06,070 We don't have any implementation or comments moderation or query. 32 00:02:06,090 --> 00:02:08,310 So I'm just going to temporarily comment those out. 33 00:02:08,310 --> 00:02:13,530 We'll come back in uncommon them very shortly as we start to bring the comments moderation and query 34 00:02:13,680 --> 00:02:15,710 micro services live inside of our cluster. 35 00:02:16,050 --> 00:02:20,020 But right now if we tried to make a request to those endpoints we would end up with an error. 36 00:02:20,100 --> 00:02:27,770 Probably not what we want so we'll just leave behind the request to our hosts micros service. 37 00:02:27,920 --> 00:02:30,080 I'm going to find local host right there. 38 00:02:30,080 --> 00:02:33,140 We no longer want to make a request to local hosts. 39 00:02:33,190 --> 00:02:39,100 Instead we want to make a request to post cluster IP SRB because that's how we get access to the post 40 00:02:39,120 --> 00:02:41,640 pod once again. 41 00:02:41,660 --> 00:02:45,640 I'll go to my terminal do a cube CTO get services and just verify the name. 42 00:02:45,800 --> 00:03:01,450 Yep hosts cluster IP SRB at Port 4000 so post cluster IP as Savi still port four thousand go. 43 00:03:01,460 --> 00:03:02,490 So I'll say this as well. 44 00:03:03,600 --> 00:03:09,640 So we've now made changes to two of our micros services and we need to somehow now deploy those we spoke 45 00:03:09,640 --> 00:03:12,310 about how we update deployments just a little bit ago. 46 00:03:12,340 --> 00:03:17,450 So as a quick reminder see where's our diagram for it somewhere. 47 00:03:17,450 --> 00:03:20,860 Here it is right here so we've made an update to our code. 48 00:03:20,860 --> 00:03:26,470 If you want to deploy that we're going to rebuild the image or our event bus and propose will then push 49 00:03:26,470 --> 00:03:31,510 those images to Docker Hub and then run the command QCT CTO blah blah blah with the deployment name 50 00:03:32,950 --> 00:03:34,220 so we've updated our code. 51 00:03:34,220 --> 00:03:44,030 Let's go and rebuild both those images again at my terminal all change back into my event bus directory 52 00:03:45,070 --> 00:03:49,900 and do a docker build dash T. 53 00:03:50,140 --> 00:03:52,830 Steven Greider event dash bus Dot. 54 00:03:52,860 --> 00:03:57,330 Don't forget the dot at the end. 55 00:03:57,410 --> 00:03:57,840 There's that. 56 00:03:57,850 --> 00:04:03,040 I'll push that image though Docker push event bus 57 00:04:06,990 --> 00:04:10,060 that'll take just a minute or two maybe I'll be really quick. 58 00:04:10,140 --> 00:04:11,900 Let's see how long it takes. 59 00:04:11,940 --> 00:04:12,860 Very good. 60 00:04:12,870 --> 00:04:15,190 I'll go and do the same thing for post as well. 61 00:04:15,190 --> 00:04:25,030 They'll go up one directory change into posts we'll do a docker build your Docker I.D. flash posts and 62 00:04:25,030 --> 00:04:29,570 a dot at the very end. 63 00:04:30,220 --> 00:04:41,880 And a docker push repos. 64 00:04:41,920 --> 00:04:42,340 All right. 65 00:04:42,340 --> 00:04:47,650 So now to make sure that we update both of our deployments we'll do the cube CTO rollout restart deployment 66 00:04:48,040 --> 00:04:51,740 or our post deployment and the event plus deployment as well. 67 00:04:52,680 --> 00:04:59,460 If we forget the name of those deployments we can raise you a QCT I'll get deployments so there's the 68 00:04:59,460 --> 00:05:01,430 name of the two deployments that we need to restart. 69 00:05:02,280 --> 00:05:04,520 So let's do the post one first. 70 00:05:04,520 --> 00:05:08,160 They'll do a cube CDL rollout restart deployment 71 00:05:11,460 --> 00:05:21,800 O's double UCL rollout restart event bus depot Oh restart deployment 72 00:05:26,510 --> 00:05:26,870 there we go 73 00:05:29,730 --> 00:05:34,940 all then list out all my pods and make sure that they both just got restarted so acute I'll get pods 74 00:05:36,120 --> 00:05:41,190 Oh this is interesting you'll notice that I ran this command quickly enough to see the old pod that 75 00:05:41,190 --> 00:05:46,230 was being executed for the event plus deployment it's now being terminated as being replaced with this 76 00:05:46,230 --> 00:05:52,770 brand new one because we are trying to replace or re start or I should say yes replace the pod that 77 00:05:52,770 --> 00:05:58,390 was already running I'll do another get pods it looks like that other one has now been fully terminated 78 00:05:58,630 --> 00:06:05,380 and we've now got just these two pods well the last thing we need to do is a quick test so we're going 79 00:06:05,380 --> 00:06:11,710 to open up postmen we're going to try to manually create a post by issuing a post request to our post 80 00:06:11,800 --> 00:06:17,950 service or the post micros service and then we'll make sure that the event bus and posts are somehow 81 00:06:17,950 --> 00:06:23,470 in communication by doing their logs and making sure that they are exchanging some events this video 82 00:06:23,470 --> 00:06:24,760 is running a little bit long however. 83 00:06:24,790 --> 00:06:26,980 So let's take care of that little test in just a moment.