1
00:00:00,400 --> 00:00:01,966
- [Instructor] Hi and
welcome back to the course.

2
00:00:01,966 --> 00:00:05,692
In this video, we're going to
quickly get setup with Heroku.

3
00:00:05,692 --> 00:00:09,832
The first thing to do is
to go to signup.heroku.com

4
00:00:09,832 --> 00:00:12,349
and then fill in your details here.

5
00:00:12,349 --> 00:00:13,850
The company name is optional

6
00:00:13,850 --> 00:00:15,991
but the rest are reasonably important.

7
00:00:15,991 --> 00:00:18,041
You'll have to confirm
your email address as well,

8
00:00:18,041 --> 00:00:21,329
so make sure to put
something valid in there.

9
00:00:21,329 --> 00:00:22,275
The primary development language

10
00:00:22,275 --> 00:00:24,582
and the country are not really used

11
00:00:24,582 --> 00:00:27,417
but if you end up paying for Heroku,

12
00:00:27,417 --> 00:00:28,667
country might be interesting

13
00:00:28,667 --> 00:00:32,133
so it can confirm your billing address.

14
00:00:32,133 --> 00:00:34,200
Then create a free account,
and everything's free.

15
00:00:34,200 --> 00:00:36,416
You don't have to pay
or anything like that.

16
00:00:36,416 --> 00:00:39,808
And indeed, you won't
be paying by accident.

17
00:00:39,808 --> 00:00:43,108
If Heroku asks you for
your credit card details,

18
00:00:43,108 --> 00:00:46,074
which it might do, you can put them in,

19
00:00:46,074 --> 00:00:48,838
but Heroku will not charge you

20
00:00:48,838 --> 00:00:50,486
for the things we're gonna
be doing in this course.

21
00:00:50,486 --> 00:00:52,069
Be assured of that.

22
00:00:53,083 --> 00:00:55,992
Once you've signed up and
you've confirmed your email,

23
00:00:55,992 --> 00:00:59,675
you'll have access to
essentially your dashboard.

24
00:00:59,675 --> 00:01:01,462
This is your dashboard here

25
00:01:01,462 --> 00:01:04,600
and you can see your
personal apps in this panel.

26
00:01:04,600 --> 00:01:07,716
As you can see, I've got one
personal app in this account

27
00:01:07,716 --> 00:01:10,939
and that's something
from a different course.

28
00:01:10,939 --> 00:01:14,949
Now, we can go ahead and create a new app

29
00:01:14,949 --> 00:01:16,842
and then we can give it a name.

30
00:01:16,842 --> 00:01:21,009
So for example, we can give
it the name stores-rest-api,

31
00:01:22,025 --> 00:01:23,326
which is available,

32
00:01:23,326 --> 00:01:25,974
and then we can select the runtime.

33
00:01:25,974 --> 00:01:27,791
Now, there are two at this point in time.

34
00:01:27,791 --> 00:01:30,025
There may be more when
you watch this video,

35
00:01:30,025 --> 00:01:31,958
United States or Europe,

36
00:01:31,958 --> 00:01:35,216
and I would recommend
selecting the runtime

37
00:01:35,216 --> 00:01:37,491
where most of your users are based.

38
00:01:37,491 --> 00:01:39,483
So if you have a lot of the users

39
00:01:39,483 --> 00:01:41,583
accessing your API from Europe,

40
00:01:41,583 --> 00:01:43,507
then you'll wanna select Europe.

41
00:01:43,507 --> 00:01:45,925
And if you have the same,
but from United States,

42
00:01:45,925 --> 00:01:47,133
then you're gonna select that.

43
00:01:47,133 --> 00:01:50,567
I'm gonna go for Europe
because I'm in Europe.

44
00:01:50,567 --> 00:01:52,574
And then press the Create App.

45
00:01:52,574 --> 00:01:53,583
And there you have it.

46
00:01:53,583 --> 00:01:55,333
You've created your app

47
00:01:55,333 --> 00:01:58,416
and everything is now ready to begin.

48
00:01:59,966 --> 00:02:00,924
The first thing we'll have to do

49
00:02:00,924 --> 00:02:05,159
is make sure that GitHub
is connected to Heroku.

50
00:02:05,159 --> 00:02:08,232
So the way we do that is
by going to the Deploy tab

51
00:02:08,232 --> 00:02:12,950
and then in the deployment
method, select GitHub.

52
00:02:12,950 --> 00:02:16,182
And here, if you're not
connected to GitHub,

53
00:02:16,182 --> 00:02:18,216
it will ask you to connect,
and you can do that.

