Full Web Apps with FastAPI Transcripts
Chapter: Deploying FastAPI on Linux with gunicorn and nginx
Lecture: Create a cloud server

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Here we are inside my Digital Ocean account.
0:02 Now over, under these projects, we've got Talk Python and then we've got this thing called Playground.
0:07 If I had already clicked on Talk Python,
0:09 you'd see we have a whole bunch of servers that are hosting many services and databases
0:14 and all sorts of stuff going on over there.
0:16 But this one is just a nice little empty space where I can work,
0:19 so this should look roughly like what you would have.
0:22 Now, here's the platform as a service,
0:23 this Apps thing, but what we're gonna do is just create a droplet, and
0:27 droplet is, you know, code word for I'm gonna create a virtual machine.
0:30 So you can see you could create a server based on many different versions of the operating systems,
0:36 we could do FreeBSD, Fedora,
0:37 Debian and so on. And then within those you get to pick which version. I
0:41 recommend, if you go with Ubuntu, you
0:42 pick an LTS Long Term Support Version.
0:45 Otherwise, you'll stop getting updates and that won't be fun.
0:47 We could also go for containers. You can go to this place called the marketplace,
0:52 and it will let you, like,
0:53 grab a Word, pre configured WordPress server or whatever.
0:58 But that's not what we're doing,
0:59 we're gonna create a distribution, and then you pick,
1:02 well, what kind of server do you want?
1:04 I'm gonna pick the $5 server for this one.
1:06 Now you might think, well, this is a toy server, it's not really gonna be able to do much.
1:10 But these servers can actually handle a lot.
1:13 And Python does not put much of a load on these servers.
1:17 It depends on what you're doing,
1:18 but this little wimpy server, unless you have got some kind of crazy computation stuff
1:24 going on, if it's a relatively standard web application,
1:28 it should be able to handle multiple millions of requests per month.
1:31 So it's actually a pretty good starting point.
1:34 The next thing we're gonna pick,
1:35 we could add an extra hard drive.
1:36 We don't care about that. You might need that,
1:38 if you had say, like,
1:39 tons of data in a database,
1:40 you'd wanna put that over there.
1:41 Could make sense. We're not gonna do that.
1:43 Now, you want to pick a data center that makes the most sense for the
1:47 consumers of your application. For many of us,
1:50 that probably means either Europe or the East Coast of the United States.
1:55 For us, our servers are in New York City.
1:58 The reason is that's good for all of the United States
2:01 and North America, it's also pretty good for Europe because it's a straight shot across the
2:07 ocean, so that covers many of our users.
2:10 We also have people all over the world,
2:12 you know, places that are far from there,
2:13 like Australia, New Zealand, which is not ideal.
2:16 But we gotta pick one place and just, for us,
2:18 East Coast of the US made a lot of sense.
2:20 However, I'm on the West Coast.
2:22 So just to keep things quick as local,
2:25 well, we're gonna pick this,
2:26 right? So you pick the one here that makes the most sense for you.
2:29 Just be careful, if you're gonna create multiple servers like a web server and a
2:33 database server and you want them to talk to each other,
2:35 it's much, much better if they're in the same same data center.
2:38 We could use VPC, virtual private networking,
2:41 it's on by default, but we're not gonna do anything with it.
2:44 Might as well turn on monitoring,
2:45 this lets us look at the server through some of the management tools here.
2:49 We're gonna use an ssh key which allows us to just log in,
2:53 you can just go ahead and type ssh and go and register the ssh key.
2:56 We won't have any username or password to mess with,
2:59 gonna to turn them all on.
3:02 Here's the project it's gonna go into on Playground.
3:04 You could turn on backups, we're not doing that.
3:07 So watch how quick this is.
3:08 Oh, I should have given it a name.
3:10 Well, be sure to give yours a better name,
3:12 but I'm gonna leave this going in real time so you can see how long it
3:15 takes. So I'm not going to cut anything out here.
3:17 I'll just keep kind of rambling on. It
3:20 should take usually about 30 seconds.
3:22 So virtual machine is there. I think it's probably starting right now.
3:27 Maybe some final startup scripts, for the first time are running and wait for it.
3:31 That's it. I don't know,
3:33 what was that, about 30 seconds?
3:34 We can go back and check,
3:35 but not very long. And so now we have a virtual machine. Over here,
3:38 we just click that to copy the IP address.
3:42 Ultimately, you wanna map
3:43 a domain name over there. But basically we're done with Digital Ocean,
3:47 that's it. That was all of the Digital Ocean that we care about.