WEBVTT

1
00:00:00.000 --> 00:00:03.293
Let me give you a quick visualization
of deployment in Elements.

2
00:00:03.333 --> 00:00:05.593
You're going to start off on your
laptop where you're writing the code

3
00:00:05.633 --> 00:00:08.253
and you're building the todos
application like we just were doing.

4
00:00:08.293 --> 00:00:11.523
And you're going to control
the deployment from your laptop.

5
00:00:11.713 --> 00:00:14.593
To do that, we need
to get a machine running

6
00:00:14.633 --> 00:00:18.173
on a virtual private server,
a machine running somewhere.

7
00:00:18.213 --> 00:00:22.443
And we're going to use DigitalOcean
or DO for that. You can use Amazon,

8
00:00:22.553 --> 00:00:25.833
you can use a bunch of other
providers that are out there.

9
00:00:25.873 --> 00:00:29.303
But DigitalOcean, I find, is a good
way to get started if you're not sure.

10
00:00:29.793 --> 00:00:32.093
DigitalOcean has something
called a droplet.

11
00:00:32.133 --> 00:00:36.963
And a droplet is essentially
just a virtual machine.

12
00:00:37.393 --> 00:00:41.873
And we're going to have one droplet
that gives us an Ubuntu Linux machine.

13
00:00:41.913 --> 00:00:43.703
And that's where we're going
to put our application.

14
00:00:43.893 --> 00:00:46.473
Now, when you're starting off,
if you're just prototyping,

15
00:00:46.513 --> 00:00:50.613
you just have your laptop, and you're
going to have one deployment machine.

16
00:00:50.653 --> 00:00:54.553
And that's all you're going to need,
because Elements automatically

17
00:00:54.593 --> 00:00:59.123
puts a Postgres database cluster
onto the app machine itself.

18
00:00:59.453 --> 00:01:02.523
But if you're running a business,
or it's a real application,

19
00:01:02.593 --> 00:01:06.013
or you're going to add
additional app servers over time,

20
00:01:06.053 --> 00:01:07.593
and we'll talk about why
you might want to do that,

21
00:01:07.633 --> 00:01:10.693
you're going to want to have
a managed database instance.

22
00:01:10.733 --> 00:01:14.513
And DigitalOcean provides that for
us automatically, managed Postgres,

23
00:01:14.553 --> 00:01:17.353
but there are many providers
out there that do it as well.

24
00:01:17.393 --> 00:01:19.893
Now, a typical cost,
this can change over time,

25
00:01:19.933 --> 00:01:24.893
but as of today, to get a droplet
will cost roughly between $6 and $12.

26
00:01:24.933 --> 00:01:28.993
So we'll say $6 for one,
$12 if you have two,

27
00:01:29.033 --> 00:01:34.403
and then the managed database will be
something in the order of $15 per month.

28
00:01:35.093 --> 00:01:38.663
And this gives you a sense of what
a deployment environment will cost.

29
00:01:38.773 --> 00:01:41.313
You can start off with one
app server, like I said,

30
00:01:41.353 --> 00:01:45.473
but if you need redundancy, for example,
if one fails for some reason,

31
00:01:45.513 --> 00:01:48.923
you want another one to pick
up the load, you can add two.

32
00:01:49.033 --> 00:01:54.433
If you have lots of users,
let's say 50,000 or more users, you might

33
00:01:54.473 --> 00:01:59.413
consider having another app server
to distribute the load amongst your users.

34
00:01:59.453 --> 00:02:02.613
So the browser will alternate
between going to this server

35
00:02:02.653 --> 00:02:06.083
and this server so that the load
gets distributed more easily.

36
00:02:06.773 --> 00:02:09.423
Now, load balancing in Elements
is handled automatically.

37
00:02:09.493 --> 00:02:11.073
You don't have to worry about it at all.

38
00:02:11.113 --> 00:02:12.513
You just create new droplets

39
00:02:12.553 --> 00:02:15.533
and tell your agent about it,
and it will configure Elements properly,

40
00:02:15.573 --> 00:02:17.763
and everything that needs
to happen will happen.

41
00:02:18.053 --> 00:02:21.713
Also, if you have a domain name or a URL,
you can also give that to your agent,

42
00:02:21.753 --> 00:02:24.843
and it will automatically
handle SSL certificates

