Deploy Django into Production with Kubernetes, Docker, & Github Actions. Complete Tutorial Series

CodingEntrepreneurs February 9, 2022
Video Thumbnail
CodingEntrepreneurs Logo

CodingEntrepreneurs

@codingentrepreneurs

About

Learn, Build, and Earn. Coding Entrepreneurs is here to help you learn the skills you need to build the projects you want. Learn by doing everything we do step-by-step. Practical and hands-on. Let's do this. 💽 Code: https://github.com/codingforentrepreneurs 🚀 Enroll. Learn to code. Launch your project: https://cfe.sh/enroll 🚀

Video Description

Learn how to deploy a production-ready Django application into a Kubernetes cluster. We partnered with DigitalOcean to bring you this series. Sign up now for a $100 credit: https://do.co/cfe-youtube Kubernetes is a tool to manage containers. This type of management is called orchestration because it does more than just manage the containers such as it will scale up and scale down resources as needed (among many other things). Since Kubernetes is a massive tool, we're going to be covering a practical implementation using a Docker-based Django application. Django is a way to build web applications rapidly using Python. There are many ways to get Django into production so the question is why use K8S at all? There's many reasons we'll cover throughout this series but here are a few: ● Gracefully deploy Docker-based Django projects ● Scale up (or scale down) your web apps with ease ● Use a few or a lot of microservices internally or externally ● Self-heal when services go down ● Simplify app deployment (after initial configuration) ● Streamline your backend Infrastructure (provision virtual machines and let k8s do the rest) Kubernetes can do a lot which makes it a great tool to learn but also a daunting one at that. To make it more approachable here's what we'll be doing: ● Start a Python Virtual Environment ● Create a bare bones production-ready Django project ● Create a Dockerfile to describe our environment (much like this blog post: https://www.cfe.sh/blog/django-on-docker) ● Use a managed Database service from DitgitalOcean ● Install Kubernetes Command Line tool locally (kubectl) ● Start a Kubernetes Cluster on DigitalOcean ● Provision a Deployment and Service for our Django project ● Implement Github Action Workflows to automate future deployments ▶︎ References ● Django on Docker guide: https://cfe.sh/blog/django-on-docker ● Docker & Docker Compose tutorial series: https://cfe.sh/projects/docker-and-docker-compose ● Github Actions guide: https://cfe.sh/blog/django-github-actions ● DigitalOcean $100 credit for new accounts: https://do.co/cfe-youtube ● Project Code: https://github.com/codingforentrepreneurs/Django-Kubernetes ★ Subscribe: https://cfe.sh/youtube ★ ⦿ New to Django? Checkout the Try Django Tutorial Series: https://www.youtube.com/playlist?list=PLEsfXFp6DpzRMby_cSoWTFw8zaMdTEXgL ▶︎ Chapters 00:00:00 Welcome to Django & Kubernetes 00:02:08 Requirements & Recommendations 00:07:12 Install Kubernetes Command Line Tool Kubectl on macOS 00:12:49 Install Kubernetes Command Line Tool Kubectl on Windows 00:19:08 Create the Python Virtual Environment 00:24:28 Install Requirements & Start Django Project 00:33:01 Environment Variables with a dotenv file 00:36:10 Setup django dotenv to read our dotenv file 00:41:54 Update Django settings for Database & Environment Variables 00:47:29 Docker, Dockerfile & dockerignore 01:01:13 Create a migration script 01:09:46 Docker Compose Part 1 01:32:48 Docker Compose Part 2 01:41:43 Provision Kubernetes on DigitalOcean 01:55:20 Connect to Kubernetes with kubectl & kubeconfig 02:03:41 Deploy your First Container on Kubernetes 02:14:00 Expose your Deployment with a Load Balancer 02:26:11 Deploy a Minimal FastAPI App 02:34:24 DigitalOcean Container Registry 02:38:36 Build & Push Docker Container to DO Container Registry 02:45:08 Managed PostgreSQL Database 02:52:44 Kubernetes Secrets from env 02:57:17 Django Deployment & Service 03:11:21 Full Deployment & Fix Errors 03:24:55 Deployment Guide 03:38:57 Github Actions Test Django Automatically 03:55:31 Github Actions Build & Push Docker Container to DigitalOcean 04:11:09 Github Actions Django Deployment on Kubernetes 04:29:01 Django Static Files on DigitalOcean Spaces 04:54:28 New Django App, Models, & Tests 05:10:55 Thank you

You May Also Like

Boost Your Production Setup

AI-recommended products based on this video

Loading...
BOSGAME Linux Mini PC, Intel 12th N100 16GB DDR4 RAM 512GB SSD Linux Server Computers Preinstalled Ubuntu 22.04,Support 4K Triple Display/USB3.2/WiFi 5/2.5GbE

BOSGAME Linux Mini PC, Intel 12th N100 16GB DDR4 RAM 512GB SSD Linux Server Computers Preinstalled Ubuntu 22.04,Support 4K Triple Display/USB3.2/WiFi 5/2.5GbE

(44)
$219.00
PrimeFREE delivery Mon, Jun 16
Loading...
OWC 64GB DDR5 4800 PC5-38400 CL40 2Rx4 288-pin 1.1V ECC Registered RDIMM Memory RAM Module Upgrade Compatible with Dell PowerEdge R660XS R760XS

