Modern Python Projects Transcripts
Chapter: Deployment
Lecture: Deploy Docker image on DigitalOcean

Login or purchase this course to watch this video and the rest of the course contents.
0:00 In order to deploy your Docker image on a production great server,
0:04 you have to rent the server from somewhere, you might use Amazon.
0:08 You might use Linode, Digital ocean and just create a virtual machine install docker and
0:15 do everything manually. But some of those companies provide you with,
0:19 like one click apps. For example.
0:21 Digital Ocean has this droplet that has docker pre installed.
0:27 I think also Linode has something like that.
0:29 But let's go with digital ocean.
0:31 So, when you go to the digital ocean marketplace and you search for Docker,
0:35 you will see this Docker one click app and here we have a create docker droplet
0:40 button.When you click it,
0:43 you will be probably taken to the page where you can log in and then you'll
0:48 be taken to digital Ocean Control panel.
0:55 We can also click, create droplets,
0:58 go to the marketplace tab and search for Docker or just click this guy here
1:03 Then we select the cheapest VM type.
1:08 And, I will select Frankfurt as the location of my droplet.
1:12 Since I'm based in Europe and then here I will select all the ssh keys and
1:25 that's it. I could create droplet.
1:28 And once this is ready, I can ssh to it.
1:34 Once we have the droplet up and running,
1:36 we can copy the ip and ssh there.
1:41 And I cannot. Is it still not ready. Now it is and we get permission denied
1:50 because we should not log in as tutorials,
1:53 User, we should use root.
1:55 So let's try one more time.
2:01 Okay? Now it's working. And as you can see,
2:05 if we run Docker -v,
2:07 we are using Docker. So everything seems to be working fine.
2:11 To deploy our Docker image, we basically have to run the same command as we
2:15 did with play with Docker Playground.
2:17 So Docker run, then expose the port and specify the name of our image.
2:25 Let's actually use port 80 this time.
2:28 So first we specified the port on the host and then we specified the port in
2:32 the container and everything seems to be working fine.
2:45 So, now we should be able to go to the browser.
2:48 Open this IP and we should see our simple form.
2:52 Let's give it a try and perfect.
3:00 Now our uptimeer website is up and running on the digital Ocean server.
3:05 We are still using an IP. But you could connect the domain name here and
3:09 use it us any other website.
3:11 Even though it's up and running,
3:12 there are still two simple improvements that we can apply.
3:17 So first we have to handle the situation.
3:19 When our droplet is rebooted, we want to have docker up and running each time we restart the server.