PyCon 24: Pythonic Deployment - Juju and Charms

bittner 21 views 29 slides Jun 16, 2024
Slide 1
Slide 1 of 29
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29

About This Presentation

How do you deploy your Python (Web) application? If your setup is container-based you’re likely using Kubernetes. Is it fun? No. It’s complex. It’s a lot of YAML. Maybe it’s okay-ish - if your setup is not too complex -, but it could be better. Less complex, more lightweight. And then again,...


Slide Content

PYTHONIC
DEPLOYMENT OF
(PYTHON)
APPLICATIONS
Juju magic and Charmed operators.

la pizza
la vita
la famiglia
la sorella
la ragazza
la donna
la settimana
la pioggia
la stella
la rosa
la faccia
la scuola il gatto
il cielo
il cavallo
il giorno
il fratello
il ragazzo
l'uomo
il libro
il tempo
l'anno la mano (sg.)
  le mani (pl.)  ??????
la sdraio (sg.)
  le sdraio (pl.)  ??????il padre
il mese
il mare
il ore

DEVELOPER
OF PEOPLE, COMPANIES AND CODE
@bittner
@peterbittner, [email protected]
PETER BITTNER

Orchestration engine
for software operators
deploy & perform day-2 ops
on any cloud or VM or bare metal
operations code in Python modules
(charms, ops framework)

DEPLOY YOUR APPLICATION
?

DEPLOY YOUR APPLICATION
Scripted setup (create virtual environment, copy
source code to host, use Git, Bash, Ansible, etc.)
??????

DEPLOY YOUR APPLICATION
Scripted setup (create virtual environment, copy
source code to host, use Git, Bash, Ansible, etc.)
Python package (pip install)
??????

DEPLOY YOUR APPLICATION
Scripted setup (create virtual environment, copy
source code to host, use Git, Bash, Ansible, etc.)
Python package (pip install)
System package (create + install DEB, RPM,
Flatpak, snap, Windows .exe, etc.)
??????

DEPLOY YOUR APPLICATION
Scripted setup (create virtual environment, copy
source code to host, use Git, Bash, Ansible, etc.)
Python package (pip install)
System package (create + install DEB, RPM,
Flatpak, snap, Windows .exe, etc.)
Container (copy and install software in container
image, Dockerle, docker compose)
??????

DEPLOY YOUR APPLICATION
Scripted setup (create virtual environment, copy
source code to host, use Git, Bash, Ansible, etc.)
Python package (pip install)
System package (create + install DEB, RPM,
Flatpak, snap, Windows .exe, etc.)
Container (copy and install software in container
image, Dockerle, docker compose)
Kubernetes (use Helm or Kustomize, write YAML
code, kubectl apply, GitOps, etc.)
??????

DEPLOY YOUR APPLICATION
Scripted setup (create virtual environment, copy
source code to host, use Git, Bash, Ansible, etc.)
Python package (pip install)
System package (create + install DEB, RPM,
Flatpak, snap, Windows .exe, etc.)
Container (copy and install software in container
image, Dockerle, docker compose)
Kubernetes (use Helm or Kustomize, write YAML
code, kubectl apply, GitOps, etc.)

Backup / Restore

Application Monitoring
Error tracking

Upgrades

Integrate with
other software

Migrate to new hosting
??????

DIFFERENT PROBLEMS SOLVED
!
??????

DIFFERENT PROBLEMS SOLVED
Scripted setup ... bring up same setup as
locally developed
??????

DIFFERENT PROBLEMS SOLVED
Scripted setup ... bring up same setup as
locally developed
Python package ... install the Python way
??????

DIFFERENT PROBLEMS SOLVED
Scripted setup ... bring up same setup as
locally developed
Python package ... install the Python way
System package ... combine binaries, cong and
data les (deploy following distro conventions)
??????

DIFFERENT PROBLEMS SOLVED
Scripted setup ... bring up same setup as
locally developed
Python package ... install the Python way
System package ... combine binaries, cong and
data les (deploy following distro conventions)
Container ... satisfy dependencies independently
from target environment
??????

DIFFERENT PROBLEMS SOLVED
Scripted setup ... bring up same setup as
locally developed
Python package ... install the Python way
System package ... combine binaries, cong and
data les (deploy following distro conventions)
Container ... satisfy dependencies independently
from target environment
Kubernetes ... declaratively dene how
containers should work together, let automatic
operations do the job
??????

DIFFERENT PROBLEMS SOLVED
Scripted setup ... bring up same setup as
locally developed
Python package ... install the Python way
System package ... combine binaries, cong and
data les (deploy following distro conventions)
Container ... satisfy dependencies independently
from target environment
Kubernetes ... declaratively dene how
containers should work together, let automatic
operations do the job
??????“
Day-2 activities?

DO EVERYTHING, INCL. OPERATIONS
Juju (engine, controller, client)
Charms (Python code)Rocks (OCI images) Snaps (system packages)
optional

juju bootstrap <substrate> <name>
juju add-model <name>
juju deploy <charmname>
juju controllers
juju models
juju status --relations --watch 1s
juju
K8S CHARM VS. MACHINE CHARM
https://juju.is/charms-architecture

JUJU TOOLING & CONCEPTS
Juju (engine, controller, client)
Charms (Python code)Rocks (OCI images) Snaps (system packages)
Cloud
Controller
Model
Charm
Application
Integration
Client
Action
Units
https://juju.is/docs/juju/

JUJU TOOLING & CONCEPTS
Juju (engine, controller, client)
Charms (Python code)Rocks (OCI images) Snaps (system packages)
charmcraft
init
pack
login
upload
...
Pebble
https://juju.is/docs/sdk/
https://charmhub.io/
https://ubuntu.com/kubernetes/charmed-k8s

JUJU TOOLING & CONCEPTS
Juju (engine, controller, client)
Charms (Python code)Rocks (OCI images) Snaps (system packages)
https://canonical-rockcraft.readthedocs-hosted.com/
Alternative way
to build container
images
https://hub.docker.com/u/ubuntu

https://snapcraft.io/
JUJU TOOLING & CONCEPTS
Juju (engine, controller, client)
Charms (Python code)Rocks (OCI images) Snaps (system packages)
https://canonical-snapcraft.readthedocs-hosted.com/
self-contained
applications
no dependency issues
simpler deployment

DEMOS
charmcraft, rockcraft, snapcraft
charm (business & test code)
juju
https://gitlab.com/painless-software/cicd/examples
https://gitlab.com/painless-software/docker
https://discourse.charmhub.io/t/13912
https://discourse.charmhub.io/t/13389

THANK YOU!
FOR YOUR PRECIOUS TIME
PAINLESS SOFTWARE
Less pain, more fun.
Most images generated online (CC-0)
Most logos from Wikipedia (CC-SA)
Decorative icons are unicode (CC-0)