SlideShare une entreprise Scribd logo
1  sur  41
Télécharger pour lire hors ligne
Tamer M Abdul-Radi @tabdulradi
Eslam ElHusseiny @EslamElHusseiny
https://github.com/kiosk12
Agenda
• Pain - What/Why Docker
• Developing and deploying a Django App
• How Docker works
–Every developer
“But it works on my machine.”
Django ? ? ? ? ?
PostgreSQL ? ? ? ? ?
Redis ? ? ? ? ?
Hadoop ? ? ? ? ?
Message Queue ? ? ? ? ?
Developer
Laptop
QA
Laptop
Staging
Server
Production
Server
Cloud
Matrix from Hell
(Pain) = n * m
• Every developer wastes almost a day to configure
his machine
• What about tester’s machine?
• Hot patches during release nights!
n = size of team + staging + production
m = size of project
Matrix from Hell!
Django ? ? ? ?
PostgreSQL ? ? ? ? ?
Redis ? ? ? ? ?
Big Data ? ? ? ? ?
Message Queue ? ? ? ? ?
Developer
Laptop
QA
Laptop
Staging
Server
Prod. on
Server
Prod. on
Cloud
Code time!
Let’s get our hands dirty
Installation
$ sudo apt-get install docker.io
$ sudo pip install -U fig
For OSX and Windows: check “boot2docker”
Create Dockerfile
FROM python:2.7
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
ADD requirements.txt /code/
RUN pip install -r requirements.txt
ADD . /code/
Create requirements.txt
django
psycopg2
Create fig.yml
db:
image: postgres
web:
build: .
command: python manage.py runserverv 0.0.0.0:8000
volumes:
- ./code
ports:
- “8000:8000”
links:
- db
Start Django project
$ fig run web django-admin.py startproject example .
$ ls
Dockerfile example fig.yml manage.py
requirements.txt
$ ls example
__init__.py settings.py urls.py wsgi.py
Configure Django App
DATABASES = {
‘default’: {
‘ENGINE’: ‘django.db.backends.postgresql_psycopg2’,
‘NAME’: ‘postgres’,
‘USER’: ‘postgres’,
‘HOST’: ‘db’,
‘PORT’: 5432
}
}
Run the app
$ fig up
In your browser
Access containers
$ fig run web ping db
$ fig run web cat /etc/hosts
Polls App
• Lets’s steal the polls app from official django tutorial
• https://docs.djangoproject.com/en/1.7/intro/tutorial01/
• Don’t forget to add polls to installed apps
$ fig run web python manage.py startapp polls
polls/models.py
from django.db import models
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
class Choice(models.Model):
question = models.ForeignKey(Question)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
polls/admin.py
from django.contrib import admin
from polls.models import Question
admin.site.register(Question)
Polls App
$ fig run web python manage.py makemigrations polls
$ fig run web python manage.py sqlmigrate polls 0001
$ fig run web python manage.py sqlmigrate polls 0001
Running the app
#!/bin/sh
python manage.py migrate
python manage.py runserver 0.0.0.0:8000
• Running the app became a bit more complex
• We need to make sure that models are migrated
• create run_web.sh
Update fig.yml
db:
image: postgres
web:
build: .
command: ./run_web.sh
volumes:
- ./code
ports:
- “8000:8000”
links:
- db
Create admin account
$ fig run web python manage.py createsuperuser
In your browser
Deploy time!
Fig for production
db:
image: postgres
web:
build: .
command: ./run_web.sh
volumes:
- ./code
ports:
- “80:8000”
links:
- db
Create Amazon Machine
aws ec2 run-instances
—image-id ami-234ecc54
—security-groups default
—instance-type c4.large
—key-name kiosk12
Configure Amazon Machine
• sudo apt-get install docker.io
• sudo pip install -U fig
Run
• -d = Daemon mode
• -f = Specify fig file
$ fig up -d -f fig-production.yml
Docker Internals
• Images
• Read-only templates
• Clone of the system with installed apps + code
• Containers
• Running instance of an image
• Isolated file system and ports
• Registeres
• Host for Images
• Dockerhub,com
Containers vs VM
Architecture
New Docker Features
Docker Machine
$ docker-machine create -d virtualbox dev
$ docker-machine create -d digitalocean --
digitalocean-access-token=... staging
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL
dev virtualbox Running tcp://192.168.99.108:2376
staging * digitalocean Running tcp://104.236.37.134:2376
Docker Swarm
• Clustering for Dockerized distributed apps
• Selects a docker demon for your containers
(created by Docker machine)
Docker Compose
• Docker bought fig!
• No need to install two tools in future
• Almost same yaml syntax
Fun with Docker
• Explore dockerized apps at dockerhub.com with no
installation hassle!
• docker run mongo
• docker run --rm -v "$PWD" -p 4000:4000 grahamc/jekyll
• docker run -it --rm williamyeh/scala
• Some cool aliases here: http://github.com/tabdulradi/
docker-fish-functions
Tamer M Abdul-Radi
Software Engineer
twitter.com/tabdulradi
github.com/tabdulradi
abdulradi.com
Thanks
Eslam ElHusseiny
Systems Engineer
twitter.com/EslamElHusseiny

