1
00:00:04,530 --> 00:00:07,350
Blend for this next step is following the rules.

2
00:00:07,380 --> 00:00:14,340
We will create no GS Express Web application and we will configure our web server in such a way that

3
00:00:14,340 --> 00:00:21,730
it will respond with the hostname of the server when we connect to it using a route URL and in such

4
00:00:21,730 --> 00:00:27,300
a way we will be able to distinguish which bot actually answers specific request.

5
00:00:28,290 --> 00:00:36,240
We will also tokenize such application using a docker file and docker build command and afterwards push

6
00:00:36,240 --> 00:00:38,430
build docker image to Docker hub.

7
00:00:38,760 --> 00:00:47,100
And finally we will create deployment using such custom built image, you could find all final project

8
00:00:47,100 --> 00:00:49,050
files in the GitHub repository.

9
00:00:49,050 --> 00:00:54,690
You will find link to it right now here, but I highly recommend to you to create such an application

10
00:00:54,690 --> 00:00:59,370
yourself, even if you don't know much about no GPRS and express.

11
00:00:59,370 --> 00:01:06,060
And of course I recommend to you to build your custom image and push it to your Docker hub account.

12
00:01:06,060 --> 00:01:09,840
Of course you could utilize images available under my account.

13
00:01:09,840 --> 00:01:10,860
They are public.

14
00:01:10,860 --> 00:01:12,000
It's up to you.

15
00:01:12,150 --> 00:01:14,970
So let's now open a Visual Studio code.

16
00:01:14,970 --> 00:01:17,220
If you don't have it, please install it.

17
00:01:17,250 --> 00:01:18,660
I'll open it up.

18
00:01:19,350 --> 00:01:25,320
And here in the Visual Studio code, please open up, embed a terminal press key combination control

19
00:01:25,320 --> 00:01:33,720
back like that terminal was opened and now let's create folder for our project files LCD to desktop

20
00:01:33,960 --> 00:01:41,880
and here using make directory command I'll create folder k8s stands for Kubernetes as you already know.

21
00:01:41,910 --> 00:01:50,820
Let's see it to k8s folder and you could open any folder using code dot command if you correctly installed

22
00:01:50,850 --> 00:01:52,020
Visual Studio code.

23
00:01:52,050 --> 00:01:58,260
If such a command is not available on your computer, you could press key combination command shift

24
00:01:58,290 --> 00:02:06,930
P or control shift p on windows and here enter code and select shell command install code command in

25
00:02:06,930 --> 00:02:12,450
path and afterwards Code Command will be available from any terminal.

26
00:02:12,450 --> 00:02:16,020
So I have this command already available in the path.

27
00:02:16,020 --> 00:02:19,770
That's why I'll open k8s folder in the Visual Studio.

28
00:02:19,770 --> 00:02:21,690
Code Editor So code dot.

29
00:02:22,900 --> 00:02:26,530
It will be opened in the new window like that.

30
00:02:26,620 --> 00:02:30,680
Now this folder is completely empty and has no files.

31
00:02:30,700 --> 00:02:31,960
Let me again open.

32
00:02:31,960 --> 00:02:36,520
And by the terminal here it will be opened in k8s folder.

33
00:02:36,520 --> 00:02:40,600
And now here let's create folder for our first project.

34
00:02:40,810 --> 00:02:45,370
And this folder name will be, let's say k8s.

35
00:02:46,000 --> 00:02:47,810
That's Web desk.

36
00:02:47,830 --> 00:02:48,410
Hello.

37
00:02:48,430 --> 00:02:55,480
Because we will build very basic web application which will simply respond hello from server and server

38
00:02:55,480 --> 00:02:55,920
name.

39
00:02:55,930 --> 00:02:57,660
So k8s web.

40
00:02:57,670 --> 00:02:58,240
Hello.

41
00:02:58,630 --> 00:03:03,280
And here in this folder we will create Node.js application.

42
00:03:03,400 --> 00:03:06,970
Let's here in the terminal city to k8s web.

43
00:03:07,000 --> 00:03:07,880
Hello folder.

44
00:03:07,900 --> 00:03:08,620
Like that.

45
00:03:08,920 --> 00:03:13,120
And here first we will initialize node g's application.

46
00:03:13,120 --> 00:03:17,030
And in order to do so, you have to install NPM on your computer.

47
00:03:17,050 --> 00:03:24,340
If you don't have no g's and and PM available, please go to Node.js download.

48
00:03:26,450 --> 00:03:27,710
Here is a link.

49
00:03:27,740 --> 00:03:32,360
Download Node.js and install Node.js on your computer.

50
00:03:32,390 --> 00:03:35,390
It will be installed along with an RPM.

51
00:03:35,630 --> 00:03:41,270
Of course, we will not run applications using Node.js on our computers.