43
00:02:25.253 --> 00:02:30.023
and make sure that all of the application
servers are working together.

44
00:02:30.113 --> 00:02:33.393
So all you need to do is to create
new DigitalOcean droplets

45
00:02:33.433 --> 00:02:37.073
or using whatever service you want,
tell Elements about it through your agent

46
00:02:37.113 --> 00:02:38.723
and everything should
happen automatically.

47
00:02:39.173 --> 00:02:40.133
Okay, with that said,

48
00:02:40.173 --> 00:02:43.863
let's get on with it and create
a DigitalOcean droplet and managed Postgres.

49
00:02:44.253 --> 00:02:46.433
If you haven't created
a DigitalOcean account yet,

50
00:02:46.473 --> 00:02:49.193
go ahead and do that. And once
you're in your homepage area,

51
00:02:49.233 --> 00:02:52.663
click the create button and
start off by creating a droplet.

52
00:02:52.953 --> 00:02:57.253
You can use the default data center that
is selected or change it if you would like.

53
00:02:57.293 --> 00:03:00.423
For an image, choose Ubuntu
and the latest version.

54
00:03:00.953 --> 00:03:03.303
For configuration type,
you can leave the default.

55
00:03:03.413 --> 00:03:07.473
CPU size defaults to 2, but you
can also get away with using 1,

56
00:03:07.513 --> 00:03:11.883
and for memory you can leave 4,
but again you can get away with 2 if you want.

57
00:03:11.953 --> 00:03:16.713
Storage is fine at the default. If you
haven't created an SSH key yet, go ahead

58
00:03:16.753 --> 00:03:20.153
and click the Add SSH Key button
and follow the instructions.

59
00:03:20.193 --> 00:03:22.923
Otherwise, select the SSH
key that you already have.

60
00:03:23.353 --> 00:03:25.033
Now, this is important for networking.

61
00:03:25.073 --> 00:03:28.693
Make sure that the IPv4 public
address is checked, that that is on,

62
00:03:28.733 --> 00:03:32.823
because this is going to be a public
internet-facing application server.

63
00:03:33.233 --> 00:03:36.693
The rest you can leave alone,
and press Create Droplet.

64
00:03:36.733 --> 00:03:38.813
It might take a minute or
two to create the droplet

65
00:03:38.853 --> 00:03:41.793
and another couple of seconds for
these connection details to appear,

66
00:03:41.833 --> 00:03:43.013
but at the end of this process,

67
00:03:43.053 --> 00:03:46.693
you should see a panel with a public
IPv4 address and private IP address,

68
00:03:46.733 --> 00:03:49.953
and you'll need both of these to give
to your agent to set up the deployment.

69
00:03:49.993 --> 00:03:51.533
Before we leave DigitalOcean,

70
00:03:51.573 --> 00:03:56.773
go up to the top Create button
again and go to Managed Database,

71
00:03:56.813 --> 00:04:00.163
and we'll create our Postgres
instance while we're here.

72
00:04:00.333 --> 00:04:02.023
Select the Postgres application.

73
00:04:02.193 --> 00:04:07.663
The latest version is fine.
Standard edition, the Kansas data center,

74
00:04:08.093 --> 00:04:10.273
and all of the defaults should be fine.

75
00:04:10.313 --> 00:04:14.423
It looks like there was a slight
price increase, so $20.30 per month,

76
00:04:14.713 --> 00:04:19.043
and the storage size is fine.
All of the defaults you can leave alone.

77
00:04:19.093 --> 00:04:21.723
And when you're done with that,
create the database cluster.

78
00:04:22.833 --> 00:04:26.233
This process will take a little bit
longer than it takes to create a droplet.

79
00:04:26.273 --> 00:04:29.913
Wait for it to complete, and you should
see connection details in a panel

80
00:04:29.953 --> 00:04:32.883
that we can use to then give
to our agent and set up deployment.

81
00:04:33.953 --> 00:04:36.833
Once that process completes,
you can scroll down a little bit,

82
00:04:36.873 --> 00:04:40.813
and you're going to see a panel here called
Connection Details with a copy button.

83
00:04:40.853 --> 00:04:43.993
Click that copy button. We're going
to paste these back into our agent,

84
00:04:44.033 --> 00:04:48.123
and it will get Elements set up
to use this new database cluster.
