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


Talk Python's Mastodon Michael Kennedy's Mastodon