1
1

00:00:00,750  -->  00:00:02,500
<v ->Hi guys, and welcome back.</v>
2

2

00:00:02,500  -->  00:00:04,740
In this video, we're going to be getting our code
3

3

00:00:04,740  -->  00:00:07,710
from github into our server.
4

4

00:00:07,710  -->  00:00:09,970
The first thing we have to do is create a folder
5

5

00:00:09,970  -->  00:00:11,993
for our code to be placed in.
6

6

00:00:14,758  -->  00:00:16,900
And with this does, is it creates the directory
7

7

00:00:16,900  -->  00:00:20,640
var/www/html/pricing-service,
8

8

00:00:20,640  -->  00:00:24,000
and if any of these directories in the middle don't exist
9

9

00:00:24,000  -->  00:00:25,420
it's also gonna create them.
10

10

00:00:25,420  -->  00:00:28,160
That's what this -p does.
11

11

00:00:28,160  -->  00:00:32,260
Notice that this command is being ran as the root user.
12

12

00:00:32,260  -->  00:00:35,150
So when we run it, the directory will be owned
13

13

00:00:35,150  -->  00:00:36,270
by the root user.
14

14

00:00:36,270  -->  00:00:41,270
And we can check by doing ls-al/var/www/html.
15

15

00:00:42,040  -->  00:00:44,860
And then you can see that the pricing service directory
16

16

00:00:44,860  -->  00:00:48,410
that we just created is owned by the root user
17

17

00:00:48,410  -->  00:00:49,803
and the root group.
18

18

00:00:50,970  -->  00:00:54,090
We have to change that, so that our user has permissions
19

19

00:00:54,090  -->  00:00:56,300
to operate within that directory,
20

20

00:00:56,300  -->  00:00:58,770
otherwise we will have to do everything else,
21

21

00:00:58,770  -->  00:00:59,810
from this point onwards,
22

22

00:00:59,810  -->  00:01:01,380
using the root user,
23

23

00:01:01,380  -->  00:01:03,483
and we wanna avoid that where possible.
24

24

00:01:04,570  -->  00:01:07,390
So to change the ownership of the directory,
25

25

00:01:07,390  -->  00:01:10,610
we'll say chown for change ownership,
26

26

00:01:10,610  -->  00:01:12,760
and we'll type Jose:jose,
27

27

00:01:12,760  -->  00:01:16,140
and then var/www/html/pricing-service.
28

28

00:01:16,140  -->  00:01:18,330
What this does, is it gives the permission
29

29

00:01:18,330  -->  00:01:22,880
to this directory, to our user, and our group.
30

30

00:01:22,880  -->  00:01:25,200
And notice that I said earlier on that you shouldn't
31

31

00:01:25,200  -->  00:01:26,710
worry too much about groups.
32

32

00:01:26,710  -->  00:01:29,660
They are just for shared ownership.
33

33

00:01:29,660  -->  00:01:32,550
So, you can have multiple users in the same group,
34

34

00:01:32,550  -->  00:01:34,930
and if the group has permissions to a directory,
35

35

00:01:34,930  -->  00:01:37,870
all the users within that group will have permissions too.
36

36

00:01:37,870  -->  00:01:40,660
So, now we can stop being sudo, we can stop being
37

37

00:01:40,660  -->  00:01:42,913
the root user, and we can be ourselves.
38

38

00:01:43,950  -->  00:01:47,510
Saying that, let's go over to that directory,
39

39

00:01:47,510  -->  00:01:50,350
and we're going to download the code from get hub.
40

40

00:01:50,350  -->  00:01:53,180
All we have to do is type git clone,
41

41

00:01:53,180  -->  00:01:57,020
and then the web address of our repository.
42

42

00:01:57,020  -->  00:01:59,020
So if you go over to your git repository,
43

43

00:01:59,020  -->  00:02:01,180
and in this case I'm using this test one,
44

44

00:02:01,180  -->  00:02:03,993
you can just copy the web address,
45

