1
00:00:04,930 --> 00:00:07,150
You're inside of the K eight se folder.

2
00:00:07,180 --> 00:00:09,430
Let me close those files for the moment.

3
00:00:09,460 --> 00:00:12,100
Let's create a copy of this folder.

4
00:00:12,130 --> 00:00:13,410
k8s web.

5
00:00:13,420 --> 00:00:13,920
Hello.

6
00:00:13,930 --> 00:00:19,510
Which contains all files related to our web express application.

7
00:00:20,020 --> 00:00:26,840
Let's copy this folder and paste here and let's rename it simply click on this name.

8
00:00:26,860 --> 00:00:29,260
Press enter and enter a new name.

9
00:00:29,290 --> 00:00:33,580
K eight as web two and Gen X like that.

10
00:00:34,090 --> 00:00:34,880
Next.

11
00:00:34,900 --> 00:00:37,960
Let's keep Docker file unmodified.

12
00:00:38,680 --> 00:00:42,250
Here are contents of this docker file in this folder.

13
00:00:42,250 --> 00:00:50,740
So no modifications here, but we will slightly modify index dot mdgs file and I will grab a modified

14
00:00:50,740 --> 00:00:52,240
file from here.

15
00:00:52,570 --> 00:00:55,450
Let me copy it and paste here.

16
00:00:55,660 --> 00:01:01,540
So here are contents of index dot img file for this second application.

17
00:01:02,530 --> 00:01:06,640
There is still root URL here for what's left.

18
00:01:06,730 --> 00:01:16,630
We still create express web etc. but we add here one more end point and Jennings and its root handler

19
00:01:16,630 --> 00:01:24,550
is now async function because now we will connect to another server simulating connection between different

20
00:01:24,550 --> 00:01:27,940
deployments and notice you are well here.

21
00:01:27,970 --> 00:01:37,540
It is simply a HTTP corn slash, slash and genesis and we will create a service called Engine X for

22
00:01:37,540 --> 00:01:39,460
second engine is deployment.

23
00:01:40,030 --> 00:01:47,560
And from this deployment we will be able to connect to another deployment using just name of the corresponding

24
00:01:47,560 --> 00:01:48,280
service.

25
00:01:48,370 --> 00:01:49,750
Simple as that.

26
00:01:51,390 --> 00:01:57,420
Of course it is possible to connect using either cluster IP, but cluster IP is dynamic.

27
00:01:57,900 --> 00:01:59,820
The name of the service is static.

28
00:02:00,390 --> 00:02:07,590
So we will connect to one of the engine servers by using engine service name.

29
00:02:08,009 --> 00:02:13,860
And here we utilize phage which we import from node phage package.

30
00:02:13,860 --> 00:02:17,970
By the way, in the moment we will install it in this application as well.

31
00:02:18,240 --> 00:02:28,140
So we are waiting for response from the DNS server and afterwards we take Buddy from the response calling

32
00:02:28,140 --> 00:02:32,880
text method and simply return to the client this body.

33
00:02:33,390 --> 00:02:41,700
Essentially what this endpoint will do, it will simply proxy request to the antigenic server and return

34
00:02:41,700 --> 00:02:44,280
the result response from the engine to the client.

35
00:02:44,280 --> 00:02:45,420
Simple as that.

36
00:02:47,350 --> 00:02:50,440
And here we import fetch from Nord fetch.

37
00:02:50,470 --> 00:02:54,370
Therefore, we have to install such external dependency.

38
00:02:54,640 --> 00:02:56,950
And for that, let's open up a better terminal.

39
00:02:56,950 --> 00:03:01,240
And here make sure that you CD to this folder.

40
00:03:01,330 --> 00:03:06,490
k8s web to Engine X, web to Engine X.

41
00:03:07,270 --> 00:03:11,710
And here let's enter and PM install node fetch.

42
00:03:13,420 --> 00:03:14,640
In StarLink package.

43
00:03:16,050 --> 00:03:19,950
You will see that this package, the JSON file, will be modified.

44
00:03:22,130 --> 00:03:29,570
So now here are two dependencies express and node phage dependency was installed and notice again that

45
00:03:29,570 --> 00:03:33,440
load modules folder has appeared here but we don't need it here.

46
00:03:33,440 --> 00:03:41,030
Let's simply remove it because inside of the image which we will build right now, we have instruction

47
00:03:41,030 --> 00:03:44,220
to run and PM install.

48
00:03:44,240 --> 00:03:45,140
Here it is.

49
00:03:45,140 --> 00:03:50,000
That's why all necessary dependencies will be installed inside of the Docker image.

