Python for Entrepreneurs Transcripts
Chapter: Deploying to the cloud
Lecture: Introduction to deployment
Login or
purchase this course
to watch this video and the rest of the course contents.
0:01
You've got your application built, and you're ready to go, ready to launch.
0:05
But it needs to be hosted somewhere, we can't just run it off your local laptop; that's where deploying web applications comes in.
0:13
The deployment is a huge topic, the goal for this chapter is not to make you an expert in devops and deployments,
0:19
but instead to have some practical experience getting your application shipped and allowing you
0:25
to ship constantly, as you make improvements to your code. We'll keep this as simple as possible, each video
0:30
is going to focus on one aspect of the deployment and just about everything is going to be hands on,
0:36
at the command line, rather than a whole bunch of theory. Here's what we're going to cover: first off,
0:40
you need a server somewhere that is going to host your application. And we use a cloud service to do that,
0:46
in this case, we're going to use Digital Ocean. I've also used services like Linode in the past,
0:51
and the idea here is we're just going to get a single server, and deploy our application on it, we're not going to use
0:56
an infrastructure as a service provider like Amazon web services or Azure,
0:59
we'll keep it simple, just have a single server that allows us plenty of scale, and is more secure because it's only a single box
1:05
that we're going to lock down against malicious actors. Once your infrastructure expands to multiple machines,
1:11
there's more attack factors, so in this case we'll keep it simple, we'll keep it straightforward so that your application can be as secure as possible,
1:18
without having to learn too much about web server security. Once we provision our server, we'll install an operating system,
1:25
we'll start to configure that operating system for a deployment user and make sure it's locked down and ready for the rest of deployment
1:30
which will have a web server, and in the Python world what's known as a wsgi server, web server gateway interface,
1:37
it is a standard interface between an application like the one that you built,
1:41
and the server which is actually executing the code, that's a wsgi server, it pretty much runs your web application, if you're in the Python ecosystem.
1:49
We will get all that set up, along with the application dependencies, so whatever specific libraries and frameworks that you're using,
1:55
for example Pyramid we'll be able to install those on the server that's running the code, so your application will run
2:01
just like it does on your local machine. Throughout the deployment we're going to use Ansible, a configuration management tool that is built in Python
2:09
to automate every step throughout this process. The first deployment that we do will be automated so that subsequent deployments can be done
2:16
with a single command from the command line. Ansible has some core concepts like playbooks and tasks
2:21
that we'll review and then we're going to write all of our tasks within these Ansible playbooks and you'll be comfortable
2:27
adding extra steps as your business grows and expands,
2:29
and you want to change your application over time. 02:31 Let's dive into getting your application up and running.