45

00:02:05,260  -->  00:02:07,550
and then go back to your terminal and paste it in.
46

46

00:02:07,550  -->  00:02:10,610
And then type space full start.
47

47

00:02:10,610  -->  00:02:14,460
And that's important because what that does is by default
48

48

00:02:14,460  -->  00:02:17,230
git clone is gonna create a folder called
49

49

00:02:17,230  -->  00:02:19,340
price of chair deployment,
50

50

00:02:19,340  -->  00:02:22,700
and it's gonna put everything inside that folder.
51

51

00:02:22,700  -->  00:02:23,990
So then we would end up with
52

52

00:02:23,990  -->  00:02:28,880
var/www/html/pricing-service price of chair deployment,
53

53

00:02:28,880  -->  00:02:30,600
and all our code would be in there.
54

54

00:02:30,600  -->  00:02:31,800
But we want to avoid that,
55

55

00:02:31,800  -->  00:02:34,410
and instead put all the code inside
56

56

00:02:34,410  -->  00:02:36,150
this pricing service folder.
57

57

00:02:36,150  -->  00:02:39,430
And that's what this space full stop does.
58

58

00:02:39,430  -->  00:02:43,470
It tell git clone to put all of the code inside the
59

59

00:02:43,470  -->  00:02:45,130
full stop folder.
60

60

00:02:45,130  -->  00:02:48,490
And in Unix, the full stop folder is the current folder
61

61

00:02:48,490  -->  00:02:49,323
that you're in,
62

62

00:02:49,323  -->  00:02:52,890
so that's gonna clone into the full stop folder,
63

63

00:02:52,890  -->  00:02:54,560
which is our current folder.
64

64

00:02:54,560  -->  00:02:58,080
Then if we do ls, you'll see that everything here
65

65

00:02:58,080  -->  00:03:01,400
is not, what was in the repository.
66

66

00:03:01,400  -->  00:03:04,100
We also need to create a log folder
67

67

00:03:04,100  -->  00:03:05,780
for our application logs.
68

68

00:03:05,780  -->  00:03:07,560
Everything that our application output is gonna be
69

69

00:03:07,560  -->  00:03:10,420
logged into a file so that we can look at it later on,
70

70

00:03:10,420  -->  00:03:13,210
if we have any problems, so we have to create a folder
71

71

00:03:13,210  -->  00:03:15,480
so we can put those things in there.
72

72

00:03:15,480  -->  00:03:16,750
And, that's pretty much it,
73

73

00:03:16,750  -->  00:03:20,140
The next thing is only to instal everything
74

74

00:03:20,140  -->  00:03:22,060
from the requirements.
75

75

00:03:22,060  -->  00:03:23,900
Do make sure that when you're doing pipenv instal,
76

76

00:03:23,900  -->  00:03:26,130
you use Python 3.7.
77

77

00:03:26,130  -->  00:03:28,590
If you wanted to create a virtual environment
78

78

00:03:28,590  -->  00:03:30,630
using Python 3.7 specifically,
79

79

00:03:30,630  -->  00:03:35,630
you could do pipenv instal --python=python3.7,
80

80

00:03:35,720  -->  00:03:39,163
assuming that you have Python 3.7 installed in this system.
81

81

00:03:40,130  -->  00:03:42,170
Finally, now that everything is installed,
82

82

00:03:42,170  -->  00:03:46,490
we can do pipenv run python appl.py
83

83

00:03:46,490  -->  00:03:48,110
make sure that it runs and, you know,
84

84

00:03:48,110  -->  00:03:51,000
you'd get the usual flask output,
85

85

00:03:51,000  -->  00:03:53,320
and if you do, that means that everything's good to go,
86

86

00:03:53,320  -->  00:03:56,300
you can continue with the next video.
87

87

00:03:56,300  -->  00:03:57,700
Thanks for joining me in this one,
88

88

00:03:57,700  -->  00:03:59,150
I'll see you in the next one.