OWC 64GB DDR5 4800 PC5-38400 CL40 2Rx4 288-pin 1.1V ECC Registered RDIMM Memory RAM Module Upgrade Compatible with Dell PowerEdge R660XS R760XS

(0)
$1,474.98
FREE delivery Aug 14 - 22
Loading...
OWC 64GB DDR5 4800 PC5-38400 CL40 2Rx4 288-pin 1.1V ECC Registered RDIMM Memory RAM Module Upgrade Compatible with Dell PowerEdge XE9680

OWC 64GB DDR5 4800 PC5-38400 CL40 2Rx4 288-pin 1.1V ECC Registered RDIMM Memory RAM Module Upgrade Compatible with Dell PowerEdge XE9680

(0)
$1,474.98
FREE delivery Aug 14 - 22
Loading...
OWC 64GB DDR5 4800 PC5-38400 CL40 2Rx4 288-pin 1.1V ECC Registered RDIMM Memory RAM Module Upgrade Compatible with Dell PowerEdge R6625 R760 R7615 R7625

OWC 64GB DDR5 4800 PC5-38400 CL40 2Rx4 288-pin 1.1V ECC Registered RDIMM Memory RAM Module Upgrade Compatible with Dell PowerEdge R6625 R760 R7615 R7625

(0)
$1,474.98
FREE delivery Aug 14 - 22
Loading...
OWC 64GB DDR5 4800 PC5-38400 CL40 2Rx4 288-pin 1.1V ECC Registered RDIMM Memory RAM Module Upgrade Compatible with Dell PowerEdge HS5610 HS5620

OWC 64GB DDR5 4800 PC5-38400 CL40 2Rx4 288-pin 1.1V ECC Registered RDIMM Memory RAM Module Upgrade Compatible with Dell PowerEdge HS5610 HS5620

(0)
$1,474.98
FREE delivery Aug 14 - 22
Loading...
TP-Link WiFi 6 AX3000 PCIe WiFi Card Archer TX55E - Bluetooth 5.2, 802.11AX Dual Band Wireless Adapter with MU-MIMO, OFDMA, Ultra-Low Latency, Supports Windows 11, 10 (64bit) only
Best Seller

TP-Link WiFi 6 AX3000 PCIe WiFi Card Archer TX55E - Bluetooth 5.2, 802.11AX Dual Band Wireless Adapter with MU-MIMO, OFDMA, Ultra-Low Latency, Supports Windows 11, 10 (64bit) only

(9,902)
$37.99$34.19
FREE delivery Sun, Jun 22
400+ bought in past month
Loading...
Dell UltraSharp U2725QE 27' 4K Thunderbolt-Hub-Monitor mit Bildwiederholfrequenz Von 120Hz

Dell UltraSharp U2725QE 27' 4K Thunderbolt-Hub-Monitor mit Bildwiederholfrequenz Von 120Hz

(50)
$1,059.91
FREE delivery Oct 7 - 8
Loading...
Dell UltraSharp 24 Monitor - U2424H

Dell UltraSharp 24 Monitor - U2424H

(43)
$309.44$262.14
FREE delivery Aug 22 - 25Only 8 left in stock.
Loading...
Dell UltraSharp U2723QE 27" 4K UHD WLED LCD Monitor - 16:9 - Black, Silver EPEAT

Dell UltraSharp U2723QE 27" 4K UHD WLED LCD Monitor - 16:9 - Black, Silver EPEAT

(13)
$699.99$650.99
FREE delivery Tue, Oct 7
50+ bought in past month
Loading...
Logitech G203 Wired Gaming Mouse, 8,000 DPI, Rainbow Optical Effect LIGHTSYNC RGB, 6 Programmable Buttons, On-Board Memory, Screen Mapping, PC/Mac Computer and Laptop Compatible - Black
Best Seller

Logitech G203 Wired Gaming Mouse, 8,000 DPI, Rainbow Optical Effect LIGHTSYNC RGB, 6 Programmable Buttons, On-Board Memory, Screen Mapping, PC/Mac Computer and Laptop Compatible - Black

(17,871)
$27.98$22.38
FREE delivery Tue, Oct 14 on your first order
500+ bought in past month
Loading...
Logitech G305 Lightspeed Wireless Gaming Mouse, Hero 12K Sensor, 12,000 DPI, Lightweight, 6 Programmable Buttons, 250h Battery Life, On-Board Memory, PC/Mac - Black

Logitech G305 Lightspeed Wireless Gaming Mouse, Hero 12K Sensor, 12,000 DPI, Lightweight, 6 Programmable Buttons, 250h Battery Life, On-Board Memory, PC/Mac - Black

(35,879)
$49.99$44.99
FREE delivery Mon, Jan 26
1K+ bought in past month
Loading...
UCANUUP 130W Tip 4.5mm Compatible with Dell XPS 15 7590 9530 9550 9560 9570 9575 Inspiron 7348 Precision M3800 5510 5520 5530 06TTY6 AC Adapter Power Replacement Supply Cord

UCANUUP 130W Tip 4.5mm Compatible with Dell XPS 15 7590 9530 9550 9560 9570 9575 Inspiron 7348 Precision M3800 5510 5520 5530 06TTY6 AC Adapter Power Replacement Supply Cord

(61)
$35.99
FREE delivery Sun, Aug 24