github.com/EslamElHusseiny
eslamelhusseiny.wordpress.com
http://github.com/Kiosk12/docker-django-demo

Contenu connexe

Tendances

Device Testing with AWS Device Farm
Device Testing with AWS Device FarmDevice Testing with AWS Device Farm
Device Testing with AWS Device FarmAmazon Web Services
 
Ansible lightning talk at Scale 12
Ansible lightning talk at Scale 12Ansible lightning talk at Scale 12
Ansible lightning talk at Scale 12Justin Garrison
 
Docker, Continuous Integration, and You
Docker, Continuous Integration, and YouDocker, Continuous Integration, and You
Docker, Continuous Integration, and YouAtlassian
 
Chef vs. Puppet in the Cloud: How Telepictures and MoneySuperMarket Do It
Chef vs. Puppet in the Cloud: How Telepictures and MoneySuperMarket Do ItChef vs. Puppet in the Cloud: How Telepictures and MoneySuperMarket Do It
Chef vs. Puppet in the Cloud: How Telepictures and MoneySuperMarket Do ItRightScale
 
Deploying Web Apps with PaaS and Docker Tools
Deploying Web Apps with PaaS and Docker ToolsDeploying Web Apps with PaaS and Docker Tools
Deploying Web Apps with PaaS and Docker ToolsEddie Lau
 
AtlasCamp 2015 Docker continuous integration training
AtlasCamp 2015 Docker continuous integration trainingAtlasCamp 2015 Docker continuous integration training
AtlasCamp 2015 Docker continuous integration trainingSteve Smith
 
Trying Continuous Delivery - pyconjp 2012
Trying Continuous Delivery - pyconjp 2012Trying Continuous Delivery - pyconjp 2012
Trying Continuous Delivery - pyconjp 2012Toru Furukawa
 
AltConf 2017: Full Stack Swift in 30 Minutes
AltConf 2017: Full Stack Swift in 30 MinutesAltConf 2017: Full Stack Swift in 30 Minutes
AltConf 2017: Full Stack Swift in 30 MinutesChris Bailey
 
From Code to the Monkeys: Continuous Delivery at Netflix
From Code to the Monkeys: Continuous Delivery at NetflixFrom Code to the Monkeys: Continuous Delivery at Netflix
From Code to the Monkeys: Continuous Delivery at NetflixDianne Marsh
 
Traceur - Javascript.next - Now! RheinmainJS April 14th
Traceur - Javascript.next - Now! RheinmainJS April 14thTraceur - Javascript.next - Now! RheinmainJS April 14th
Traceur - Javascript.next - Now! RheinmainJS April 14thCarsten Sandtner
 
Ansible Israel Kickoff Meetup
Ansible Israel Kickoff MeetupAnsible Israel Kickoff Meetup
Ansible Israel Kickoff Meetupansibleil
 
SFNode 01-2018 - Aquarium control
SFNode 01-2018 - Aquarium controlSFNode 01-2018 - Aquarium control
SFNode 01-2018 - Aquarium controlBryan Hughes
 
FrenchKit 2017: Server(less) Swift
FrenchKit 2017: Server(less) SwiftFrenchKit 2017: Server(less) Swift
FrenchKit 2017: Server(less) SwiftChris Bailey
 
MBL203 Building a Mobile Application Platform on AWS - AWS re: Invent 2012
MBL203 Building a Mobile Application Platform on AWS - AWS re: Invent 2012MBL203 Building a Mobile Application Platform on AWS - AWS re: Invent 2012
MBL203 Building a Mobile Application Platform on AWS - AWS re: Invent 2012Amazon Web Services
 
