Building Data-Driven Web Apps with Pyramid and SQLAlchemy Transcripts
Chapter: Deployment
Lecture: Creating our Linux server

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Here we are in DigitalOcean.
0:01 Obviously, have an account and am already logged in.
0:05 So what we're going to do is we're going to create
0:06 what's called a droplet, virtual machine.
0:08 There's lots of options.
0:09 We can just pick our various distribution.
0:12 We can actually go and say well
0:14 I could like a discourse server running on
0:17 you know, whatever
0:18 but we're just going to start a Vanilla Linux Ubuntu server.
0:23 If you get the choice to pick something new
0:25 you might as well.
0:26 The .04, the long term releases
0:28 so this is long term, this is long term.
0:31 Might as well pick the newest long term one.
0:32 You'll get the newest version of Python that way.
0:35 We can pick our droplet size.
0:36 Check this out.
0:37 We can get a gig memory terabyte of transfer
0:40 plenty of RAM for $5 a month.
0:43 This server will be able to literally handle millions
0:47 of HTTP data-driven requests, no problem, no problem.
0:53 Think it's going to be more busy than that?
0:54 Go crazy and spend 10 bucks
0:56 but we'll just create this simple, cheap one here.
0:59 You can always change the sizes after you create 'em.
1:01 We don't need available block storage
1:03 but if you want kind of a drive independent
1:06 of your actual server, you can set that up there.
1:08 I'm going to pick just something close to me.
1:10 Normally, I would run it in New York
1:13 somewhere on the east coast.
1:15 Given my customer base, a lot of people from the US
1:18 lot of people from Europe and east coast is pretty much
1:22 as good as it gets, so, anyway.
1:24 I'm in Oregon, so we're going to pick San Francisco.
1:26 That's close as it gets.
1:28 Include monitoring.
1:29 If you don't have an SSH key, go and create it here
1:32 and put it there, but I've got some already.
1:35 I checked 'em all 'cause I couldn't remember
1:36 which one I have on this user profile
1:39 and then it just says give it a name
1:40 so this is going to be the PyPI server.
1:44 How 'about that?
1:46 And then all we do is click create.
1:49 You can see it's creating it.
1:58 Alright, our droplet has been created.
2:00 We have an Ubuntu 18 server running in San Francisco.
2:05 It's IP address is that.
2:06 There's lots of nice little copy these things here.
2:09 So it looks like it's about ready
2:11 for us to go interact with it.
2:12 We're effectively done with DigitalOcean.
2:15 Now, let's do one thing really quick here.
2:21 What we're going to do is I'm going to go
2:22 over here and edit our server
2:28 and we're just going to put as the name.
2:32 So I copied that IP address and I put it here
2:35 and this will let us go over here and like ping that URL.
2:40 As far as our system is concerned
2:42 that thing is alive, and 30 millisecond ping time
2:44 that's pretty solid, especially since
2:46 my network is actually quite busy right now.
2:49 How do we get to it?
2:50 Well, we don't need that for a minute.
2:53 We're going to SSH there
2:54 and this is super easy on Mac and Linux.
2:56 On Windows, you might have to install something like PuTTY.
2:59 Just google SSH server Windows.
3:03 I want to SSH to
3:07 Now, that only works because I put that in the host file.
3:10 If you don't edit that, and also in Windows
3:13 that host file's in a different location.
3:15 The host file is c:\windows\system32\drivers\etc\hosts
3:22 It's been a long since I've edited that
3:24 but I think that's where it is.
3:26 Alright, let's go.
3:28 The very first time you connect
3:30 its going to say we've not see this before.
3:31 You sure you want to go here? Yes.
3:35 Now it's going to log in and say this thing is up and going
3:39 but you know, it's a shade bit out of date
3:41 so the very first thing we've got to do as soon
3:44 as we turn this on is apt update
3:46 to get all the latest possible changes
3:49 and then upgrade it right away. apt upgrade.
3:54 We'll let it do that.
3:56 You don't want to have a server running on the internet
3:58 that potentially has like security holes
4:00 or other issues hanging around
4:02 so let's upgrade it, update it straight away.
4:11 Ooh, that was a lot of updating.
4:12 Took a couple minutes, but I sped up time there.
4:15 That's an awesome power I have, isn't it?
4:16 Okay, so this thing is all updated
4:18 but if you exit and came back, you would see it says
4:21 a reboot is required, a restart is required.
4:23 So let's do that before we do anything further.
4:27 Now, I think that actually upgraded
4:29 from kernel 22 to 25 which means
4:34 that's probably going to take a moment to do
4:36 when we restart here, and normally
4:37 get back in in a few seconds, five, six, 10 seconds.
4:41 Probably, we're not there yet.
4:44 Ooh, speedy. That was very fast.
4:45 Okay, no, not 25. 23.
4:47 But it did upgrade it and it looks
4:49 like there's now zero updates.
4:50 We have a fully patched Linux server.
4:54 Ubuntu 18.04 ready to do our bidding.
4:57 Now we're going to start setting it up to be our server.
5:00 Going to install Nginx.
5:01 We're going to install uWSGI and configure Python
5:04 all the things that we need to do.