1 00:00:00,950 --> 00:00:03,800 We're not ready to start development of our art service. 2 00:00:03,830 --> 00:00:08,090 Now remember a couple of videos ago I told you that we're going to take a very testing heavy approach 3 00:00:08,120 --> 00:00:12,800 in the development of this application before we worry about sending up any additional tooling around 4 00:00:12,800 --> 00:00:13,940 testing or anything like that. 5 00:00:13,940 --> 00:00:18,410 However I think that we should just make sure that we can do some manual testing using something like 6 00:00:18,410 --> 00:00:23,000 say postman just we can get started with this authentication stuff and continue making some progress 7 00:00:23,000 --> 00:00:24,150 forward. 8 00:00:24,150 --> 00:00:29,990 So in this video we're going to set up a root handler or the root of API users current user whenever 9 00:00:29,990 --> 00:00:31,390 we make a GET request to that. 10 00:00:31,460 --> 00:00:36,350 Right now we'll just send back some dummy response to maybe some little message like hi there or something 11 00:00:36,350 --> 00:00:37,250 like that. 12 00:00:37,340 --> 00:00:40,440 Well then make sure that we can access that inside of our browser. 13 00:00:40,490 --> 00:00:43,310 So let's get to it. 14 00:00:43,340 --> 00:00:46,710 I'm going to first get started by going to my auth directory. 15 00:00:46,710 --> 00:00:52,610 Inside there off on the SRT folder and then the index dot yes file inside of their than inside they're 16 00:00:53,070 --> 00:00:55,610 going to add in a get request handler. 17 00:00:55,620 --> 00:01:01,950 They'll do it an app dot get we want to listen for an incoming request on the route of API users current 18 00:01:01,950 --> 00:01:10,590 user the API users current user and I'll add in my callback with req and rez like so 19 00:01:14,190 --> 00:01:20,680 then inside of here we're gonna take that response and we'll send back something like buy there for 20 00:01:20,680 --> 00:01:27,740 right now I'll then save this file I should then be able to go back over to my terminal and confirm 21 00:01:27,860 --> 00:01:31,250 that my server has automatically restarted. 22 00:01:31,250 --> 00:01:31,490 OK. 23 00:01:31,510 --> 00:01:32,840 So Alex Good. 24 00:01:32,900 --> 00:01:40,340 Now we need to be able to somehow access are running server specifically our off pod remember that to 25 00:01:40,340 --> 00:01:42,500 access anything inside of our cluster. 26 00:01:42,500 --> 00:01:45,610 We have to set up one of two things really have two options. 27 00:01:45,620 --> 00:01:51,200 We can either set up on those node port services or we can setup that ingress service. 28 00:01:51,200 --> 00:01:55,960 Remember that Ingress is all about having some routing rules tied to engine x. 29 00:01:56,090 --> 00:02:01,090 So in any time a request comes into our cluster it'll be handled by that ingress service. 30 00:02:01,160 --> 00:02:04,790 They'll be routed off to the appropriate service within our cluster. 31 00:02:04,790 --> 00:02:05,900 So that's what we're going to do right now. 32 00:02:05,900 --> 00:02:10,730 We're going to add in a little bit of configuration rules to ingress engine X just as we did on our 33 00:02:10,730 --> 00:02:13,580 last application now. 34 00:02:13,600 --> 00:02:19,070 Quick reminder about ingress engine X in general between the last application and this one we did not 35 00:02:19,070 --> 00:02:25,310 delete ingress engine X or anything like that out of our cluster when we stopped our scaffold tool from 36 00:02:25,310 --> 00:02:26,230 the last application. 37 00:02:26,240 --> 00:02:32,540 Just a couple of videos ago we deleted all the deployments services and pods that were listed inside 38 00:02:32,600 --> 00:02:33,710 of our project. 39 00:02:33,710 --> 00:02:40,340 From that last project we did not delete anything specifically tied to ingress engine X beyond our set 40 00:02:40,340 --> 00:02:41,810 of config rules. 41 00:02:41,840 --> 00:02:47,960 So in other words you should not have to reinstall ingress engine X right now unless you for some reason 42 00:02:48,020 --> 00:02:54,020 reset your cluster between the last set application and this one or manually deleted all the ingress 43 00:02:54,050 --> 00:02:56,570 engine X stuff or something like that. 44 00:02:56,660 --> 00:03:01,520 So we should only have to write out a new config file for ingress engine X and that config file will 45 00:03:01,520 --> 00:03:05,210 be loaded into our existing copy of the ingress engine next controller. 46 00:03:05,240 --> 00:03:09,560 That is all running or still running I should say inside of our cluster. 47 00:03:09,560 --> 00:03:14,150 As a quick reminder if you did restart your cluster or reset it right thing like that for any reason 48 00:03:14,480 --> 00:03:21,080 to get ingress and Gen-X reinstalled all you Chef do is come to the documentation page go to deployment 49 00:03:22,130 --> 00:03:27,690 run the mandatory command right here and then run either the docker from Mac. 50 00:03:27,700 --> 00:03:34,310 This is also the docker for Windows option or the mini can keep command right there OK. 51 00:03:34,340 --> 00:03:41,790 So once you get that stuff all set up we're going to put together a ingress config file once again and 52 00:03:41,790 --> 00:03:47,220 we're going to make sure that any time a request comes in for a request to our route of API slash users 53 00:03:47,400 --> 00:03:49,590 we're going to send it off to our art service. 54 00:03:49,680 --> 00:03:53,030 So let's do that right away back inside of my editor. 55 00:03:53,060 --> 00:03:56,570 I'm going to find my infra directory inside the K AIDS folder inside there. 56 00:03:56,590 --> 00:04:02,690 I'm going to create a new file called Ingress dash SRB thought Amel that inside of here we're going 57 00:04:02,690 --> 00:04:09,660 to write some configuration to tell the ingress engine X controller exactly how to handle incoming requests 58 00:04:10,290 --> 00:04:23,350 let's say API version extensions slash V1 Beta 1 bind of ingress metadata we're going to give it a name 59 00:04:23,350 --> 00:04:31,560 of ingress dash service we're gonna put on an annotation section the first annotation we'll add in is 60 00:04:31,650 --> 00:04:33,900 Cuba net is dot Io. 61 00:04:33,930 --> 00:04:35,760 Double check your spelling on Cuban net right there. 62 00:04:35,760 --> 00:04:48,090 Very easy word to Miss type flash ingress thought class is engine X and then engine X that ingress dot 63 00:04:48,120 --> 00:04:53,280 Cuba net is that Io slash use rig x of true. 64 00:04:53,280 --> 00:04:58,200 And remember trainees to be inside of quotes like so don't forget that this overall annotation right 65 00:04:58,200 --> 00:04:59,460 here is telling. 66 00:04:59,550 --> 00:05:03,240 Engine next that it should expect that some are different path that we're gonna list in the bottom half 67 00:05:03,240 --> 00:05:10,300 the file are going to have regular expressions inside them well then put together our spec section we're 68 00:05:10,300 --> 00:05:13,360 going to have a set of rules just one road or right now. 69 00:05:13,370 --> 00:05:17,870 So I'll put in a dash number we'll specify our host. 70 00:05:17,950 --> 00:05:22,360 Remember that the host right here is going to be a kind of pretend domain name. 71 00:05:22,510 --> 00:05:25,040 So we're gonna put in some made up domain name right there. 72 00:05:25,120 --> 00:05:28,990 There were going to be able to connect to only from our local machine. 73 00:05:28,990 --> 00:05:32,530 So whatever domain name that we're gonna enter in right there we're gonna make sure we also go over 74 00:05:32,530 --> 00:05:37,330 and edit our Hosts file as well just as we did on the last project. 75 00:05:37,330 --> 00:05:43,710 I'm going to use a made up domain name of tickets not death. 76 00:05:43,730 --> 00:05:48,060 And how about I'll do ticketing dot Dev. 77 00:05:48,060 --> 00:05:54,210 So this is my made up domain name that is only gonna work on my local machine I'll then put in an H 78 00:05:54,210 --> 00:05:57,180 TTP section with parts. 79 00:05:57,180 --> 00:06:04,060 We're gonna have one entry inside of here right now so gonna give it a path of slash API flash users 80 00:06:04,150 --> 00:06:13,010 slash question mark parentheses dot star that means that any time someone makes a request to our cluster 81 00:06:13,610 --> 00:06:20,360 and the request has a path of API slash users slash anything then we're going to send that request on 82 00:06:20,900 --> 00:06:28,900 to this listed back end in this case we want to send it to the service that has a name of off Dash. 83 00:06:28,900 --> 00:06:31,940 S are V. 84 00:06:32,090 --> 00:06:36,800 Remember that name is coming right there from the auth service we created just a moment ago inside of 85 00:06:36,800 --> 00:06:41,600 our opt depot file there's the name of the service that we want to send the request to and we want to 86 00:06:41,600 --> 00:06:47,120 make sure that we send it to the service on the port three thousand we'll do that service name along 87 00:06:47,120 --> 00:06:56,130 with a service port of three thousand as well and I'll save this file once I save the file I should 88 00:06:56,130 --> 00:07:01,020 be able to go back over to my terminal and see that the ingress service was configured so that looks 89 00:07:01,020 --> 00:07:03,620 good let's take a quick pause right here. 90 00:07:03,620 --> 00:07:08,000 When we come back the next video we still have to do a little bit of setup so remember we have to update 91 00:07:08,030 --> 00:07:12,650 our host file on our local machine to make sure that any time we make a request to ticketing dot Dev 92 00:07:12,890 --> 00:07:17,530 it redirects that request to our local machine or it stays on our local machine. 93 00:07:17,540 --> 00:07:19,370 So we'll take care of that in just a moment.