AWS CodeDeploy - basic intro
AWS CodeDeploy - basic introAWS CodeDeploy - basic intro
AWS CodeDeploy - basic introAnton Babenko
 
OSCamp 2019 | #3 Ansible: Automated Tests of Ansible code with GitLab, Vagran...
OSCamp 2019 | #3 Ansible: Automated Tests of Ansible code with GitLab, Vagran...OSCamp 2019 | #3 Ansible: Automated Tests of Ansible code with GitLab, Vagran...
OSCamp 2019 | #3 Ansible: Automated Tests of Ansible code with GitLab, Vagran...NETWAYS
 

Tendances (20)

Device Testing with AWS Device Farm
Device Testing with AWS Device FarmDevice Testing with AWS Device Farm
Device Testing with AWS Device Farm
 
Ansible lightning talk at Scale 12
Ansible lightning talk at Scale 12Ansible lightning talk at Scale 12
Ansible lightning talk at Scale 12
 
Ansible ALLTHETHINGS
Ansible ALLTHETHINGSAnsible ALLTHETHINGS
Ansible ALLTHETHINGS
 
Docker, Continuous Integration, and You
Docker, Continuous Integration, and YouDocker, Continuous Integration, and You
Docker, Continuous Integration, and You
 
Chef vs. Puppet in the Cloud: How Telepictures and MoneySuperMarket Do It
Chef vs. Puppet in the Cloud: How Telepictures and MoneySuperMarket Do ItChef vs. Puppet in the Cloud: How Telepictures and MoneySuperMarket Do It
Chef vs. Puppet in the Cloud: How Telepictures and MoneySuperMarket Do It
 
Deploying Web Apps with PaaS and Docker Tools
Deploying Web Apps with PaaS and Docker ToolsDeploying Web Apps with PaaS and Docker Tools
Deploying Web Apps with PaaS and Docker Tools
 
AtlasCamp 2015 Docker continuous integration training
AtlasCamp 2015 Docker continuous integration trainingAtlasCamp 2015 Docker continuous integration training
AtlasCamp 2015 Docker continuous integration training
 
Trying Continuous Delivery - pyconjp 2012
Trying Continuous Delivery - pyconjp 2012Trying Continuous Delivery - pyconjp 2012
Trying Continuous Delivery - pyconjp 2012
 
AltConf 2017: Full Stack Swift in 30 Minutes
AltConf 2017: Full Stack Swift in 30 MinutesAltConf 2017: Full Stack Swift in 30 Minutes
AltConf 2017: Full Stack Swift in 30 Minutes
 
OpenWhisk
OpenWhiskOpenWhisk
OpenWhisk
 
From Code to the Monkeys: Continuous Delivery at Netflix
From Code to the Monkeys: Continuous Delivery at NetflixFrom Code to the Monkeys: Continuous Delivery at Netflix
From Code to the Monkeys: Continuous Delivery at Netflix
 
Traceur - Javascript.next - Now! RheinmainJS April 14th
Traceur - Javascript.next - Now! RheinmainJS April 14thTraceur - Javascript.next - Now! RheinmainJS April 14th
Traceur - Javascript.next - Now! RheinmainJS April 14th
 
Where is my scalable API?
Where is my scalable API?Where is my scalable API?
Where is my scalable API?
 
Ansible Israel Kickoff Meetup
Ansible Israel Kickoff MeetupAnsible Israel Kickoff Meetup
Ansible Israel Kickoff Meetup
 
SFNode 01-2018 - Aquarium control
SFNode 01-2018 - Aquarium controlSFNode 01-2018 - Aquarium control
SFNode 01-2018 - Aquarium control
 
FrenchKit 2017: Server(less) Swift
FrenchKit 2017: Server(less) SwiftFrenchKit 2017: Server(less) Swift
FrenchKit 2017: Server(less) Swift
 
MBL203 Building a Mobile Application Platform on AWS - AWS re: Invent 2012
MBL203 Building a Mobile Application Platform on AWS - AWS re: Invent 2012MBL203 Building a Mobile Application Platform on AWS - AWS re: Invent 2012
MBL203 Building a Mobile Application Platform on AWS - AWS re: Invent 2012
 
AWS CodeDeploy - basic intro
AWS CodeDeploy - basic introAWS CodeDeploy - basic intro
AWS CodeDeploy - basic intro
 
