Transcript

Building and Deploying containerized Python Apps in the Cloud

Rodolfo CarvalhoSoftware Engineer

Mar 12th, 2016

Rodolfo Carvalho, PyCon SK 20162

Shipping Apps

Background Wiring Components Together

Rinse & RepeatCreating Containers

Rodolfo Carvalho, PyCon SK 20163

Background

Manual Automated

Rodolfo Carvalho, PyCon SK 20164

Techniques & Practices

● Sprints● Automated Tests● TDD

● Continuous Integration● Continuous Deployment

Rodolfo Carvalho, PyCon SK 20165

Tools

● Ansible● Yum / DNF● IaaS

● Pip● PaaS● Docker

Rodolfo Carvalho, PyCon SK 20166

Docker

● “Docker allows you to package an application with all of its dependencies into a standardized unit”

● “Docker containers wrap up a piece of software in a complete filesystem that contains everything it needs to run: code, runtime, system tools, system libraries – anything you can install on a server. This guarantees that it will always run the same, regardless of the environment it is running in.”

Creating Containers

Rodolfo Carvalho, PyCon SK 20168

Containers & Images

Rodolfo Carvalho, PyCon SK 20169

Minimal Web App and Dockerfile

Rodolfo Carvalho, PyCon SK 201610

docker build -t hello .docker build -t hello .

Rodolfo Carvalho, PyCon SK 201611

Image Considerations 1/2

● Base Image● Proper usage of layers● Default user & permissions● Other defaults:

● Exposed ports● Work directory● Entrypoint / Cmd

Rodolfo Carvalho, PyCon SK 201612

Image Considerations 2/2

● Install dependencies● System● Language

● Reuse

Rodolfo Carvalho, PyCon SK 201613

Source-To-Imagegithub.com/openshift/source-to-image

Rodolfo Carvalho, PyCon SK 201614

s2i build . centos/python-34-centos7 hello-s2is2i build . centos/python-34-centos7 hello-s2i

Rodolfo Carvalho, PyCon SK 201615

OpenShift Builds

Wiring Components Together

Rodolfo Carvalho, PyCon SK 201617

More Apps

Rodolfo Carvalho, PyCon SK 201618

oc new-appoc new-app

Rodolfo Carvalho, PyCon SK 201619

OpenShift Templates

Rinse & Repeat

THANK YOU

plus.google.com/+RedHat

youtube.com/user/RedHatVideos

facebook.com/redhatinc

twitter.com/RedHatNewslinkedin.com/company/red-hat

Coding Dojo

Hands on Coding with Python

Tomorrow 9:00 – 12:00


Recommended