54
00:02:18,216 --> 00:02:20,167
It will just ask you to log in with GitHub

55
00:02:20,167 --> 00:02:22,167
and you can just put in
your username and password.

56
00:02:22,167 --> 00:02:23,642
Everything's safe.

57
00:02:23,642 --> 00:02:26,200
And then search for a
repository to connect to.

58
00:02:26,200 --> 00:02:28,642
I'm going to select schoolofcode-me,

59
00:02:28,642 --> 00:02:31,449
which is the place that
I've put my repository,

60
00:02:31,449 --> 00:02:33,617
and then I'm going to select,

61
00:02:33,617 --> 00:02:36,057
I'm gonna type rest there and search

62
00:02:36,057 --> 00:02:38,682
and this is the repository that is found.

63
00:02:38,682 --> 00:02:40,966
Remember, this repository
should be the same

64
00:02:40,966 --> 00:02:44,057
as where we put our REST API data.

65
00:02:44,057 --> 00:02:48,316
So in this case, schoolofcode-me
/ stores-rest-api,

66
00:02:48,316 --> 00:02:51,617
which is the one that has
been found here in Heroku.

67
00:02:51,617 --> 00:02:53,784
Then we can press Connect,

68
00:02:54,641 --> 00:02:56,058
and it connected.

69
00:02:57,099 --> 00:02:59,567
There are a few things now that we can do

70
00:02:59,567 --> 00:03:03,117
which are automatic
deploys and manual deploys.

71
00:03:03,117 --> 00:03:04,700
An automatic deploy

72
00:03:05,592 --> 00:03:08,708
means that whenever we push a commit

73
00:03:08,708 --> 00:03:10,341
to the remote branch,

74
00:03:10,341 --> 00:03:13,158
that will automatically appear in Heroku

75
00:03:13,158 --> 00:03:14,967
after a couple of minutes.

76
00:03:14,967 --> 00:03:16,969
That's great and it's really useful

77
00:03:16,969 --> 00:03:20,969
but if we release a bug
into our Git repository,

78
00:03:21,832 --> 00:03:24,233
that will automatically go into Heroku,

79
00:03:24,233 --> 00:03:26,824
so it's a bit risky as well.

80
00:03:26,824 --> 00:03:29,124
The manual deploy allows us to just deploy

81
00:03:29,124 --> 00:03:32,524
the current branch into Heroku,

82
00:03:32,524 --> 00:03:33,799
so we're gonna do that.

83
00:03:33,799 --> 00:03:35,758
I'm gonna select the master branch here.

84
00:03:35,758 --> 00:03:37,125
This is the only branch that I've got

85
00:03:37,125 --> 00:03:38,542
but maybe you've got more,

86
00:03:38,542 --> 00:03:40,599
and then press Deploy Branch.

87
00:03:40,599 --> 00:03:41,907
And then it's going to start

88
00:03:41,907 --> 00:03:44,900
and this may fail because
we are missing a few things.

89
00:03:44,900 --> 00:03:46,483
Yes, indeed.

90
00:03:46,483 --> 00:03:48,608
And so we're missing a few things

91
00:03:48,608 --> 00:03:50,641
that are required for our app

92
00:03:50,641 --> 00:03:52,666
to be able to run in Heroku

93
00:03:52,666 --> 00:03:56,215
but this is how you
would deploy the branch.

94
00:03:56,215 --> 00:03:58,511
Now, in the next video,
we're going to be adding

95
00:03:58,511 --> 00:04:00,575
all of the things that are missing.

96
00:04:00,575 --> 00:04:02,076
And of course, feel free

97
00:04:02,076 --> 00:04:05,049
to enable automatic deploys if you want

98
00:04:05,049 --> 00:04:06,033
as that does mean

99
00:04:06,033 --> 00:04:09,813
that you don't have to come
into Heroku and deploy it.

100
00:04:09,813 --> 00:04:11,717
It's a bit simpler.

101
00:04:11,717 --> 00:04:12,550
So in the next video,

102
00:04:12,550 --> 00:04:13,965
we're going to be adding
a couple of things.

103
00:04:13,965 --> 00:04:15,467
We have to tell Heroku

104
00:04:15,467 --> 00:04:17,383
what sort of application we're running.

105
00:04:17,383 --> 00:04:21,024
We have to tell it we
are running a uWSGI app

106
00:04:21,024 --> 00:04:24,457
And we also have to tell it
that we're running Python 3.5.

107
00:04:24,457 --> 00:04:26,350
So let's do that in the very next video

108
00:04:26,350 --> 00:04:28,267
and I'll see you there.