OSCamp 2019 | #3 Ansible: Automated Tests of Ansible code with GitLab, Vagran...
OSCamp 2019 | #3 Ansible: Automated Tests of Ansible code with GitLab, Vagran...OSCamp 2019 | #3 Ansible: Automated Tests of Ansible code with GitLab, Vagran...
OSCamp 2019 | #3 Ansible: Automated Tests of Ansible code with GitLab, Vagran...
 
Continuous deployment
Continuous deploymentContinuous deployment
Continuous deployment
 

En vedette

Running Lean Architectures: How to Optimize for Cost Efficiency
Running Lean Architectures: How to Optimize for Cost Efficiency Running Lean Architectures: How to Optimize for Cost Efficiency
Running Lean Architectures: How to Optimize for Cost Efficiency Amazon Web Services
 
AWS re:Invent 2016 Recap in Hong Kong Keynote
AWS re:Invent 2016 Recap in Hong Kong KeynoteAWS re:Invent 2016 Recap in Hong Kong Keynote
AWS re:Invent 2016 Recap in Hong Kong KeynoteAmazon Web Services
 
Social network websites: best practices from leading services
Social network websites: best practices from leading servicesSocial network websites: best practices from leading services
Social network websites: best practices from leading servicesFabernovel
 
Deep Dive on AWS Cloud Data Migration Services
Deep Dive on AWS Cloud Data Migration ServicesDeep Dive on AWS Cloud Data Migration Services
Deep Dive on AWS Cloud Data Migration ServicesAmazon Web Services
 
Introducing Amazon Pinpoint – Targeted Push Notifications for Mobile Apps
Introducing Amazon Pinpoint – Targeted Push Notifications for Mobile AppsIntroducing Amazon Pinpoint – Targeted Push Notifications for Mobile Apps
Introducing Amazon Pinpoint – Targeted Push Notifications for Mobile AppsAmazon Web Services
 
Visualizing Big Data Insights with Amazon QuickSight
Visualizing Big Data Insights with Amazon QuickSightVisualizing Big Data Insights with Amazon QuickSight
Visualizing Big Data Insights with Amazon QuickSightAmazon Web Services
 
NEW LAUNCH! Amazon EC2 Systems Manager for Hybrid Cloud Management at Scale
NEW LAUNCH! Amazon EC2 Systems Manager for Hybrid Cloud Management at ScaleNEW LAUNCH! Amazon EC2 Systems Manager for Hybrid Cloud Management at Scale
NEW LAUNCH! Amazon EC2 Systems Manager for Hybrid Cloud Management at ScaleAmazon Web Services
 
NEW LAUNCH! Introducing AWS Batch: Easy and efficient batch computing
 	  NEW LAUNCH! Introducing AWS Batch: Easy and efficient batch computing 	  NEW LAUNCH! Introducing AWS Batch: Easy and efficient batch computing
NEW LAUNCH! Introducing AWS Batch: Easy and efficient batch computingAmazon Web Services
 
Creating IoT Solutions with Serverless Architecture & Alexa
Creating IoT Solutions with Serverless Architecture & AlexaCreating IoT Solutions with Serverless Architecture & Alexa
Creating IoT Solutions with Serverless Architecture & AlexaAmazon Web Services
 
NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox
NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and BloxNEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox
NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and BloxAmazon Web Services
 
DNS DDoS mitigation using Amazon Route 53 and AWS Shield
DNS DDoS mitigation using Amazon Route 53 and AWS ShieldDNS DDoS mitigation using Amazon Route 53 and AWS Shield
DNS DDoS mitigation using Amazon Route 53 and AWS ShieldAmazon Web Services
 
Building a Modern Data Architecture on AWS - Webinar
Building a Modern Data Architecture on AWS - WebinarBuilding a Modern Data Architecture on AWS - Webinar
Building a Modern Data Architecture on AWS - WebinarAmazon Web Services
 
NEW LAUNCH! Intro to Amazon Athena. Analyze data in S3, using SQL
NEW LAUNCH! Intro to Amazon Athena. Analyze data in S3, using SQLNEW LAUNCH! Intro to Amazon Athena. Analyze data in S3, using SQL
NEW LAUNCH! Intro to Amazon Athena. Analyze data in S3, using SQLAmazon Web Services
 
Web Security Automation: Spend Less Time Securing your Applications
 	  Web Security Automation: Spend Less Time Securing your Applications 	  Web Security Automation: Spend Less Time Securing your Applications
