This blog article is based on the documentation and example repository written by Porter's community member, jimcru21.
Kubernetes is a powerful container orchestrator that automates deployments, management, and scaling of containerized applications. Despite all these benefits of Kubernetes, however, there is typically a ton of overhead to it that is often not justified for simple applications. In this tutorial, we go over how to deploy Django applications on major cloud providers' Kubernetes offerings (e.g. EKS, GKE, DOKS) in a few clicks using Porter, without even having to containerize your applications.
What is Porter?
Porter is open source. Check out the source code here.
Provisioning the Kubernetes Cluster
Before you can start deploying a Django application on Kubernetes, you must first provision a Kubernetes cluster. With Porter, it's possible to create a cluster on AWS, GCP, and Digital Ocean with a single click. Follow this guide to provision the cluster in the cloud provider of your choice.
Alternatively, you can also provision a cluster on your own and connect Porter to an existing cluster. These are the guides on how to create your own cluster for each cloud provider:
After you've created a Kubernetes cluster, you can connect to it via the Porter CLI per this guide.
Prepare Django Application
While it is not necessary to containerize your Django application to deploy it through Porter, you must follow these steps for a successful deployment.
5. Add Gunicorn
6. Add static folder and add your HTML and CSS files. Locate static URL settings and add static file dirs below:
8. Lastly, generate a requirements file.
Sample repository for the above configuration: https://github.com/jimcru21/porter-sample-django-non-docker
Deploy Django on Porter
1. Visit the Porter Dashboard. Click Web Service > Launch Template.
2. Name your application.
3. When prompted for the deployment method, click Git Repository. Connect your GitHub account and select the repo you'd like to deploy from.
8. Click Deploy then wait for buildpack to finish and push to porter. Porter writes a GitHub Actions file to your repository for Continuous Integration. You can check the build progress on your GitHub repository under the Action tab.
Done!
Kubernetes can be a mountain to climb for newcomers, but developers are drawn to its benefits despite the steep learning curve. Porter is a platform that makes Kubernetes easy to the extent that the user doesn't have to learn anything about Kubernetes, or even Docker, to start deploying.
If you have any questions about this tutorial, join our discord community and ask away!