## Deploying your Django project using Dokku
**PyConZA 2022 Remote Talk**
π€ Victor Miti
ποΈ October 13, 2022
---
```console
whoami
```
```yaml
name: Victor Miti
web:
twitter: @engineervix
github: @engineervix
blog: https://importthis.tech/
location:
country: Zambia
town: Lusaka
work:
company: Torchbox
url: https://torchbox.com/
role: Junior Developer
```
---
# Deploying Django projects π
----
## Too many options π
> There are many options for deploying your Django application, based on your architecture or your particular business needs, but that discussion is outside the scope of what Django can give you as guidance.
>
> — [docs.djangoproject.com/en/4.1/howto/deployment](https://docs.djangoproject.com/en/4.1/howto/deployment/)
<!--
- official docs only give a high level overview of things to consider, as well as some production critical settings
- it's up to you to choose what suits you
-->
----
## References π
- [Django Deployment checklist](https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/)
- [A tour of Django server setups](https://mattsegal.dev/django-prod-architectures.html), by Matthew Segal
- [Django Hosting & Deployment Options](https://learndjango.com/tutorials/django-hosting-deployment-options), by Will Vincent
## Which Route? π
- Virtual Private Servers (VPS)
- Platform-as-a-Service (PaaS)
---
## Introducing ... π₯ ... Dokku

----
### What is Dokku? π€
- an open-source (MIT) PaaS that allows you to build and manage the lifecycle of applications from building to scaling
<!-- In simpler terms, itβs software that runs on your server and makes deployment easy by handling the movement of source code, containerization of sites, assignment of domains, builds, SSL certs, and more -->
- It's basically a "mini-[Heroku](https://www.heroku.com/)" that you can self-host on your Linux server
- powered by [Docker](https://www.docker.com/)
<!-- Dokku keeps all of our apps running in Docker containers, so they canβt co-mingle -->
- integrates well with [git](https://git-scm.com/).
----
### Why Dokku β
- Makes it easy to deploy your applications
<!--
- takes away the hassle of configuring servers, services like POstgres, Nginx, SSL certificates, etc
- we can deploy updates multiple times per day
- we can automate them for continuous integration, so that, whatever is pushed to Github will also be automatically deployed to Dokku (as long as it passes all of its checks and tests)
- When you push new code, Dokku builds a new container while leaving the existing one running. Once the new container is ready, Dokku swaps out the old for the new, and destroys the old container, providing zero downtime
-->
- Actively developed, big community, been around since 2013 <!-- 0.1.0 (2013-06-15) -->
- Designed to host multiple sites on the same server right out of the box
- Cost effective
- Lightweight
- Rich plugin ecosystem
- Well documented
- Powerful, intuitive, command-line interface
----
### Building & Buildpacks
- Dokku uses **builders** to customize how an app is built from a source
<!-- this provides users with great flexibility -->
- Dokku normally defaults to using [Heroku buildpacks](https://devcenter.heroku.com/articles/buildpacks) for deployment
<!--
- sets of instructions that outline how to build the environment the app will run in
- several buildpacks available, for python, node.js, PHP, ruby, etc.
-->
- You can also use Docker's native `Dockerfile` system to define a container. See <https://dokku.com/docs/deployment/builders/dockerfiles/>
----
### Some drawbacks / limitations
- limited to single server (can't scale to multiple hosts)
- no web UI (unless you purchase the PRO version)
---
## Talk is cheap, show me the code π₯οΈ
<!--
- project setup
- server setup
-->
---
## Questions / Comments β
---
## ke a leboga π
---
{"title":"Deploying your Django project using Dokku","tags":"presentation","slideOptions":{"theme":"night","progress":true,"help":true,"transition":"convex"}}