Web Security Automation: Spend Less Time Securing your ApplicationsAmazon Web Services
 
Elasticsearch 5 in Amazon Elasticsearch Service
Elasticsearch 5 in Amazon Elasticsearch ServiceElasticsearch 5 in Amazon Elasticsearch Service
Elasticsearch 5 in Amazon Elasticsearch ServiceAmazon Web Services
 
Scaling Security Operations and Automating Governance: Which AWS Services Sho...
Scaling Security Operations and Automating Governance: Which AWS Services Sho...Scaling Security Operations and Automating Governance: Which AWS Services Sho...
Scaling Security Operations and Automating Governance: Which AWS Services Sho...Amazon Web Services
 
Deep Dive on AWS Mobile Hub for Enterprise Mobile Applications
Deep Dive on AWS Mobile Hub for Enterprise Mobile Applications Deep Dive on AWS Mobile Hub for Enterprise Mobile Applications
Deep Dive on AWS Mobile Hub for Enterprise Mobile Applications Amazon Web Services
 

En vedette (20)

Python45 2
Python45 2Python45 2
Python45 2
 
Running Lean Architectures: How to Optimize for Cost Efficiency
Running Lean Architectures: How to Optimize for Cost Efficiency Running Lean Architectures: How to Optimize for Cost Efficiency
Running Lean Architectures: How to Optimize for Cost Efficiency
 
AWS re:Invent 2016 Recap in Hong Kong Keynote
AWS re:Invent 2016 Recap in Hong Kong KeynoteAWS re:Invent 2016 Recap in Hong Kong Keynote
AWS re:Invent 2016 Recap in Hong Kong Keynote
 
Social network websites: best practices from leading services
Social network websites: best practices from leading servicesSocial network websites: best practices from leading services
Social network websites: best practices from leading services
 
Deep Dive on AWS Cloud Data Migration Services
Deep Dive on AWS Cloud Data Migration ServicesDeep Dive on AWS Cloud Data Migration Services
Deep Dive on AWS Cloud Data Migration Services
 
VPC and DX PoP @ HKG
VPC and DX PoP @ HKGVPC and DX PoP @ HKG
VPC and DX PoP @ HKG
 
Introducing Amazon Pinpoint – Targeted Push Notifications for Mobile Apps
Introducing Amazon Pinpoint – Targeted Push Notifications for Mobile AppsIntroducing Amazon Pinpoint – Targeted Push Notifications for Mobile Apps
Introducing Amazon Pinpoint – Targeted Push Notifications for Mobile Apps
 
Social Networking Site in JAVA
Social Networking Site in JAVASocial Networking Site in JAVA
Social Networking Site in JAVA
 
Visualizing Big Data Insights with Amazon QuickSight
Visualizing Big Data Insights with Amazon QuickSightVisualizing Big Data Insights with Amazon QuickSight
Visualizing Big Data Insights with Amazon QuickSight
 
NEW LAUNCH! Amazon EC2 Systems Manager for Hybrid Cloud Management at Scale
NEW LAUNCH! Amazon EC2 Systems Manager for Hybrid Cloud Management at ScaleNEW LAUNCH! Amazon EC2 Systems Manager for Hybrid Cloud Management at Scale
NEW LAUNCH! Amazon EC2 Systems Manager for Hybrid Cloud Management at Scale
 
NEW LAUNCH! Introducing AWS Batch: Easy and efficient batch computing
 	  NEW LAUNCH! Introducing AWS Batch: Easy and efficient batch computing 	  NEW LAUNCH! Introducing AWS Batch: Easy and efficient batch computing
NEW LAUNCH! Introducing AWS Batch: Easy and efficient batch computing
 
Creating IoT Solutions with Serverless Architecture & Alexa
Creating IoT Solutions with Serverless Architecture & AlexaCreating IoT Solutions with Serverless Architecture & Alexa
Creating IoT Solutions with Serverless Architecture & Alexa
 
NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox
NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and BloxNEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox
NEW LAUNCH! Advanced Task Scheduling with Amazon ECS and Blox
 
DNS DDoS mitigation using Amazon Route 53 and AWS Shield
DNS DDoS mitigation using Amazon Route 53 and AWS ShieldDNS DDoS mitigation using Amazon Route 53 and AWS Shield
DNS DDoS mitigation using Amazon Route 53 and AWS Shield
 