52
00:03:41,450 --> 00:03:47,720
We will run application inside of the container in the Kubernetes cluster instead.

53
00:03:47,900 --> 00:03:55,360
But in order to initialize project locally and install dependencies, you have to use NPM.

54
00:03:55,370 --> 00:04:02,360
So therefore please install node.js along with NPM afterwards and PM should become available on your

55
00:04:02,360 --> 00:04:03,080
computer.

56
00:04:03,110 --> 00:04:05,330
I'll hide this back pain.

57
00:04:05,900 --> 00:04:12,110
And now here let me and PM in it and I'll initialize this project.

58
00:04:12,110 --> 00:04:18,200
And you could add here optional dash y which will skip all answers to you during initialization of the

59
00:04:18,200 --> 00:04:19,670
new Node.js project.

60
00:04:19,670 --> 00:04:21,470
So in PM init that's why.

61
00:04:22,960 --> 00:04:24,880
New project was initialized.

62
00:04:24,880 --> 00:04:32,050
And here you should find now package the JSON file with such contents, name of the project version

63
00:04:32,050 --> 00:04:32,890
and so on.

64
00:04:33,070 --> 00:04:39,820
And now let's install package called express and PM install express.

65
00:04:41,720 --> 00:04:48,080
It will be downloaded from the NPM registry package was installed and packaged.

66
00:04:48,080 --> 00:04:53,210
The JSON file was updated here was now dependency called express.

67
00:04:53,780 --> 00:05:01,730
So now let's create index the GS file in our K eight web hello folder.

68
00:05:01,760 --> 00:05:07,520
By the way, notice that now there is no modules folder which contains all dependencies of our project,

69
00:05:07,520 --> 00:05:11,030
but now it is safe to simply remove this folder.

70
00:05:11,030 --> 00:05:16,580
We don't need it anymore because we will not run this project locally with help of Node.

71
00:05:16,580 --> 00:05:19,610
So simply select this folder and delete.

72
00:05:20,770 --> 00:05:21,320
All right.

73
00:05:21,430 --> 00:05:25,330
Now we have only package the JSON and package log the JSON files.

74
00:05:25,540 --> 00:05:26,060
Great.

75
00:05:26,080 --> 00:05:31,660
Now let's create file and we will create it inside of the k8s web hello folder.

76
00:05:31,660 --> 00:05:38,080
So new file and let's name it index dot m j is why?

77
00:05:38,080 --> 00:05:46,260
M because we will utilize ES6 modules syntax which is available in Node.js starting from version 13.

78
00:05:46,270 --> 00:05:52,780
And if you would like to use import statements instead of the required statements, you have to name

79
00:05:52,780 --> 00:05:55,330
files with extension images.

80
00:05:55,330 --> 00:06:03,640
So let's create file index dot GHS and here I will not type the contents of entire application.

81
00:06:03,640 --> 00:06:07,210
I will simply copy them in order to save some time.

82
00:06:07,390 --> 00:06:13,930
So paste here if you would like you could of course write this very tiny application yourself.

83
00:06:13,930 --> 00:06:16,960
So we import Express from express package.

84
00:06:16,960 --> 00:06:19,300
We also import OS from OS.

85
00:06:19,300 --> 00:06:28,270
OS is built in Node.js module and afterwards we create express application here export 3000.

86
00:06:28,270 --> 00:06:34,120
You could specify any other port if you would like, and that's that port where our express web server

87
00:06:34,120 --> 00:06:36,520
will be running inside of the container.

88
00:06:36,970 --> 00:06:41,740
Here we are adding root handler from slash URL.

89
00:06:41,740 --> 00:06:48,070
It is a root URL and we simply answer to the client with text.

90
00:06:48,100 --> 00:06:48,580
Hello.

91
00:06:48,580 --> 00:06:56,860
From the os host name using OS package, we retrieve hostname of the server and in the response from

92
00:06:56,860 --> 00:07:03,730
the server you will see simply text message hello from there and name of the server where this application

93
00:07:03,730 --> 00:07:04,570
is running.

94
00:07:04,870 --> 00:07:06,010
So rest sent.

95
00:07:06,010 --> 00:07:14,440
We send to the client such message and also we log it to the console and finally we start express web

96
00:07:14,440 --> 00:07:16,180
server object lesson.

97
00:07:16,180 --> 00:07:23,650
And we started at this broad 3000 and when server starts we will look to the console message.

98
00:07:23,650 --> 00:07:26,770
Web server is listening at port and here respond.

99
00:07:27,220 --> 00:07:34,270
I will not dive deeper into the explanations and syntax of Node.js because it is not Node.js course.

100
00:07:34,270 --> 00:07:35,650
But you get an idea.

101
00:07:35,650 --> 00:07:41,230
We create very basic web server which will respond with such text message.

