SlideShare ist ein Scribd-Unternehmen logo
1 von 41
Downloaden Sie, um offline zu lesen
D O C K E R 를 이 용 하 여 P Y T H O N 개 발 환 경 을
빠 르 게 구 성 하 고 , 백 앤 드 서 비 스 를 탐 색 하 는 기
술 , 실 행 환 경
P Y C O N K R - 2 0 1 5
B Y U N G W O O K A H N
1
Who am I
ByungWook Ahn
G+ : https://plus.google.com/+EricAhns
device driver(windows, linux) experienced
media streaming experienced
CDN experienced
docker experienced
Platform Architecture Team, SKPlanet
D O C K E R
C O N TA I N E R
D O C K E R - M A C H I N E
D O C K E R - C O M P O S E
S A M P L E A P P A R C H I T E C T U R E
T E S T E N V I R O N M E N T
P E R F O R M A N C E 

T O D A Y …
h t t p s : / / w w w . d o c k e r . c o m / 	
  
B U I L D , S H I P, R U N
A n o p e n p l a t f o r m f o r
d i s t r i b u t e d a p p l i c a t i o n s f o r
d e v e l o p e r s a n d s y s a d m i n s
D O C K E R
C O N TA I N E R
F R O M u b u n t u
R U N 
a p t - g e t u p d a t e & & 
a p t - g e t i n s t a l l - y p y t h o n p y t h o n - d e v p y t h o n -
p i p p y t h o n - v i r t u a l e n v & & 
r m - r f / v a r / l i b / a p t / l i s t s / *
$ c a t D o c k e r f i l e
$ docker build -t=“mypython” . <- image 생성 ( 현재 디렉토리에 있는
Dockerfile을 참조)
$ docker images <- Docker Host의 image 확인
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
mypython latest ecc926c495f8 7 seconds ago 373.6 MB
ubuntu latest 91e54dfb1179 4 days ago 188.4 MB
mysql latest c45e4ba02f47 12 days ago 283.8 MB
python 2.7 e1857ee1f3b5 5 weeks ago 674.4 MB
nginx latest 6886fb5a9b8d 5 weeks ago 132.9 MB
$ docker run -it mypython python <- container 실행
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
$ docker ps -a <= docker host의 containers print
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b596713d6934 mypython "python" 2 seconds ago Exited (0) 2 seconds ago clever_hypatia
Docker Host example
$ top
docker container : ubuntu 2ea
container : ubuntu(nginx)
D O C K E R - M A C H I N E
VirtualBox
vmware
Microsoft Hyper-V
SOFTLAYER
openstack
Microsoft Azure
AWS
rackspace
DigitalOcean
create & remove
run
➜ 0 2 - S R C d o c k e r- m a c h i n e l s
N A M E A C T I V E D R I V E R S TAT E U R L S WA R M
d e f a u l t v i r t u a l b o x S t o p p e d
d e v v i r t u a l b o x S t o p p e d
p y c o n k r v i r t u a l b o x S t o p p e d
p y c o n k r 0 2 v i r t u a l b o x S t o p p e d
p y c o n k r 0 3 v i r t u a l b o x S t o p p e d
p y c o n k r 0 4 v i r t u a l b o x S t o p p e d
p y c o n k r 0 5 v i r t u a l b o x S t o p p e d
DOCKER-COMPOSE
W E B
D B
$ docker-compose up -d
C O N F I G R AT I O N ?
= > YA M L
$ cat docker-compose.yml
db:
image: mysql
environment:
- MYSQL_ROOT_PASSWORD=hellopython
- MYSQL_DATABASE=shopping_db
ports:
- "3306:3306"
web:
build: ./web_api/
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/web_api
ports:
- "8000:8000"
links:
- db:db
Sample Application
A N G U L A R
J S O N
P Y T H O N
R E S T A P I
P Y T H O N
R E S T A P I
D B
L O A D
B A L A N C E R
L O A D
B A L A N C E R
A N G U L A R
J S O N
A N G U L A R
J S O N
P Y T H O N
R E S T A P I
P Y T H O N
R E S T A P I
D B
L O A D
B A L A N C E R
L O A D
B A L A C E R
A N G U L A R
J S O N
J AVA
R E S T A P I
J AVA
R E S T A P I
G O L A N G
R E S T A P I
G O L A N G
R E S T A P I
R O U T I N G
R E D I S
Restful API…
T E S T E N V I R O N M E N T
1 2
Traffic Gen. Server
Dell R620
2.0 GHz/2P/12C
32G
Docker Host.
HP DL380G7
2.13GHz/1P/4C
24GB
load testing tool?
nGrinder/Apache ab/locust.io
T E S T E N V I R O N M E N T
$ docker inspect web1
[{
"AppArmorProfile": "",
"Args": [
"-g",
"daemon off;"
],
"Config": {
"AttachStderr": false,
"AttachStdin": false,
"AttachStdout": false,
"Cmd": [
"nginx",
"-g",
"daemon off;"
],
"CpuShares": 1024, =>
"Cpuset": "",
"Domainname": “",
…
…
$ docker inspect web2
[{
"AppArmorProfile": "",
"Args": [
"-g",
"daemon off;"
],
"Config": {
"AttachStderr": false,
"AttachStdin": false,
"AttachStdout": false,
"Cmd": [
"nginx",
"-g",
"daemon off;"
],
"CpuShares": 512, =>
"Cpuset": "",
"Domainname": “",
…
…
$ docker inspect web3
[{
"AppArmorProfile": "",
"Args": [
"-g",
"daemon off;"
],
"Config": {
"AttachStderr": false,
"AttachStdin": false,
"AttachStdout": false,
"Cmd": [
"nginx",
"-g",
"daemon off;"
],
"CpuShares": 512, =>
"Cpuset": "",
"Domainname": “",
…
…
C P U :
5 0 %
C P U :
2 5 %
C P U :
2 5 %
T E S T C A S E
web_api_case_01
Django(1.8.3) + djangodb + MySQL 5.6.23
web_api_case_02
Django(1.8.3) + No DB operation
web_api_case_03
Django(1.8.3) + djangodb + PostgreSQL 9.4.4
web_api_case_04
Django(1.8.3) + djangodb + (django-cache-machine) + MySQL 5.6.23
web_api_case_demo
load balancer -> web_api_case_01
http://web_api:8000/shoppling/ APIs를 가진 예로 :
N G R I N D E R / A PA C H E A B / L O C U S T. I O
nGrinder : agent 컨테이너 5개 생성하여 테스트
// controller
$ docker run -d -v ~/.ngrinder:/root/.ngrinder --name ngrinder -p 80:80 -p 16001:16001 -p
12000-12009:12000-12009 ngrinder/controller:3.3
// agent
$ docker run -d -e 'CONTROLLER_ADDR=ngrinder:80' --link ngrinder:ngrinder ngrinder/agent:3.3
nginx : 1.9.2
index.html, 600 bytes
D E M O - C A S E 1 : S A M P L E A P P
settings.py
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'shopping'
)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'shopping_db',
'USER': 'root',
'PASSWORD': 'hellopython',
'HOST': 'db',
'PORT': 3306,
}
}
S A M P L E A P P
models.py


from django.db import models
class Shopping(models.Model):
product_code = models.TextField()
product_title = models.CharField(max_length=100, verbose_name = "Product name")
product_price = models.IntegerField(default='0', verbose_name = "Product price")
class Meta:
verbose_name = "Product list"
verbose_name_plural = "Favorite lists"
S A M P L E A P P
// views.py
def shopping_list(request):
"""
List all code shoppinglists, or create a new shopping.
"""
if request.method == 'GET':
shoppinglists = Shopping.objects.all()
serializer = ShoppingSerializer(shoppinglists, many=True)
return JSONResponse(serializer.data)
// serializers.py
from rest_framework import serializers
from shopping.models import Shopping
class ShoppingSerializer(serializers.ModelSerializer):
class Meta:
model = Shopping
fields = ('product_code', 'product_title', 'product_price')
urls.py
urlpatterns = [
url(r'^shopping/$', views.shopping_list)
]
S A M P L E A P P
db:
image: mysql
environment:
- MYSQL_ROOT_PASSWORD=hellopython
- MYSQL_DATABASE=shopping_db
ports:
- "3306:3306"
web:
build: ./web_api/
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/web_api
ports:
- "8000:8000"
links:
- db:db
demo : case1
P E R F O R M A N C E : C A S E 1
P Y T H O N
R E S T A P I
M Y S Q LL O A D T O O L
D E M O : C A S E 2
views.py
def shopping_list(request):
"""
List all code shoppinglists, or create a new shopping.
"""
if request.method == 'GET':
return JSONResponse({"product_code":"1005","product_title":"BILLIE GOES TO TOWN
SHOPPER","product_price":28})
P E R F O R M A N C E : C A S E 2
P Y T H O N
R E S T A P I
L O A D T O O L
N G I N X - G U N I C O R N
web:
restart: always
build: ./web
expose:
- "8000"
volumes:
- /usr/src/app/static
env_file: .env
command: /usr/local/bin/gunicorn docker_django.wsgi:application -w 12 -b :8000
nginx:
restart: always
build: ./nginx/
ports:
- "80:80"
volumes:
- /www/static
volumes_from:
- web
links:
- web:web
N G I N X - G U N I C O R N
server {
listen 80;
server_name example.org;
charset utf-8;
location /static {
alias /usr/src/app/static;
}
location / {
proxy_pass http://web:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
N G I N X - G U N I C O R N
gunicorn docker_django.wsgi:application -w 2
gunicorn docker_django.wsgi:application -w 12
D E M O : C A S E 3
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'shopping_db',
'USER': 'postgres',
'PASSWORD': 'hellopython',
'HOST': 'db',
'PORT': 5432,
}
}
web:
build: ./web_api/
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/web_api
ports:
- "8000:8000"
links:
- db:db
db:
image: postgres
ports:
- "5432:5432"
environment:
- DB_USER=postgres
- DB_PASS=hellopython
- DB_NAME=shopping_db
D E M O : C A S E 3
P E R F O R M A N C E : C A S E 3
D E M O : C A S E 4
settings.py
CACHE = {
'default':{
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': 'memcached:11211'
}
}
views.py
def shopping_list(request):
"""
List all code shoppinglists, or create a new shopping.
"""
if request.method == 'GET':
data = cache.get('shoppinglists')
if data is None:
shoppinglists = Shopping.objects.all()
serializer = ShoppingSerializer(shoppinglists, many=True)
data = serializer.data
cache.set('shoppinglists', data, 60) # seconds
return JSONResponse(data)
db:
image: mysql
environment:
- MYSQL_ROOT_PASSWORD=hellopython
- MYSQL_DATABASE=shopping_db
ports:
- "3306:3306"
memcached:
image: memcached:1.4
ports:
- "11211:11211"
web:
build: ./web_api/
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/web_api
ports:
- "8000:8000"
links:
- db:db
- memcached:memcached
D E M O : C A S E 4
P E R F O R M A N C E : C A S E 4
P Y T H O N
R E S T A P I
M Y S Q LL O A D T O O L
M E M C A C H E D
D E M O
P Y T H O N
R E S T A P I
M Y S Q L
M E M C A C H E D
W E B PA G E
H A P R O X Y
W E B PA G E
W E B PA G E
H A P R O X Y
P Y T H O N
R E S T A P I
P Y T H O N
R E S T A P I
web:
restart: always
build: ./web_api/
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/web_api
expose:
- "8000"
links:
- db
- memcached
weblb:
restart: always
image: tutum/haproxy
links:
- web
ports:
- "80:80"
environment:
- BACKEND_PORT=8000
db:
image: mysql
environment:
- MYSQL_ROOT_PASSWORD=hellopython
- MYSQL_DATABASE=shopping_db
ports:
- "3306"
memcached:
image: memcached:1.4
ports:
- "11211"
demo-composer.yml
- haproxy
- mysql
- memcached
- python django restframeowork
$ docker-compose build .
$ docker-compose scale web=3
$ docker-compose up -d —no-recreate
P E R F O R M A N C E : D E M O
demo
Thanks : Q&A

Weitere ähnliche Inhalte

Was ist angesagt?

PuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of PuppetPuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of PuppetWalter Heck
 
How Secure Are Docker Containers?
How Secure Are Docker Containers?How Secure Are Docker Containers?
How Secure Are Docker Containers?Ben Hall
 
Node.js basics
Node.js basicsNode.js basics
Node.js basicsBen Lin
 
Node.js API 서버 성능 개선기
Node.js API 서버 성능 개선기Node.js API 서버 성능 개선기
Node.js API 서버 성능 개선기JeongHun Byeon
 
Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013grim_radical
 
Shared Object images in Docker: What you need is what you want.
Shared Object images in Docker: What you need is what you want.Shared Object images in Docker: What you need is what you want.
Shared Object images in Docker: What you need is what you want.Workhorse Computing
 
PuppetCamp SEA 1 - Puppet Deployment at OnApp
PuppetCamp SEA 1 - Puppet Deployment  at OnAppPuppetCamp SEA 1 - Puppet Deployment  at OnApp
PuppetCamp SEA 1 - Puppet Deployment at OnAppWalter Heck
 
"Ops Tools with Perl" 2012/05/12 Hokkaido.pm
"Ops Tools with Perl" 2012/05/12 Hokkaido.pm"Ops Tools with Perl" 2012/05/12 Hokkaido.pm
"Ops Tools with Perl" 2012/05/12 Hokkaido.pmRyosuke IWANAGA
 
2009 cluster user training
2009 cluster user training2009 cluster user training
2009 cluster user trainingChris Dwan
 
Tribal Nova Docker workshop
Tribal Nova Docker workshopTribal Nova Docker workshop
Tribal Nova Docker workshopNicolas Degardin
 
Introduction to Nodejs
Introduction to NodejsIntroduction to Nodejs
Introduction to NodejsGabriele Lana
 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configurationlutter
 
How we use and deploy Varnish at Opera
How we use and deploy Varnish at OperaHow we use and deploy Varnish at Opera
How we use and deploy Varnish at OperaCosimo Streppone
 
Beyond Golden Containers: Complementing Docker with Puppet
Beyond Golden Containers: Complementing Docker with PuppetBeyond Golden Containers: Complementing Docker with Puppet
Beyond Golden Containers: Complementing Docker with Puppetlutter
 
NodeJs
NodeJsNodeJs
NodeJsdizabl
 
Node.js - A practical introduction (v2)
Node.js  - A practical introduction (v2)Node.js  - A practical introduction (v2)
Node.js - A practical introduction (v2)Felix Geisendörfer
 
"Swoole: double troubles in c", Alexandr Vronskiy
"Swoole: double troubles in c", Alexandr Vronskiy"Swoole: double troubles in c", Alexandr Vronskiy
"Swoole: double troubles in c", Alexandr VronskiyFwdays
 

Was ist angesagt? (20)

PuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of PuppetPuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Use of Puppet
 
How Secure Are Docker Containers?
How Secure Are Docker Containers?How Secure Are Docker Containers?
How Secure Are Docker Containers?
 
Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)
 
Node.js basics
Node.js basicsNode.js basics
Node.js basics
 
Node.js API 서버 성능 개선기
Node.js API 서버 성능 개선기Node.js API 서버 성능 개선기
Node.js API 서버 성능 개선기
 
Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013Puppet: Eclipsecon ALM 2013
Puppet: Eclipsecon ALM 2013
 
Shared Object images in Docker: What you need is what you want.
Shared Object images in Docker: What you need is what you want.Shared Object images in Docker: What you need is what you want.
Shared Object images in Docker: What you need is what you want.
 
Docker, c'est bonheur !
Docker, c'est bonheur !Docker, c'est bonheur !
Docker, c'est bonheur !
 
PuppetCamp SEA 1 - Puppet Deployment at OnApp
PuppetCamp SEA 1 - Puppet Deployment  at OnAppPuppetCamp SEA 1 - Puppet Deployment  at OnApp
PuppetCamp SEA 1 - Puppet Deployment at OnApp
 
DevOps with Fabric
DevOps with FabricDevOps with Fabric
DevOps with Fabric
 
"Ops Tools with Perl" 2012/05/12 Hokkaido.pm
"Ops Tools with Perl" 2012/05/12 Hokkaido.pm"Ops Tools with Perl" 2012/05/12 Hokkaido.pm
"Ops Tools with Perl" 2012/05/12 Hokkaido.pm
 
2009 cluster user training
2009 cluster user training2009 cluster user training
2009 cluster user training
 
Tribal Nova Docker workshop
Tribal Nova Docker workshopTribal Nova Docker workshop
Tribal Nova Docker workshop
 
Introduction to Nodejs
Introduction to NodejsIntroduction to Nodejs
Introduction to Nodejs
 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configuration
 
How we use and deploy Varnish at Opera
How we use and deploy Varnish at OperaHow we use and deploy Varnish at Opera
How we use and deploy Varnish at Opera
 
Beyond Golden Containers: Complementing Docker with Puppet
Beyond Golden Containers: Complementing Docker with PuppetBeyond Golden Containers: Complementing Docker with Puppet
Beyond Golden Containers: Complementing Docker with Puppet
 
NodeJs
NodeJsNodeJs
NodeJs
 
Node.js - A practical introduction (v2)
Node.js  - A practical introduction (v2)Node.js  - A practical introduction (v2)
Node.js - A practical introduction (v2)
 
"Swoole: double troubles in c", Alexandr Vronskiy
"Swoole: double troubles in c", Alexandr Vronskiy"Swoole: double troubles in c", Alexandr Vronskiy
"Swoole: double troubles in c", Alexandr Vronskiy
 

Andere mochten auch

Docker (Compose) 활용 - 개발 환경 구성하기
Docker (Compose) 활용 - 개발 환경 구성하기Docker (Compose) 활용 - 개발 환경 구성하기
Docker (Compose) 활용 - 개발 환경 구성하기raccoony
 
Docker로 서버 개발 편하게 하기
Docker로 서버 개발 편하게 하기Docker로 서버 개발 편하게 하기
Docker로 서버 개발 편하게 하기Dronix
 
도커 무작정 따라하기: 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!
도커 무작정 따라하기: 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!도커 무작정 따라하기: 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!
도커 무작정 따라하기: 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!pyrasis
 
The Future of Everything
The Future of EverythingThe Future of Everything
The Future of EverythingMichael Ducy
 
Docker remote-api
Docker remote-apiDocker remote-api
Docker remote-apiEric Ahn
 
Docker 로 Linux 없이 Linux 환경에서 개발하기
Docker 로 Linux 없이 Linux 환경에서 개발하기Docker 로 Linux 없이 Linux 환경에서 개발하기
Docker 로 Linux 없이 Linux 환경에서 개발하기iFunFactory Inc.
 
Py conkr 20150829_docker-python
Py conkr 20150829_docker-pythonPy conkr 20150829_docker-python
Py conkr 20150829_docker-pythonEric Ahn
 
High perforance-browse-networking-2015-bwahn
High perforance-browse-networking-2015-bwahnHigh perforance-browse-networking-2015-bwahn
High perforance-browse-networking-2015-bwahnEric Ahn
 
Http capturing
Http capturingHttp capturing
Http capturingEric Ahn
 
Docker command
Docker commandDocker command
Docker commandEric Ahn
 
Cdn gslb-20151209
Cdn gslb-20151209Cdn gslb-20151209
Cdn gslb-20151209Eric Ahn
 
Docker deploy
Docker deployDocker deploy
Docker deployEric Ahn
 
ProudNet Embedded 제품소개서
ProudNet Embedded 제품소개서ProudNet Embedded 제품소개서
ProudNet Embedded 제품소개서License Nettention
 
Keep it simple web development stack
Keep it simple web development stackKeep it simple web development stack
Keep it simple web development stackEric Ahn
 
Spring rest-doc-2015-11
Spring rest-doc-2015-11Spring rest-doc-2015-11
Spring rest-doc-2015-11Eric Ahn
 
SMARTSTUDY Django 오픈 세션 2012-08
SMARTSTUDY Django 오픈 세션 2012-08SMARTSTUDY Django 오픈 세션 2012-08
SMARTSTUDY Django 오픈 세션 2012-08Hyun-woo Park
 
Do not use Django as like as SMARTSTUDY
Do not use Django as like as SMARTSTUDYDo not use Django as like as SMARTSTUDY
Do not use Django as like as SMARTSTUDYHyun-woo Park
 
Tensorflow in Docker
Tensorflow in DockerTensorflow in Docker
Tensorflow in DockerEric Ahn
 
딥러닝(Deep Learing) using DeepDetect
딥러닝(Deep Learing) using DeepDetect딥러닝(Deep Learing) using DeepDetect
딥러닝(Deep Learing) using DeepDetectJunyi Song
 
도커를 이용한 파이썬 모듈 배포하기
도커를 이용한 파이썬 모듈 배포하기도커를 이용한 파이썬 모듈 배포하기
도커를 이용한 파이썬 모듈 배포하기JunSeok Seo
 

Andere mochten auch (20)

Docker (Compose) 활용 - 개발 환경 구성하기
Docker (Compose) 활용 - 개발 환경 구성하기Docker (Compose) 활용 - 개발 환경 구성하기
Docker (Compose) 활용 - 개발 환경 구성하기
 
Docker로 서버 개발 편하게 하기
Docker로 서버 개발 편하게 하기Docker로 서버 개발 편하게 하기
Docker로 서버 개발 편하게 하기
 
도커 무작정 따라하기: 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!
도커 무작정 따라하기: 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!도커 무작정 따라하기: 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!
도커 무작정 따라하기: 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!
 
The Future of Everything
The Future of EverythingThe Future of Everything
The Future of Everything
 
Docker remote-api
Docker remote-apiDocker remote-api
Docker remote-api
 
Docker 로 Linux 없이 Linux 환경에서 개발하기
Docker 로 Linux 없이 Linux 환경에서 개발하기Docker 로 Linux 없이 Linux 환경에서 개발하기
Docker 로 Linux 없이 Linux 환경에서 개발하기
 
Py conkr 20150829_docker-python
Py conkr 20150829_docker-pythonPy conkr 20150829_docker-python
Py conkr 20150829_docker-python
 
High perforance-browse-networking-2015-bwahn
High perforance-browse-networking-2015-bwahnHigh perforance-browse-networking-2015-bwahn
High perforance-browse-networking-2015-bwahn
 
Http capturing
Http capturingHttp capturing
Http capturing
 
Docker command
Docker commandDocker command
Docker command
 
Cdn gslb-20151209
Cdn gslb-20151209Cdn gslb-20151209
Cdn gslb-20151209
 
Docker deploy
Docker deployDocker deploy
Docker deploy
 
ProudNet Embedded 제품소개서
ProudNet Embedded 제품소개서ProudNet Embedded 제품소개서
ProudNet Embedded 제품소개서
 
Keep it simple web development stack
Keep it simple web development stackKeep it simple web development stack
Keep it simple web development stack
 
Spring rest-doc-2015-11
Spring rest-doc-2015-11Spring rest-doc-2015-11
Spring rest-doc-2015-11
 
SMARTSTUDY Django 오픈 세션 2012-08
SMARTSTUDY Django 오픈 세션 2012-08SMARTSTUDY Django 오픈 세션 2012-08
SMARTSTUDY Django 오픈 세션 2012-08
 
Do not use Django as like as SMARTSTUDY
Do not use Django as like as SMARTSTUDYDo not use Django as like as SMARTSTUDY
Do not use Django as like as SMARTSTUDY
 
Tensorflow in Docker
Tensorflow in DockerTensorflow in Docker
Tensorflow in Docker
 
딥러닝(Deep Learing) using DeepDetect
딥러닝(Deep Learing) using DeepDetect딥러닝(Deep Learing) using DeepDetect
딥러닝(Deep Learing) using DeepDetect
 
도커를 이용한 파이썬 모듈 배포하기
도커를 이용한 파이썬 모듈 배포하기도커를 이용한 파이썬 모듈 배포하기
도커를 이용한 파이썬 모듈 배포하기
 

Ähnlich wie Py conkr 20150829_docker-python

파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Composeraccoony
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesLindsay Holmwood
 
Helping Data Teams with Puppet / Puppet Camp London - Apr 13, 2015
Helping Data Teams with Puppet / Puppet Camp London - Apr 13, 2015Helping Data Teams with Puppet / Puppet Camp London - Apr 13, 2015
Helping Data Teams with Puppet / Puppet Camp London - Apr 13, 2015Sergii Khomenko
 
Puppet Camp London 2015 - Helping Data Teams with Puppet
Puppet Camp London 2015 - Helping Data Teams with PuppetPuppet Camp London 2015 - Helping Data Teams with Puppet
Puppet Camp London 2015 - Helping Data Teams with PuppetPuppet
 
glance replicator
glance replicatorglance replicator
glance replicatoririx_jp
 
Curscatalyst
CurscatalystCurscatalyst
CurscatalystKar Juan
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworksdiego_k
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Ben Hall
 
Logstash for SEO: come monitorare i Log del Web Server in realtime
Logstash for SEO: come monitorare i Log del Web Server in realtimeLogstash for SEO: come monitorare i Log del Web Server in realtime
Logstash for SEO: come monitorare i Log del Web Server in realtimeAndrea Cardinale
 
Django로 만든 웹 애플리케이션 도커라이징하기 + 도커 컴포즈로 개발 환경 구축하기
Django로 만든 웹 애플리케이션 도커라이징하기 + 도커 컴포즈로 개발 환경 구축하기Django로 만든 웹 애플리케이션 도커라이징하기 + 도커 컴포즈로 개발 환경 구축하기
Django로 만든 웹 애플리케이션 도커라이징하기 + 도커 컴포즈로 개발 환경 구축하기raccoony
 
IR Journal (itscholar.codegency.co.in).pdf
IR Journal (itscholar.codegency.co.in).pdfIR Journal (itscholar.codegency.co.in).pdf
IR Journal (itscholar.codegency.co.in).pdfRahulRoy130127
 
REST with Eve and Python
REST with Eve and PythonREST with Eve and Python
REST with Eve and PythonPiXeL16
 
MongoDB Europe 2016 - Debugging MongoDB Performance
MongoDB Europe 2016 - Debugging MongoDB PerformanceMongoDB Europe 2016 - Debugging MongoDB Performance
MongoDB Europe 2016 - Debugging MongoDB PerformanceMongoDB
 
Play With Docker
Play With DockerPlay With Docker
Play With DockerKarim Memon
 
Why and How Powershell will rule the Command Line - Barcamp LA 4
Why and How Powershell will rule the Command Line - Barcamp LA 4Why and How Powershell will rule the Command Line - Barcamp LA 4
Why and How Powershell will rule the Command Line - Barcamp LA 4Ilya Haykinson
 
Using docker for data science - part 2
Using docker for data science - part 2Using docker for data science - part 2
Using docker for data science - part 2Calvin Giles
 
Adding replication protocol support for psycopg2
Adding replication protocol support for psycopg2Adding replication protocol support for psycopg2
Adding replication protocol support for psycopg2Alexander Shulgin
 

Ähnlich wie Py conkr 20150829_docker-python (20)

파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 
Helping Data Teams with Puppet / Puppet Camp London - Apr 13, 2015
Helping Data Teams with Puppet / Puppet Camp London - Apr 13, 2015Helping Data Teams with Puppet / Puppet Camp London - Apr 13, 2015
Helping Data Teams with Puppet / Puppet Camp London - Apr 13, 2015
 
Puppet Camp London 2015 - Helping Data Teams with Puppet
Puppet Camp London 2015 - Helping Data Teams with PuppetPuppet Camp London 2015 - Helping Data Teams with Puppet
Puppet Camp London 2015 - Helping Data Teams with Puppet
 
glance replicator
glance replicatorglance replicator
glance replicator
 
Curscatalyst
CurscatalystCurscatalyst
Curscatalyst
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworks
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)
 
Logstash for SEO: come monitorare i Log del Web Server in realtime
Logstash for SEO: come monitorare i Log del Web Server in realtimeLogstash for SEO: come monitorare i Log del Web Server in realtime
Logstash for SEO: come monitorare i Log del Web Server in realtime
 
Puppet Camp 2012
Puppet Camp 2012Puppet Camp 2012
Puppet Camp 2012
 
Django로 만든 웹 애플리케이션 도커라이징하기 + 도커 컴포즈로 개발 환경 구축하기
Django로 만든 웹 애플리케이션 도커라이징하기 + 도커 컴포즈로 개발 환경 구축하기Django로 만든 웹 애플리케이션 도커라이징하기 + 도커 컴포즈로 개발 환경 구축하기
Django로 만든 웹 애플리케이션 도커라이징하기 + 도커 컴포즈로 개발 환경 구축하기
 
IR Journal (itscholar.codegency.co.in).pdf
IR Journal (itscholar.codegency.co.in).pdfIR Journal (itscholar.codegency.co.in).pdf
IR Journal (itscholar.codegency.co.in).pdf
 
REST with Eve and Python
REST with Eve and PythonREST with Eve and Python
REST with Eve and Python
 
MongoDB Europe 2016 - Debugging MongoDB Performance
MongoDB Europe 2016 - Debugging MongoDB PerformanceMongoDB Europe 2016 - Debugging MongoDB Performance
MongoDB Europe 2016 - Debugging MongoDB Performance
 
Play With Docker
Play With DockerPlay With Docker
Play With Docker
 
dotCloud and go
dotCloud and godotCloud and go
dotCloud and go
 
Why and How Powershell will rule the Command Line - Barcamp LA 4
Why and How Powershell will rule the Command Line - Barcamp LA 4Why and How Powershell will rule the Command Line - Barcamp LA 4
Why and How Powershell will rule the Command Line - Barcamp LA 4
 
Using docker for data science - part 2
Using docker for data science - part 2Using docker for data science - part 2
Using docker for data science - part 2
 
Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
 
Adding replication protocol support for psycopg2
Adding replication protocol support for psycopg2Adding replication protocol support for psycopg2
Adding replication protocol support for psycopg2
 

Kürzlich hochgeladen

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 

Kürzlich hochgeladen (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

Py conkr 20150829_docker-python

  • 1. D O C K E R 를 이 용 하 여 P Y T H O N 개 발 환 경 을 빠 르 게 구 성 하 고 , 백 앤 드 서 비 스 를 탐 색 하 는 기 술 , 실 행 환 경 P Y C O N K R - 2 0 1 5 B Y U N G W O O K A H N 1
  • 2. Who am I ByungWook Ahn G+ : https://plus.google.com/+EricAhns device driver(windows, linux) experienced media streaming experienced CDN experienced docker experienced Platform Architecture Team, SKPlanet
  • 3.
  • 4. D O C K E R C O N TA I N E R D O C K E R - M A C H I N E D O C K E R - C O M P O S E S A M P L E A P P A R C H I T E C T U R E T E S T E N V I R O N M E N T P E R F O R M A N C E 
 T O D A Y …
  • 5. h t t p s : / / w w w . d o c k e r . c o m /   B U I L D , S H I P, R U N A n o p e n p l a t f o r m f o r d i s t r i b u t e d a p p l i c a t i o n s f o r d e v e l o p e r s a n d s y s a d m i n s D O C K E R
  • 6. C O N TA I N E R
  • 7. F R O M u b u n t u R U N a p t - g e t u p d a t e & & a p t - g e t i n s t a l l - y p y t h o n p y t h o n - d e v p y t h o n - p i p p y t h o n - v i r t u a l e n v & & r m - r f / v a r / l i b / a p t / l i s t s / * $ c a t D o c k e r f i l e
  • 8. $ docker build -t=“mypython” . <- image 생성 ( 현재 디렉토리에 있는 Dockerfile을 참조) $ docker images <- Docker Host의 image 확인 REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE mypython latest ecc926c495f8 7 seconds ago 373.6 MB ubuntu latest 91e54dfb1179 4 days ago 188.4 MB mysql latest c45e4ba02f47 12 days ago 283.8 MB python 2.7 e1857ee1f3b5 5 weeks ago 674.4 MB nginx latest 6886fb5a9b8d 5 weeks ago 132.9 MB $ docker run -it mypython python <- container 실행 Python 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> $ docker ps -a <= docker host의 containers print CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES b596713d6934 mypython "python" 2 seconds ago Exited (0) 2 seconds ago clever_hypatia
  • 9. Docker Host example $ top docker container : ubuntu 2ea container : ubuntu(nginx)
  • 10. D O C K E R - M A C H I N E VirtualBox vmware Microsoft Hyper-V SOFTLAYER openstack Microsoft Azure AWS rackspace DigitalOcean create & remove run ➜ 0 2 - S R C d o c k e r- m a c h i n e l s N A M E A C T I V E D R I V E R S TAT E U R L S WA R M d e f a u l t v i r t u a l b o x S t o p p e d d e v v i r t u a l b o x S t o p p e d p y c o n k r v i r t u a l b o x S t o p p e d p y c o n k r 0 2 v i r t u a l b o x S t o p p e d p y c o n k r 0 3 v i r t u a l b o x S t o p p e d p y c o n k r 0 4 v i r t u a l b o x S t o p p e d p y c o n k r 0 5 v i r t u a l b o x S t o p p e d
  • 11. DOCKER-COMPOSE W E B D B $ docker-compose up -d C O N F I G R AT I O N ? = > YA M L $ cat docker-compose.yml db: image: mysql environment: - MYSQL_ROOT_PASSWORD=hellopython - MYSQL_DATABASE=shopping_db ports: - "3306:3306" web: build: ./web_api/ command: python manage.py runserver 0.0.0.0:8000 volumes: - .:/web_api ports: - "8000:8000" links: - db:db
  • 12. Sample Application A N G U L A R J S O N P Y T H O N R E S T A P I P Y T H O N R E S T A P I D B L O A D B A L A N C E R L O A D B A L A N C E R A N G U L A R J S O N
  • 13. A N G U L A R J S O N P Y T H O N R E S T A P I P Y T H O N R E S T A P I D B L O A D B A L A N C E R L O A D B A L A C E R A N G U L A R J S O N J AVA R E S T A P I J AVA R E S T A P I G O L A N G R E S T A P I G O L A N G R E S T A P I R O U T I N G R E D I S Restful API…
  • 14. T E S T E N V I R O N M E N T 1 2 Traffic Gen. Server Dell R620 2.0 GHz/2P/12C 32G Docker Host. HP DL380G7 2.13GHz/1P/4C 24GB load testing tool? nGrinder/Apache ab/locust.io
  • 15. T E S T E N V I R O N M E N T $ docker inspect web1 [{ "AppArmorProfile": "", "Args": [ "-g", "daemon off;" ], "Config": { "AttachStderr": false, "AttachStdin": false, "AttachStdout": false, "Cmd": [ "nginx", "-g", "daemon off;" ], "CpuShares": 1024, => "Cpuset": "", "Domainname": “", … … $ docker inspect web2 [{ "AppArmorProfile": "", "Args": [ "-g", "daemon off;" ], "Config": { "AttachStderr": false, "AttachStdin": false, "AttachStdout": false, "Cmd": [ "nginx", "-g", "daemon off;" ], "CpuShares": 512, => "Cpuset": "", "Domainname": “", … … $ docker inspect web3 [{ "AppArmorProfile": "", "Args": [ "-g", "daemon off;" ], "Config": { "AttachStderr": false, "AttachStdin": false, "AttachStdout": false, "Cmd": [ "nginx", "-g", "daemon off;" ], "CpuShares": 512, => "Cpuset": "", "Domainname": “", … … C P U : 5 0 % C P U : 2 5 % C P U : 2 5 %
  • 16. T E S T C A S E web_api_case_01 Django(1.8.3) + djangodb + MySQL 5.6.23 web_api_case_02 Django(1.8.3) + No DB operation web_api_case_03 Django(1.8.3) + djangodb + PostgreSQL 9.4.4 web_api_case_04 Django(1.8.3) + djangodb + (django-cache-machine) + MySQL 5.6.23 web_api_case_demo load balancer -> web_api_case_01 http://web_api:8000/shoppling/ APIs를 가진 예로 :
  • 17. N G R I N D E R / A PA C H E A B / L O C U S T. I O nGrinder : agent 컨테이너 5개 생성하여 테스트 // controller $ docker run -d -v ~/.ngrinder:/root/.ngrinder --name ngrinder -p 80:80 -p 16001:16001 -p 12000-12009:12000-12009 ngrinder/controller:3.3 // agent $ docker run -d -e 'CONTROLLER_ADDR=ngrinder:80' --link ngrinder:ngrinder ngrinder/agent:3.3
  • 19. D E M O - C A S E 1 : S A M P L E A P P settings.py INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'shopping' ) DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'shopping_db', 'USER': 'root', 'PASSWORD': 'hellopython', 'HOST': 'db', 'PORT': 3306, } }
  • 20. S A M P L E A P P models.py 
 from django.db import models class Shopping(models.Model): product_code = models.TextField() product_title = models.CharField(max_length=100, verbose_name = "Product name") product_price = models.IntegerField(default='0', verbose_name = "Product price") class Meta: verbose_name = "Product list" verbose_name_plural = "Favorite lists"
  • 21. S A M P L E A P P // views.py def shopping_list(request): """ List all code shoppinglists, or create a new shopping. """ if request.method == 'GET': shoppinglists = Shopping.objects.all() serializer = ShoppingSerializer(shoppinglists, many=True) return JSONResponse(serializer.data) // serializers.py from rest_framework import serializers from shopping.models import Shopping class ShoppingSerializer(serializers.ModelSerializer): class Meta: model = Shopping fields = ('product_code', 'product_title', 'product_price') urls.py urlpatterns = [ url(r'^shopping/$', views.shopping_list) ]
  • 22. S A M P L E A P P db: image: mysql environment: - MYSQL_ROOT_PASSWORD=hellopython - MYSQL_DATABASE=shopping_db ports: - "3306:3306" web: build: ./web_api/ command: python manage.py runserver 0.0.0.0:8000 volumes: - .:/web_api ports: - "8000:8000" links: - db:db
  • 24. P E R F O R M A N C E : C A S E 1 P Y T H O N R E S T A P I M Y S Q LL O A D T O O L
  • 25. D E M O : C A S E 2 views.py def shopping_list(request): """ List all code shoppinglists, or create a new shopping. """ if request.method == 'GET': return JSONResponse({"product_code":"1005","product_title":"BILLIE GOES TO TOWN SHOPPER","product_price":28})
  • 26. P E R F O R M A N C E : C A S E 2 P Y T H O N R E S T A P I L O A D T O O L
  • 27. N G I N X - G U N I C O R N web: restart: always build: ./web expose: - "8000" volumes: - /usr/src/app/static env_file: .env command: /usr/local/bin/gunicorn docker_django.wsgi:application -w 12 -b :8000 nginx: restart: always build: ./nginx/ ports: - "80:80" volumes: - /www/static volumes_from: - web links: - web:web
  • 28. N G I N X - G U N I C O R N server { listen 80; server_name example.org; charset utf-8; location /static { alias /usr/src/app/static; } location / { proxy_pass http://web:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }
  • 29. N G I N X - G U N I C O R N gunicorn docker_django.wsgi:application -w 2
  • 31. D E M O : C A S E 3 DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'shopping_db', 'USER': 'postgres', 'PASSWORD': 'hellopython', 'HOST': 'db', 'PORT': 5432, } }
  • 32. web: build: ./web_api/ command: python manage.py runserver 0.0.0.0:8000 volumes: - .:/web_api ports: - "8000:8000" links: - db:db db: image: postgres ports: - "5432:5432" environment: - DB_USER=postgres - DB_PASS=hellopython - DB_NAME=shopping_db D E M O : C A S E 3
  • 33. P E R F O R M A N C E : C A S E 3
  • 34. D E M O : C A S E 4 settings.py CACHE = { 'default':{ 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', 'LOCATION': 'memcached:11211' } } views.py def shopping_list(request): """ List all code shoppinglists, or create a new shopping. """ if request.method == 'GET': data = cache.get('shoppinglists') if data is None: shoppinglists = Shopping.objects.all() serializer = ShoppingSerializer(shoppinglists, many=True) data = serializer.data cache.set('shoppinglists', data, 60) # seconds return JSONResponse(data)
  • 35. db: image: mysql environment: - MYSQL_ROOT_PASSWORD=hellopython - MYSQL_DATABASE=shopping_db ports: - "3306:3306" memcached: image: memcached:1.4 ports: - "11211:11211" web: build: ./web_api/ command: python manage.py runserver 0.0.0.0:8000 volumes: - .:/web_api ports: - "8000:8000" links: - db:db - memcached:memcached D E M O : C A S E 4
  • 36. P E R F O R M A N C E : C A S E 4 P Y T H O N R E S T A P I M Y S Q LL O A D T O O L M E M C A C H E D
  • 37. D E M O P Y T H O N R E S T A P I M Y S Q L M E M C A C H E D W E B PA G E H A P R O X Y W E B PA G E W E B PA G E H A P R O X Y P Y T H O N R E S T A P I P Y T H O N R E S T A P I
  • 38. web: restart: always build: ./web_api/ command: python manage.py runserver 0.0.0.0:8000 volumes: - .:/web_api expose: - "8000" links: - db - memcached weblb: restart: always image: tutum/haproxy links: - web ports: - "80:80" environment: - BACKEND_PORT=8000 db: image: mysql environment: - MYSQL_ROOT_PASSWORD=hellopython - MYSQL_DATABASE=shopping_db ports: - "3306" memcached: image: memcached:1.4 ports: - "11211" demo-composer.yml - haproxy - mysql - memcached - python django restframeowork $ docker-compose build . $ docker-compose scale web=3 $ docker-compose up -d —no-recreate
  • 39. P E R F O R M A N C E : D E M O
  • 40. demo