Building a Modern Data Architecture on AWS - Webinar
Building a Modern Data Architecture on AWS - WebinarBuilding a Modern Data Architecture on AWS - Webinar
Building a Modern Data Architecture on AWS - Webinar
 
NEW LAUNCH! Intro to Amazon Athena. Analyze data in S3, using SQL
NEW LAUNCH! Intro to Amazon Athena. Analyze data in S3, using SQLNEW LAUNCH! Intro to Amazon Athena. Analyze data in S3, using SQL
NEW LAUNCH! Intro to Amazon Athena. Analyze data in S3, using SQL
 
Web Security Automation: Spend Less Time Securing your Applications
 	  Web Security Automation: Spend Less Time Securing your Applications 	  Web Security Automation: Spend Less Time Securing your Applications
Web Security Automation: Spend Less Time Securing your Applications
 
Elasticsearch 5 in Amazon Elasticsearch Service
Elasticsearch 5 in Amazon Elasticsearch ServiceElasticsearch 5 in Amazon Elasticsearch Service
Elasticsearch 5 in Amazon Elasticsearch Service
 
Scaling Security Operations and Automating Governance: Which AWS Services Sho...
Scaling Security Operations and Automating Governance: Which AWS Services Sho...Scaling Security Operations and Automating Governance: Which AWS Services Sho...
Scaling Security Operations and Automating Governance: Which AWS Services Sho...
 
Deep Dive on AWS Mobile Hub for Enterprise Mobile Applications
Deep Dive on AWS Mobile Hub for Enterprise Mobile Applications Deep Dive on AWS Mobile Hub for Enterprise Mobile Applications
Deep Dive on AWS Mobile Hub for Enterprise Mobile Applications
 

Similaire à Future of Development and Deployment using Docker

The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer ToolboxPablo Godel
 
Workshop presentation
Workshop presentationWorkshop presentation
Workshop presentationCloud 66
 
Automating Workflows for Analytics Pipelines
Automating Workflows for Analytics PipelinesAutomating Workflows for Analytics Pipelines
Automating Workflows for Analytics PipelinesSadayuki Furuhashi
 
From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...Jérôme Petazzoni
 
Django dev-env-my-way
Django dev-env-my-wayDjango dev-env-my-way
Django dev-env-my-wayRobert Lujo
 
CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
CI/CD with Jenkins and Docker - DevOps Meetup Day ThailandCI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
CI/CD with Jenkins and Docker - DevOps Meetup Day ThailandTroublemaker Khunpech
 
DevOPS training - Day 2/2
DevOPS training - Day 2/2DevOPS training - Day 2/2
DevOPS training - Day 2/2Vincent Mercier
 
NLUUG Spring 2012 - OpenShift Primer
NLUUG Spring 2012 - OpenShift PrimerNLUUG Spring 2012 - OpenShift Primer
NLUUG Spring 2012 - OpenShift PrimerEric D. Schabell
 
Automate Your Automation | DrupalCon Vienna
Automate Your Automation | DrupalCon ViennaAutomate Your Automation | DrupalCon Vienna
Automate Your Automation | DrupalCon ViennaPantheon
 
DevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux ContainersDevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux Containersinside-BigData.com
 
Tips and Tricks for Automating Windows with Chef
Tips and Tricks for Automating Windows with ChefTips and Tricks for Automating Windows with Chef
Tips and Tricks for Automating Windows with ChefChef Software, Inc.
 
How to create your own hack environment
How to create your own hack environmentHow to create your own hack environment
How to create your own hack environmentSumedt Jitpukdebodin
 
High Productivity Web Development Workflow
High Productivity Web Development WorkflowHigh Productivity Web Development Workflow
High Productivity Web Development WorkflowVũ Nguyễn
 
High productivity web development workflow - JavaScript Meetup Saigon 2014
High productivity web development workflow - JavaScript Meetup Saigon 2014High productivity web development workflow - JavaScript Meetup Saigon 2014
High productivity web development workflow - JavaScript Meetup Saigon 2014Oliver N
 
Serverless and you - where do i run my stateless code
Serverless and you  - where do i run my stateless codeServerless and you  - where do i run my stateless code
Serverless and you - where do i run my stateless codeGabriela Ferrara
 
Integration and Automation @ mobile.de (eBay Tech Talk)
Integration and Automation @ mobile.de (eBay Tech Talk)Integration and Automation @ mobile.de (eBay Tech Talk)
Integration and Automation @ mobile.de (eBay Tech Talk)Karen Almog
 
