Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
ImmutableInfrastructure
DaekwonKim
propellerheaven@gmail.com
nacyot
@nacyot
Rubyprogrammer
http://nacyot.com
WebDevelopment
RubyonRails
ProgrammingLanguages
Visualization
Translation
Deployment
Deployment
ImmutableInfrastructure
Leevi
http://leevi.co.kr/
Remotty
http://blog.remotty.com
지난이야기
WebDevelopment
ServerManagement
AmazonWebService
오늘이야기
ImmutableInfrastructure
DisposableComponents
Orchestration
BlueGreenDeployment
ContinuousDelivery
새로운툴
Chef/Puppet/Ansible
Docker
Vagrant
Packer
Serf
ServerSpec
AmazonWebService
TOC
Cloud
AutoScaling
Image
Deploy
ImmutableInfrastructure
DisposableComponents
ConfigurationManagement
Docker
HashiCorp
Cloud
SaaS
PasS
IaaS
Cloud
SoftwareasaService
GoogleApps
AdobeCreativeCloud
PlatformasaService
Heroku
GoogleAppEngine
InfrastructureasaService
...
PlatformasaService
컴퓨터vs클라우드
컴퓨터(서버)
물리적실체
공간적제약
장소적제약
예산적제약
유지보수
클라우드위의컴퓨터
비물리적실체
공간적제약?
장소적제약?
예산적제약?
유지보수?
Delegate,Delegate,Delegate
공간적제약
언제든원하는만큼사용할수있음
물리적서버를설치할필요없음
장소적제약
원하는리젼(장소)에서서비스가능
AWSEC2,DigitalOcean
원하는위치에서배포가능
CDN,AWSCloudFront
예산적제약
매몰비용이거의발생하지않음
서버를구입할필요없음
월단위대여할필요없음
사용한만큼만내면됨
시간단위과금
유지보수
필요없음
DisposableComponents?
AmazonWebService는인터넷의발전소다.
타마카와켄
디지털오션예제
서버실행하기
$tugboatcreateContainerShip-s66-i2158507-r6-k301023
$tugboatdroplets
ContainerShip(ip:128.199.253.99,status:new,reg...
서버종료하기
$tugboatdestroyContainerShip
Dropletfuzzynameprovided.FindingdropletID...done,1383635(ContainerShip)
Warning!Potent...
Billing
10원
Cloud!=ServerHosting
RRRSpec
분산테스트프레임워크
RRRSpec
테스트17000개
1대로몇시간걸림
RRRSpec
1대*몇시간
==
EC2스팟인스턴스60대*8~9분
DeploymentonCloud
AutoScaling
부하가커지면
자동적으로인스턴스가실행되고(ScaleOut)
부하가작아지면
자동적으로인스턴스가종료됨
AutoScaling의장점
유연한대응
합리적비용
AutoScaling의조건
어플리케이션설계
정교한비지니스로직분리
서버환경설정분리및자동화
데이터스토어분리
WheninRome,doastheRomansdo
클라우드위에선클라우드에어울리는설계가필요
BestPractice
CDP클라우드설계원칙
TheTwelve-FactorApp
CDP클라우드설계원칙
가능한한서비스를이용
생각보다행동으로
작은규모로시작하여스케일아웃
변화를전계층에서처리
고장을위한설계
처음뿐이아닌주기적인개선
AutoScaling을전제로한컴퓨터란
어플리케이션이가동되기위한환경이구성된
인스턴스로부터Stamp패턴으로생성된
AMI이미지로부터생성된
가상인스턴스(컴퓨터)
AutoScaling을전제로한컴퓨터란
어플리케이션이가동되기위한환경이구성된
인스턴스로부터Stamp패턴으로생성된
AMI이미지로부터생성된
DisposableComponents
DisposableCopmonent
쓰고
버리는
DisposableCopmonent
미리설정된
쓰고
버리는
인스턴스(컴퓨터)
DisposableCopmonent
서버설정?
서버관리?
Image
Image
새로운문제
Image
이미지는정말로작동가능한가?
Image
아마도…
최초의이미지는어디서오는가?
서버설정
useradd…
setenv
apt-getupdate
apt-getinstall…(순서!!)
ufw…
iptable…
…
최초의이미지는어디서오는가?
어플리케이션설치
rubybuild
apt-get…
geminstallbundler
gitclone…
bundleinastll
configuration
runapplicationserver
se...
어플리케이션이업데이트되면?
어플리케이션업데이트
gitpull…
apt-get…
bundleupdate
configuration
…
유지보수
Thesystembecomesahouseofcards.Youfearanychange
andyoufearreplacingitsinceyoudon’tknoweverything
abouthowitworks.
TrashYour...
서버관리의본질은전역적환경설정
서버는
하드웨어부터
OS를거쳐
어플리케이션까지
모든요소들이얽히고섥혀있는곳
의존성거의관리불가능
StatefulImage
그저이미지화했을뿐이고
StatefulImage
복원불가능
검증불가능
일단돌아는감
안전불감증
StatefulImage
DisposableComponents
fromRecycledImage
State
프로그래머의원죄
전역변수를사용하지말라
ConfigurationManagement
상태관리가귀찮으면관리안하면되잖아
이토나오야
InfrastructureasCode
이토나오야
ConfigurationManagement
Chef
Puppet
Ansible
ConfigurationManagement
Idempotence(멱등)
ConfigurationManagement
복원가능
Build
검증가능
Serverspec
이력관리
InfrastructureasCode
Build
#ChefCookbook::MyServer
#Recipe::InstallApache
log'InstallApache'
package'httpd'do
action:install
end
ServerSpec
require'spec_helper'
describepackage('httpd')do
it{shouldbe_installed}
end
describeservice('httpd')do
it{should...
ConfigurationManagement
Deployment
Vagrant
Provisioner
Provider
Vagrant
Provisioner=Chef
Provider=Vmware
Vagrant
Provisioner=Chef
Provider=AWSEC2
Vagrant
Provisioning=Chef
Provider=DigitalOcean
Vagrant
HashiCorp의야망
Vagrant
뒤에서다시
ServerImage
Stateless
ConfigurationManagement
ImmutableInfrastructure
Immutable?
변경불가능
inJava
StringvsStringBuffer
함수형프로그래밍언어
Immutable==Stateless
TravisCI
커밋할때마다
새로운빌드환경구축
Heroku
푸쉬할때마다
새로운어플리케이션이미지생성
ImmutableInfrastructure
관리가능하고
ConfigurationManagement
ImmutableInfrastructure
테스트가능한
ServerSpec
ImmutableInfrastructure
Stateless하고
Build
ImmutableInfrastructure
Scalable한
StampPattern
ImmutableInfrastructure
이미지기반의
Lightweight,Portable
ImmutableInfrastructure
관리가능하고
테스트가능하며
Stateless하고
Scalable한
이미지기반의
어플리케이션배포
Docker
Dockerisanopen-sourceenginethatautomatesthe
deploymentofanyapplicationasalightweight,portable,self-
sufficientconta...
Docker
한마디로
BuildOnce,RunAnywhere
Docker
Docker
Image
Container
Dockerfile
DockerImage
Build
Dockerfile
FROMubuntu:12.04
MAINTAINERDaekwonKim
#Runupgrade
RUNechodebhttp://archive.ubuntu.com/ubuntuprecisemainuniverse...
DockerContainer
Run
Docker-registry
ImageArchive
예제)Remotty공동가계부빌드/배포구상도
GithubHook
Jenkins
Local
PushImagetoDockerRegistry
Remote(StageServer)
Notify
Local(BuildServe)
DockerBuild(test)
DockerBuild(application)
PushImagetoDockerRegistry
Dockerfile
FROMnacyot-bbapi
MAINTAINERDaekwonKim
ADD./workspace
#ENV
ENVRAILS_ENVtest
#Build
RUNcd/workspace;echo'gem:--no...
Dockerfile.production
#Installbbapi
ADD./app
ADDProcfile/app/Procfile
ENVRAILS_ENVproduction
RUNcd/app;bundleinstall--with...
PushImagetoDokcerRegistry
mvDockerfile.productionDockerfile
exportHASH=$(gitshow-ref--head|grep-hHEAD|cut-d':'-f2|head-n1|...
Remote(StageServer)
dockerpulldocker-registry.remotty.com/nacyot-bbapi:latest
dockerrun-ddocker-registry.remotty.com/nacyo...
Remote(StageServer)
참고:도커이미지용량?
(1+1+1+1+1+1+1)GB=7GB?
참고:도커이미지용량?
$s3cmddu-H
1241Ms3://remotty-docker-registry/
참고:도커이미지용량?
Notify
Slack
Github
DeploymentbasedonDocker
==RuningContainer
!=ManagingServer
Docker장점
컨테이너를싣는플랫폼
Docker단점
컨테이너를싣는플랫폼
HashiCorp
Vagrant
Packer
Serf
Packer
Packerislightweight,runsoneverymajoroperatingsystem,
andishighlyperformant,creatingmachineimagesfor
multipleplatfor...
Packer
한마디로
범용적이미지생성기
Packer
Provisioners
ChefSolo
Ansible
Puppet
ShellScripts
Builders
AmazonEC2(AMI)
DigitalOcean
Docker
GoogleComputEngine
Vi...
VagrantandPacker
Development=Deployment=Image
Serf
Orchestration
TheFutureisImmutable
MitchellHashimoto
감사합니다:)
이미지 기반의 배포 패러다임 Immutable infrastructure
이미지 기반의 배포 패러다임 Immutable infrastructure
이미지 기반의 배포 패러다임 Immutable infrastructure
이미지 기반의 배포 패러다임 Immutable infrastructure
이미지 기반의 배포 패러다임 Immutable infrastructure
이미지 기반의 배포 패러다임 Immutable infrastructure
이미지 기반의 배포 패러다임 Immutable infrastructure
이미지 기반의 배포 패러다임 Immutable infrastructure
Upcoming SlideShare
Loading in …5
×

이미지 기반의 배포 패러다임 Immutable infrastructure

4,901 views

Published on

2014 Programer 세미나 데이 발표.

Published in: Technology
  • Be the first to comment

이미지 기반의 배포 패러다임 Immutable infrastructure

  1. 1. ImmutableInfrastructure DaekwonKim propellerheaven@gmail.com
  2. 2. nacyot @nacyot Rubyprogrammer http://nacyot.com
  3. 3. WebDevelopment RubyonRails ProgrammingLanguages Visualization Translation Deployment
  4. 4. Deployment ImmutableInfrastructure
  5. 5. Leevi http://leevi.co.kr/
  6. 6. Remotty http://blog.remotty.com
  7. 7. 지난이야기 WebDevelopment ServerManagement AmazonWebService
  8. 8. 오늘이야기 ImmutableInfrastructure DisposableComponents Orchestration BlueGreenDeployment ContinuousDelivery
  9. 9. 새로운툴 Chef/Puppet/Ansible Docker Vagrant Packer Serf ServerSpec AmazonWebService
  10. 10. TOC Cloud AutoScaling Image Deploy ImmutableInfrastructure DisposableComponents ConfigurationManagement Docker HashiCorp
  11. 11. Cloud SaaS PasS IaaS
  12. 12. Cloud SoftwareasaService GoogleApps AdobeCreativeCloud PlatformasaService Heroku GoogleAppEngine InfrastructureasaService AmazonWebService Ucloudbiz
  13. 13. PlatformasaService
  14. 14. 컴퓨터vs클라우드
  15. 15. 컴퓨터(서버) 물리적실체 공간적제약 장소적제약 예산적제약 유지보수
  16. 16. 클라우드위의컴퓨터 비물리적실체 공간적제약? 장소적제약? 예산적제약? 유지보수?
  17. 17. Delegate,Delegate,Delegate
  18. 18. 공간적제약 언제든원하는만큼사용할수있음 물리적서버를설치할필요없음
  19. 19. 장소적제약 원하는리젼(장소)에서서비스가능 AWSEC2,DigitalOcean 원하는위치에서배포가능 CDN,AWSCloudFront
  20. 20. 예산적제약 매몰비용이거의발생하지않음 서버를구입할필요없음 월단위대여할필요없음 사용한만큼만내면됨 시간단위과금
  21. 21. 유지보수 필요없음 DisposableComponents?
  22. 22. AmazonWebService는인터넷의발전소다. 타마카와켄
  23. 23. 디지털오션예제
  24. 24. 서버실행하기 $tugboatcreateContainerShip-s66-i2158507-r6-k301023 $tugboatdroplets ContainerShip(ip:128.199.253.99,status:new,region:6,id:1383635)
  25. 25. 서버종료하기 $tugboatdestroyContainerShip Dropletfuzzynameprovided.FindingdropletID...done,1383635(ContainerShip) Warning!Potentiallydestructiveaction.Pleaseconfirm[y/n]:y Queuingdestroyfor1383635(ContainerShip)...done
  26. 26. Billing
  27. 27. 10원
  28. 28. Cloud!=ServerHosting
  29. 29. RRRSpec 분산테스트프레임워크
  30. 30. RRRSpec 테스트17000개 1대로몇시간걸림
  31. 31. RRRSpec 1대*몇시간 == EC2스팟인스턴스60대*8~9분
  32. 32. DeploymentonCloud
  33. 33. AutoScaling 부하가커지면 자동적으로인스턴스가실행되고(ScaleOut) 부하가작아지면 자동적으로인스턴스가종료됨
  34. 34. AutoScaling의장점 유연한대응 합리적비용
  35. 35. AutoScaling의조건 어플리케이션설계 정교한비지니스로직분리 서버환경설정분리및자동화 데이터스토어분리
  36. 36. WheninRome,doastheRomansdo 클라우드위에선클라우드에어울리는설계가필요 BestPractice CDP클라우드설계원칙 TheTwelve-FactorApp
  37. 37. CDP클라우드설계원칙 가능한한서비스를이용 생각보다행동으로 작은규모로시작하여스케일아웃 변화를전계층에서처리 고장을위한설계 처음뿐이아닌주기적인개선
  38. 38. AutoScaling을전제로한컴퓨터란 어플리케이션이가동되기위한환경이구성된 인스턴스로부터Stamp패턴으로생성된 AMI이미지로부터생성된 가상인스턴스(컴퓨터)
  39. 39. AutoScaling을전제로한컴퓨터란 어플리케이션이가동되기위한환경이구성된 인스턴스로부터Stamp패턴으로생성된 AMI이미지로부터생성된 DisposableComponents
  40. 40. DisposableCopmonent 쓰고 버리는
  41. 41. DisposableCopmonent 미리설정된 쓰고 버리는 인스턴스(컴퓨터)
  42. 42. DisposableCopmonent 서버설정? 서버관리?
  43. 43. Image
  44. 44. Image 새로운문제
  45. 45. Image 이미지는정말로작동가능한가?
  46. 46. Image 아마도…
  47. 47. 최초의이미지는어디서오는가? 서버설정 useradd… setenv apt-getupdate apt-getinstall…(순서!!) ufw… iptable… …
  48. 48. 최초의이미지는어디서오는가? 어플리케이션설치 rubybuild apt-get… geminstallbundler gitclone… bundleinastll configuration runapplicationserver serverproxy …
  49. 49. 어플리케이션이업데이트되면? 어플리케이션업데이트 gitpull… apt-get… bundleupdate configuration …
  50. 50. 유지보수
  51. 51. Thesystembecomesahouseofcards.Youfearanychange andyoufearreplacingitsinceyoudon’tknoweverything abouthowitworks. TrashYourServersandBurnYourCode:ImmutableInfrastructureand DisposableComponents,ChadFowler
  52. 52. 서버관리의본질은전역적환경설정 서버는 하드웨어부터 OS를거쳐 어플리케이션까지 모든요소들이얽히고섥혀있는곳 의존성거의관리불가능
  53. 53. StatefulImage 그저이미지화했을뿐이고
  54. 54. StatefulImage 복원불가능 검증불가능 일단돌아는감 안전불감증
  55. 55. StatefulImage DisposableComponents fromRecycledImage
  56. 56. State 프로그래머의원죄 전역변수를사용하지말라
  57. 57. ConfigurationManagement
  58. 58. 상태관리가귀찮으면관리안하면되잖아 이토나오야
  59. 59. InfrastructureasCode 이토나오야
  60. 60. ConfigurationManagement Chef Puppet Ansible
  61. 61. ConfigurationManagement Idempotence(멱등)
  62. 62. ConfigurationManagement 복원가능 Build 검증가능 Serverspec 이력관리 InfrastructureasCode
  63. 63. Build #ChefCookbook::MyServer #Recipe::InstallApache log'InstallApache' package'httpd'do action:install end
  64. 64. ServerSpec require'spec_helper' describepackage('httpd')do it{shouldbe_installed} end describeservice('httpd')do it{shouldbe_enabled} it{shouldbe_running} end describeport(80)do it{shouldbe_listening} end
  65. 65. ConfigurationManagement Deployment
  66. 66. Vagrant Provisioner Provider
  67. 67. Vagrant Provisioner=Chef Provider=Vmware
  68. 68. Vagrant Provisioner=Chef Provider=AWSEC2
  69. 69. Vagrant Provisioning=Chef Provider=DigitalOcean
  70. 70. Vagrant HashiCorp의야망
  71. 71. Vagrant 뒤에서다시
  72. 72. ServerImage Stateless ConfigurationManagement
  73. 73. ImmutableInfrastructure
  74. 74. Immutable? 변경불가능 inJava StringvsStringBuffer 함수형프로그래밍언어
  75. 75. Immutable==Stateless
  76. 76. TravisCI 커밋할때마다 새로운빌드환경구축 Heroku 푸쉬할때마다 새로운어플리케이션이미지생성
  77. 77. ImmutableInfrastructure 관리가능하고 ConfigurationManagement
  78. 78. ImmutableInfrastructure 테스트가능한 ServerSpec
  79. 79. ImmutableInfrastructure Stateless하고 Build
  80. 80. ImmutableInfrastructure Scalable한 StampPattern
  81. 81. ImmutableInfrastructure 이미지기반의 Lightweight,Portable
  82. 82. ImmutableInfrastructure 관리가능하고 테스트가능하며 Stateless하고 Scalable한 이미지기반의 어플리케이션배포
  83. 83. Docker Dockerisanopen-sourceenginethatautomatesthe deploymentofanyapplicationasalightweight,portable,self- sufficientcontainerthatwillrunvirtuallyanywhere
  84. 84. Docker 한마디로 BuildOnce,RunAnywhere
  85. 85. Docker
  86. 86. Docker Image Container Dockerfile
  87. 87. DockerImage Build
  88. 88. Dockerfile FROMubuntu:12.04 MAINTAINERDaekwonKim #Runupgrade RUNechodebhttp://archive.ubuntu.com/ubuntuprecisemainuniverse/etc/apt/sources.list RUNapt-getupdate #Installbasicpackages RUNapt-get-qq-yinstallgitcurlbuild-essential #Installapache2 RUNapt-get-qq-yinstallapache2 ENVAPACHE_RUN_USERwww-data ENVAPACHE_RUN_GROUPwww-data ENVAPACHE_LOG_DIR/var/log/apache2 RUNa2enmodrewrite propellerheaven@gmail.com
  89. 89. DockerContainer Run
  90. 90. Docker-registry ImageArchive
  91. 91. 예제)Remotty공동가계부빌드/배포구상도 GithubHook Jenkins Local PushImagetoDockerRegistry Remote(StageServer) Notify
  92. 92. Local(BuildServe) DockerBuild(test) DockerBuild(application) PushImagetoDockerRegistry
  93. 93. Dockerfile FROMnacyot-bbapi MAINTAINERDaekwonKim ADD./workspace #ENV ENVRAILS_ENVtest #Build RUNcd/workspace;echo'gem:--no-ri--no-rdoc'~/.gemrc RUNcd/workspace;bundleinstall--withoutdevelopment RUNcd/workspace;bundleexecrakedb:migrateRAILS_ENV=test RUNcd/workspace;bundleexecrspec propellerheaven@gmail.com
  94. 94. Dockerfile.production #Installbbapi ADD./app ADDProcfile/app/Procfile ENVRAILS_ENVproduction RUNcd/app;bundleinstall--withoutdevelopmenttest RUNcd/app;bundleexecrakedb:create RUNcd/app;bundleexecrakedb:migrate RUNcd/app;bundleexecrakedb:seed RUNcd/app/angular;npminstall RUNcd/app/angular;mkdirtasks RUNcd/app/angular;npminstallgrunt-contrib-nodeunit RUNmv/app/angular/config/config.default.json/app/angular/config/config.json #Runbbapi EXPOSE3000 EXPOSE9000 WORKDIR/app CMDforemanstart-fProcfile
  95. 95. PushImagetoDokcerRegistry mvDockerfile.productionDockerfile exportHASH=$(gitshow-ref--head|grep-hHEAD|cut-d':'-f2|head-n1|head-c10) dockerbuild-rm-tnacyot-bbapi:${HASH}. dockertagnacyot-bbapi:${HASH}docker-registry.remotty.com/nacyot-bbapi:${HASH} dockertagnacyot-bbapi:${HASH}docker-registry.remotty.com/nacyot-bbapi:latest dockerdocker-registry.remotty/nacyot-bbapi 커밋마다빌드되어이미지로Registry저장소(S3)에저장됨.
  96. 96. Remote(StageServer) dockerpulldocker-registry.remotty.com/nacyot-bbapi:latest dockerrun-ddocker-registry.remotty.com/nacyot-bbapi:latest ${HASH}.stage.bbapi.remotty.com 커밋별스테이지서버 E2ETest
  97. 97. Remote(StageServer)
  98. 98. 참고:도커이미지용량? (1+1+1+1+1+1+1)GB=7GB?
  99. 99. 참고:도커이미지용량? $s3cmddu-H 1241Ms3://remotty-docker-registry/
  100. 100. 참고:도커이미지용량?
  101. 101. Notify Slack Github
  102. 102. DeploymentbasedonDocker ==RuningContainer !=ManagingServer
  103. 103. Docker장점 컨테이너를싣는플랫폼
  104. 104. Docker단점 컨테이너를싣는플랫폼
  105. 105. HashiCorp Vagrant Packer Serf
  106. 106. Packer Packerislightweight,runsoneverymajoroperatingsystem, andishighlyperformant,creatingmachineimagesfor multipleplatformsinparallel. IntroductiontoPacker
  107. 107. Packer 한마디로 범용적이미지생성기
  108. 108. Packer Provisioners ChefSolo Ansible Puppet ShellScripts Builders AmazonEC2(AMI) DigitalOcean Docker GoogleComputEngine VirtualBox VMware
  109. 109. VagrantandPacker Development=Deployment=Image
  110. 110. Serf Orchestration
  111. 111. TheFutureisImmutable MitchellHashimoto
  112. 112. 감사합니다:)

×