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


Talk Python's Mastodon Michael Kennedy's Mastodon