TIAD - DYI: A simple orchestrator built step by step
TIAD - DYI: A simple orchestrator built step by stepTIAD - DYI: A simple orchestrator built step by step
TIAD - DYI: A simple orchestrator built step by stepThe Incredible Automation Day
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Fabrice Bernhard
 

Similaire à Future of Development and Deployment using Docker (20)

The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
 
Workshop presentation
Workshop presentationWorkshop presentation
Workshop presentation
 
Automating Workflows for Analytics Pipelines
Automating Workflows for Analytics PipelinesAutomating Workflows for Analytics Pipelines
Automating Workflows for Analytics Pipelines
 
From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...
 
Django dev-env-my-way
Django dev-env-my-wayDjango dev-env-my-way
Django dev-env-my-way
 
CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
CI/CD with Jenkins and Docker - DevOps Meetup Day ThailandCI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
 
DevOPS training - Day 2/2
DevOPS training - Day 2/2DevOPS training - Day 2/2
DevOPS training - Day 2/2
 
NLUUG Spring 2012 - OpenShift Primer
NLUUG Spring 2012 - OpenShift PrimerNLUUG Spring 2012 - OpenShift Primer
NLUUG Spring 2012 - OpenShift Primer
 
Automate Your Automation | DrupalCon Vienna
Automate Your Automation | DrupalCon ViennaAutomate Your Automation | DrupalCon Vienna
Automate Your Automation | DrupalCon Vienna
 
DevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux ContainersDevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux Containers
 
Tips and Tricks for Automating Windows with Chef
Tips and Tricks for Automating Windows with ChefTips and Tricks for Automating Windows with Chef
Tips and Tricks for Automating Windows with Chef
 
How to create your own hack environment
How to create your own hack environmentHow to create your own hack environment
How to create your own hack environment
 
Node azure
Node azureNode azure
Node azure
 
High Productivity Web Development Workflow
High Productivity Web Development WorkflowHigh Productivity Web Development Workflow
High Productivity Web Development Workflow
 
High productivity web development workflow - JavaScript Meetup Saigon 2014
High productivity web development workflow - JavaScript Meetup Saigon 2014High productivity web development workflow - JavaScript Meetup Saigon 2014
High productivity web development workflow - JavaScript Meetup Saigon 2014
 
Serverless and you - where do i run my stateless code
Serverless and you  - where do i run my stateless codeServerless and you  - where do i run my stateless code
Serverless and you - where do i run my stateless code
 
Fish Cam.pptx
Fish Cam.pptxFish Cam.pptx
Fish Cam.pptx
 
Integration and Automation @ mobile.de (eBay Tech Talk)
Integration and Automation @ mobile.de (eBay Tech Talk)Integration and Automation @ mobile.de (eBay Tech Talk)
Integration and Automation @ mobile.de (eBay Tech Talk)
 
TIAD - DYI: A simple orchestrator built step by step
TIAD - DYI: A simple orchestrator built step by stepTIAD - DYI: A simple orchestrator built step by step
TIAD - DYI: A simple orchestrator built step by step
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
 

Dernier

UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756dollysharma2066
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdfSuman Jyoti
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfRagavanV2
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01KreezheaRecto
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spaintimesproduction05
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringmulugeta48
 

Dernier (20)

UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spain
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 

