1 00:00:01,020 --> 00:00:05,680 The last video we introduced this idea of Docker and we said that Docker makes it really easy to start 2 00:00:05,680 --> 00:00:07,910 up and run our different programs. 3 00:00:07,930 --> 00:00:11,530 We're not going to start to talk about Cuban eddies now as they talk about communities. 4 00:00:11,530 --> 00:00:15,580 We're not going to immediately see why Docker and Cuban natives are so nice together. 5 00:00:15,580 --> 00:00:19,300 It's not going to be immediately evident and you might be sitting there saying at the very end of this 6 00:00:19,300 --> 00:00:19,890 video. 7 00:00:20,050 --> 00:00:21,910 Wait why do we care about Docker again. 8 00:00:21,910 --> 00:00:23,050 Tell me about that. 9 00:00:23,050 --> 00:00:23,760 Well don't worry. 10 00:00:23,770 --> 00:00:26,940 All this stuff is going to become more evident in due time for it now. 11 00:00:26,950 --> 00:00:31,360 Let's just focus a little bit on Cuba natives and see how it solves one of those issues that we ran 12 00:00:31,360 --> 00:00:35,180 into a little bit earlier when we were talking about scaling our application. 13 00:00:35,190 --> 00:00:41,170 OK so first off what is Cuban net is Cuban natives is a tool for running a bunch of different containers 14 00:00:41,170 --> 00:00:44,100 together when we make use of Cuban natives. 15 00:00:44,140 --> 00:00:49,240 We're going to give it some configuration files these configuration files are going to tell Cuban eddies 16 00:00:49,270 --> 00:00:53,020 about the different containers that we want to run in our application. 17 00:00:53,020 --> 00:00:57,280 Cuban eddies is then going to create these containers that are going to run our programs for us and 18 00:00:57,280 --> 00:01:02,530 it's going to handle communication or essentially network requests between all these different containers 19 00:01:02,590 --> 00:01:08,950 as well so we can really imagine Cuban entities as a tool to run some different programs and make communication 20 00:01:08,950 --> 00:01:14,290 between those programs very easy and straightforward of course just giving you a verbal definition of 21 00:01:14,290 --> 00:01:16,930 this or a real verbal description is not super helpful. 22 00:01:16,990 --> 00:01:23,080 So let's take a look at a diagram and better understand what Cuba needs is all about the Cuban eddies 23 00:01:23,140 --> 00:01:28,620 we create something called a cluster a cluster is a set of different virtual machines. 24 00:01:28,780 --> 00:01:34,300 It can have as few as one virtual machine like what you see right here or it can have many hundreds 25 00:01:34,330 --> 00:01:36,940 or thousands of virtual machines. 26 00:01:36,940 --> 00:01:42,640 All these different virtual machines we refer to as nodes they are all managed by something called a 27 00:01:42,640 --> 00:01:48,490 master Master is essentially a program that's going to manage everything inside of our cluster all the 28 00:01:48,490 --> 00:01:52,660 different programs that are running all the different aspects of these virtual machines and many other 29 00:01:52,660 --> 00:01:53,410 things. 30 00:01:54,170 --> 00:01:59,750 We are going to tell Cuban cities to run some programs for us when we do so it's going to take our program 31 00:02:00,050 --> 00:02:04,720 and then more or less randomly assign it to be executed by one of these notes. 32 00:02:04,730 --> 00:02:08,360 And again remember a node is really just a virtual machine. 33 00:02:08,390 --> 00:02:13,890 Let's take a look at what this would really look like in practice so we are going to create some configuration 34 00:02:13,890 --> 00:02:20,190 files that are going to provide some very explicit directions to Cuba net on what we wanted to do so 35 00:02:20,190 --> 00:02:27,000 we might write a configuration file that says run two copies of our postal service and also make sure 36 00:02:27,000 --> 00:02:32,400 that we can very easily access these post services after they have been created. 37 00:02:32,490 --> 00:02:38,030 So you and I are going to write that configuration file and then feed it into this master thing. 38 00:02:38,190 --> 00:02:42,840 Master is going to read that configuration file and then try to implement all the steps we've written 39 00:02:42,840 --> 00:02:44,210 out inside there. 40 00:02:44,220 --> 00:02:51,000 So in this case it's going to attempt to create two different copies of our post service wrapped up 41 00:02:51,030 --> 00:02:57,090 inside of containers these will be randomly assigned again more or less randomly. 42 00:02:57,090 --> 00:02:58,770 There actually is some science to it. 43 00:02:58,780 --> 00:03:03,180 We can imagine right now they will be assigned to be executed by some different virtual machines or 44 00:03:03,270 --> 00:03:08,590 nodes inside of our cluster now in this scenario we're kind of back in the same problem we had before 45 00:03:08,740 --> 00:03:13,420 where it could potentially be really hard for something like our event bus to figure out in how to reach 46 00:03:13,420 --> 00:03:17,680 out to say this copy of the postal service and that postal service. 47 00:03:17,680 --> 00:03:22,930 So the big thing that Cuban 80s does for us is give us the ability to just kind of arbitrarily send 48 00:03:22,930 --> 00:03:27,730 requests or communicate between these different services with some kind of third party thing that we 49 00:03:27,730 --> 00:03:33,050 are going to create so in short you can kind of imagine down here that we're going to create something 50 00:03:33,050 --> 00:03:38,450 inside of our cluster that we can just send requests to and it will automatically figure out how to 51 00:03:38,450 --> 00:03:42,770 write requests off to the appropriate service that is running inside of application. 52 00:03:42,770 --> 00:03:47,600 So for example let's imagine that we've got a copy of the Postal Service on Node 1 or virtual machine 53 00:03:47,600 --> 00:03:49,760 number one one on number two. 54 00:03:49,760 --> 00:03:52,720 And then our event bus is over here on number three. 55 00:03:52,730 --> 00:03:58,310 If we were not using Cuban eddies we would have to somehow teach the event bus how to directly reach 56 00:03:58,310 --> 00:04:00,770 out over to this second virtual machine. 57 00:04:00,950 --> 00:04:04,940 And more specifically the postal service running on it and we'd have to figure out how to do the same 58 00:04:04,940 --> 00:04:09,110 thing to have it reach out to this first virtual machine. 59 00:04:09,110 --> 00:04:11,110 And the postal service running on there as well. 60 00:04:11,150 --> 00:04:15,040 And again as we discussed in the last couple of videos that is not what we want to do. 61 00:04:15,260 --> 00:04:21,260 So instead we will simply teach our event bus how to reach out to this very common communication channel 62 00:04:22,340 --> 00:04:27,080 if we send a request off to this very common communication channel we can then be guaranteed that it 63 00:04:27,080 --> 00:04:32,490 will be sent off or forwarded on to every copy of our postal service. 64 00:04:32,540 --> 00:04:36,970 And so we don't have to worry about all these intricate connection details or stuff like that. 65 00:04:36,980 --> 00:04:42,110 We can simply say make a request to the service and Cuba needs is going to take care of everything from 66 00:04:42,110 --> 00:04:43,300 there. 67 00:04:43,340 --> 00:04:47,750 So the big reason that you and I are using Cuban eddies around micro services is that it's going to 68 00:04:47,750 --> 00:04:51,210 make communication very easy and straightforward. 69 00:04:51,260 --> 00:04:56,450 It's also going to make creating services like launching new copies and scaling the number of copies 70 00:04:56,450 --> 00:05:00,100 are running very easy and straightforward as well. 71 00:05:00,110 --> 00:05:04,010 Now this whole idea of having our services communicate with each other you might be sitting there and 72 00:05:04,010 --> 00:05:08,560 saying wait Steven I thought we didn't want our services to communicate directly with each other. 73 00:05:08,570 --> 00:05:09,310 Well yes. 74 00:05:09,320 --> 00:05:12,710 Remember we are not using synchronous communication between our services. 75 00:05:12,830 --> 00:05:17,960 But there still are programs that ultimately do have to talk with each other inside of our micro services 76 00:05:17,990 --> 00:05:19,190 applications. 77 00:05:19,190 --> 00:05:23,500 We still need to have our services communicate with some common event us. 78 00:05:23,570 --> 00:05:28,060 We need to make sure at some point time that our services can also communicate with say a database that 79 00:05:28,060 --> 00:05:33,050 it's being assigned to it and having this common communication channel is going to make that process 80 00:05:33,140 --> 00:05:36,390 a lot easier and more straightforward OK. 81 00:05:36,420 --> 00:05:40,710 So that's just a very brief introduction to Cuban natives and why we care about it in the world of micro 82 00:05:40,710 --> 00:05:41,740 services. 83 00:05:41,850 --> 00:05:45,420 They're going to take a pause right here and then start to discuss Docker a little bit more and get 84 00:05:45,420 --> 00:05:47,090 more familiar with it in just a moment.