Future of Development and Deployment using Docker

  • 1. Tamer M Abdul-Radi @tabdulradi Eslam ElHusseiny @EslamElHusseiny https://github.com/kiosk12
  • 2. Agenda • Pain - What/Why Docker • Developing and deploying a Django App • How Docker works
  • 3. –Every developer “But it works on my machine.”
  • 4. Django ? ? ? ? ? PostgreSQL ? ? ? ? ? Redis ? ? ? ? ? Hadoop ? ? ? ? ? Message Queue ? ? ? ? ? Developer Laptop QA Laptop Staging Server Production Server Cloud Matrix from Hell
  • 5. (Pain) = n * m • Every developer wastes almost a day to configure his machine • What about tester’s machine? • Hot patches during release nights! n = size of team + staging + production m = size of project
  • 6.
  • 7.
  • 8.
  • 9. Matrix from Hell! Django ? ? ? ? PostgreSQL ? ? ? ? ? Redis ? ? ? ? ? Big Data ? ? ? ? ? Message Queue ? ? ? ? ? Developer Laptop QA Laptop Staging Server Prod. on Server Prod. on Cloud
  • 10. Code time! Let’s get our hands dirty
  • 11. Installation $ sudo apt-get install docker.io $ sudo pip install -U fig For OSX and Windows: check “boot2docker”
  • 12. Create Dockerfile FROM python:2.7 ENV PYTHONUNBUFFERED 1 RUN mkdir /code WORKDIR /code ADD requirements.txt /code/ RUN pip install -r requirements.txt ADD . /code/
  • 14. Create fig.yml db: image: postgres web: build: . command: python manage.py runserverv 0.0.0.0:8000 volumes: - ./code ports: - “8000:8000” links: - db
  • 15. Start Django project $ fig run web django-admin.py startproject example . $ ls Dockerfile example fig.yml manage.py requirements.txt $ ls example __init__.py settings.py urls.py wsgi.py
  • 16. Configure Django App DATABASES = { ‘default’: { ‘ENGINE’: ‘django.db.backends.postgresql_psycopg2’, ‘NAME’: ‘postgres’, ‘USER’: ‘postgres’, ‘HOST’: ‘db’, ‘PORT’: 5432 } }
  • 17. Run the app $ fig up
  • 19. Access containers $ fig run web ping db $ fig run web cat /etc/hosts
  • 20. Polls App • Lets’s steal the polls app from official django tutorial • https://docs.djangoproject.com/en/1.7/intro/tutorial01/ • Don’t forget to add polls to installed apps $ fig run web python manage.py startapp polls
  • 21. polls/models.py from django.db import models class Question(models.Model): question_text = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') class Choice(models.Model): question = models.ForeignKey(Question) choice_text = models.CharField(max_length=200) votes = models.IntegerField(default=0)
  • 22. polls/admin.py from django.contrib import admin from polls.models import Question admin.site.register(Question)
  • 23. Polls App $ fig run web python manage.py makemigrations polls $ fig run web python manage.py sqlmigrate polls 0001 $ fig run web python manage.py sqlmigrate polls 0001
  • 24. Running the app #!/bin/sh python manage.py migrate python manage.py runserver 0.0.0.0:8000 • Running the app became a bit more complex • We need to make sure that models are migrated • create run_web.sh
  • 25. Update fig.yml db: image: postgres web: build: . command: ./run_web.sh volumes: - ./code ports: - “8000:8000” links: - db
  • 26. Create admin account $ fig run web python manage.py createsuperuser
  • 29. Fig for production db: image: postgres web: build: . command: ./run_web.sh volumes: - ./code ports: - “80:8000” links: - db
  • 30. Create Amazon Machine aws ec2 run-instances —image-id ami-234ecc54 —security-groups default —instance-type c4.large —key-name kiosk12
  • 31. Configure Amazon Machine • sudo apt-get install docker.io • sudo pip install -U fig
  • 32. Run • -d = Daemon mode • -f = Specify fig file $ fig up -d -f fig-production.yml
  • 33. Docker Internals • Images • Read-only templates • Clone of the system with installed apps + code • Containers • Running instance of an image • Isolated file system and ports • Registeres • Host for Images • Dockerhub,com
  • 37. Docker Machine $ docker-machine create -d virtualbox dev $ docker-machine create -d digitalocean -- digitalocean-access-token=... staging $ docker-machine ls NAME ACTIVE DRIVER STATE URL dev virtualbox Running tcp://192.168.99.108:2376 staging * digitalocean Running tcp://104.236.37.134:2376
  • 38. Docker Swarm • Clustering for Dockerized distributed apps • Selects a docker demon for your containers (created by Docker machine)
  • 39. Docker Compose • Docker bought fig! • No need to install two tools in future • Almost same yaml syntax
  • 40. Fun with Docker • Explore dockerized apps at dockerhub.com with no installation hassle! • docker run mongo • docker run --rm -v "$PWD" -p 4000:4000 grahamc/jekyll • docker run -it --rm williamyeh/scala • Some cool aliases here: http://github.com/tabdulradi/ docker-fish-functions
  • 41. Tamer M Abdul-Radi Software Engineer twitter.com/tabdulradi github.com/tabdulradi abdulradi.com Thanks Eslam ElHusseiny Systems Engineer twitter.com/EslamElHusseiny
 github.com/EslamElHusseiny eslamelhusseiny.wordpress.com http://github.com/Kiosk12/docker-django-demo