Slide 1

Slide 1 text

%PDLFS$PNQPTF1BB4ͷ
 ࡞Γํɺͦͯ͠
 ࣾ಺ʹಋೖͨ͠࿩ 2016-07-03 YAP(achimon)C::Asia Hachioji 2016 mid in Shinagawa Daisuke Fujita (@dtan4)

Slide 2

Slide 2 text

Daisuke Fujita / @dtan4 Engineer, Infrastructure Team
 @ Wantedly, Inc. AWS, Terraform / Terraforming, Developer Productivity

Slide 3

Slide 3 text

Docker Compose PaaS ͷ࡞Γํɺ
 ͦͯࣾ͠಺ʹಋೖͨ͠࿩ Why private PaaS? Paus: Docker Compose PaaS Introduce & Feedbacks Latest Updates & Future

Slide 4

Slide 4 text

Why private PaaS? Problems at Wantedly engineering

Slide 5

Slide 5 text

1ͭͷ QA ؀ڥڞ༗ʹ
 ݶք͕དྷͨ ؾܰʹΞϓϦΛσϓϩΠ
 Ͱ͖Δ؀ڥ͕΄͍͠

Slide 6

Slide 6 text

1ͭͷ QA ؀ڥڞ༗ʹ
 ݶք͕དྷͨ ؾܰʹΞϓϦΛσϓϩΠ
 Ͱ͖Δ؀ڥ͕΄͍͠

Slide 7

Slide 7 text

Deployment environments Production QA

Slide 8

Slide 8 text

Deployment environments Production www.wantedly.com ͦͷ΋ͷ ࠷৽ͷ master Λ deploy ͢Δ

Slide 9

Slide 9 text

Deployment environments QA ಈ࡞νΣοΫɾࣾ಺֬ೝ༻ Production σϓϩΠલʹ
 ඞͣ QA ͰνΣοΫ͢Δ ϞόΠϧΞϓϦͷςελʔ΋
 ಉ͡ QA ؀ڥʹ઀ଓ

Slide 10

Slide 10 text

Problems of QA QA QA ॱ൪଴ͪ໰୊ ϞόΠϧςετ΁ͷӨڹ

Slide 11

Slide 11 text

Problems of QA QA QA ॱ൪଴ͪ໰୊ ΤϯδχΞ͕૿͖͑ͯͨͷͰɺ
 ෳ਺ਓ͕ಉ࣌ʹ QA ʹग़ͨ͘͠ ͳΔ => Production ΁ͷϦϦʔε͕
 ஗ΕΔ

Slide 12

Slide 12 text

Problems of QA QA QA ॱ൪଴ͪ໰୊

Slide 13

Slide 13 text

Problems of QA QA ϞόΠϧςετ΁ͷӨڹ feature branch σϓϩΠͯ͠
 API ͷڍಈ͕มΘΔ => ςετ݁ՌʹӨڹ͢Δ

Slide 14

Slide 14 text

1ͭͷ QA ؀ڥڞ༗ʹ
 ݶք͕དྷͨ ؾܰʹΞϓϦΛσϓϩΠ
 Ͱ͖Δ؀ڥ͕΄͍͠

Slide 15

Slide 15 text

Deploy apps easily αʔϏεϦϦʔεʹ͋ͨͬͯɺΠϯϑϥߏஙʹ
 2ਓ೔͘Β͍අ΍͞ΕΔ • Production... ͸ Kubernetes ೖΕΑ͏ͱͯ͠Δ ΋ͬͱؾܰʹΞϓϦΛσϓϩΠͰ͖Δ؀ڥ͕΄͍͠ Heroku Έ͍ͨʹ؆୯ʹɺࣗ෼ͨͪͷ޷͖ͳߏ੒Ͱ

Slide 16

Slide 16 text

Wantedly ❤ Docker Wantedly ͷશαʔϏε͸ 
 Docker on CoreOS ͰՔಇ͍ͯ͠Δ • Web app, Elasticsearch, ը૾ม׵αʔόɺ΄͔ॾʑ ৽نαʔϏε͸ Dockerfile ΛϦϙδτϦʹஔ͍ͯ΋Β͏ ผίϯϙʔωϯτʹґଘ͢Δ৔߹͸ docker-compose.yml ΋

Slide 17

Slide 17 text

Docker Compose ෳ਺ίϯςφͰߏ੒͞ΕΔΞϓϦέʔγϣϯΛ
 ؆୯ʹ্ཱͪ͛Δπʔϧ docker-compose.yml ͰαʔϏεఆٛͱ
 ґଘؔ܎Λهड़ docker-compose up Ͱίϯςφىಈ

Slide 18

Slide 18 text

Docker Compose ʮdocker-compose.yml Ͱߏ੒هड़ͨ͠Β
 ͦΕΛσϓϩΠͰ͖Δ؀ڥ͕΄͍͠…ʯ ʮdocker-compose up ͯ͘͠ΕΔ͚ͩͰ͍͍ʯ

Slide 19

Slide 19 text

1ͭͷ QA ؀ڥڞ༗ʹ
 ݶք͕དྷͨ ؾܰʹΞϓϦΛσϓϩΠ
 Ͱ͖Δ؀ڥ͕΄͍͠

Slide 20

Slide 20 text

PaaS Λಋೖ͠Α͏

Slide 21

Slide 21 text

Evaluate existing PaaS What we need for PaaS

Slide 22

Slide 22 text

طଘͷ PaaS ͩͱ
 զʑͷཁٻΛຬͨ͢΋ͷ͕
 ͳ͔ͬͨ

Slide 23

Slide 23 text

PaaS in the world • Heroku • Heroku Private Spaces OSS PaaS • dokku / dokku-alt • Flynn • Deis • Tutum • DCHQ.io • Empire • Convox • pool • …

Slide 24

Slide 24 text

PaaS in the world Heroku ͩͱ buildpack + addons ߏ੒ ͳͷͰ
 Ͱ͖Δ͜ͱ੍͕ݶ͞ΕΔ • ΧελϚΠζͨ͠ϛυϧ΢ΣΞͱ͔Λ࢖͑ͳ͍ • e.g. ಠࣗࣙॻΛ૊ΈࠐΜͩ Elasticsearch Docker Image

Slide 25

Slide 25 text

PaaS in the world ΄ͱΜͲͷ OSS PaaS ͸ Heroku Ϋϩʔϯ • ݁ہ buildpack ʹറΒΕΔ

Slide 26

Slide 26 text

طଘͷ PaaS ͩͱ
 զʑͷཁٻΛຬͨ͢΋ͷ͕
 ͳ͔ͬͨ

Slide 27

Slide 27 text

PaaS Λ࡞Ζ͏

Slide 28

Slide 28 text

Paus Docker Compose PaaS

Slide 29

Slide 29 text

Paus docker-compose.yml ॻ͍ͯ git push ͢Δ͚ͩͰσϓϩΠ طଘΠϝʔδ pull ͚ͩͰͳ͘ɺbuild ΋Մೳ αϒυϝΠϯׂΓ͋ͯ GitHub ΞΧ΢ϯτ࿈ܞ for Development / Test dtan4/paus

Slide 30

Slide 30 text

Paus dtan4/paus Inspired by: Raspaas http://www.slideshare.net/npsg/2-docker-paas-55540529 tetsusat/raspaas

Slide 31

Slide 31 text

DEMO

Slide 32

Slide 32 text

Paus https://ja.glosbe.com/ja/id/%E3%82%AF%E3%82%B8%E3%83%A9 dtan4/paus

Slide 33

Slide 33 text

Paus https://ja.glosbe.com/ja/id/%E3%82%AF%E3%82%B8%E3%83%A9 dtan4/paus

Slide 34

Slide 34 text

vs. Existing PaaS ⭕ Pros • ֶशίετ͕গͳ͍ • ߏ଄͕γϯϓϧ • σϓϩΠ͕खܰ ❌ Cons • ػೳෆ଍

Slide 35

Slide 35 text

–Johnny Appleseed “Type a quote here.” OS CoreOS Data store etcd Clustering Docker Swarm HTTP Reverse Proxy Vulcand git-push entrypoint paus-gitreceive
 w/ gitreceive Paus Components

Slide 36

Slide 36 text

CoreOS ίϯςφલఏͷܰྔ Linux Distribution ͢΂ͯͷΞϓϦέʔγϣϯΛ
 Docker ίϯςφ্Ͱಈ͔͢ Production in Wantedly, Inc. Update channel: beta
 Reboot strategy: no https://coreos.com/assets/images/media/Host-Diagram.png

Slide 37

Slide 37 text

etcd Raft Λ࠾༻ͨ͠෼ࢄ KVS CoreOS ͕։ൃ 
 & CoreOS ωΠςΟϒαϙʔτ Application metadata, Deployments, Routing rules,
 Cluster discovery coreos/etcd quay.io/coreos/etcd https://coreos.com/assets/images/media/5-Machine-Cluster.png

Slide 38

Slide 38 text

Docker Swarm Docker ͕։ൃ͢Δ Clustering System ෳ਺ͷ Docker ϗετΛ·ͱΊͯ 
 1ͭͷڊେͳϦιʔεϓʔϧͱΈͳ͢ Docker Compose ΠϯςάϨʔγϣϯ Docker Engine 1.12 ʹ౷߹͞ΕΔ docker/swarm swarm

Slide 39

Slide 39 text

Vulcand etcd όοΫΤϯυͷ HTTP Reverse Proxy Mailgun ͕։ൃ αʔϏεϦελʔτͳ͠Ͱ
 มߋΛଈ࠲ʹద༻Մೳ vulcand/vulcand vulcand https://camo.githubusercontent.com/b91054e9220422d7cdad498c229ae254b41601f5/687474703a2f2f636f72656f732e636f6d2f6173736574732f696d616765732f6d656469612f76756c63616e2d312d757073747265616d2e706e67

Slide 40

Slide 40 text

gitreceive git push Λड͚෇͚ͯεΫϦϓτ/ίϚϯυ࣮ߦ ໿ 180 ߦͷγΣϧεΫϦϓτ dokku Ͱ࢖ΘΕͯͨΓɺFlynn ʹຒΊࠐ·ΕͯͨΓ progrium/gitreceive

Slide 41

Slide 41 text

paus-frontend Paus ͷ Web Dashboard GitHub ΞΧ΢ϯτͰαΠϯΠϯ ΞϓϦέʔγϣϯͷొ࿥ɺ
 build-time arguments, ؀ڥม਺ͷઃఆ Alpine Linux + (Go + gin-gonic/gin) dtan4/paus-frontend quay.io/dtan4/paus-frontend

Slide 42

Slide 42 text

paus-frontend dtan4/paus-frontend quay.io/dtan4/paus-frontend

Slide 43

Slide 43 text

git push ͷड͚ޱ docker-compose build 
 + docker-compose up etcd ʹϝλσʔλ 
 + Vulcand ઃఆΛอଘ Ubuntu + gitreceive + receiver (by Go) paus-gitreceive dtan4/paus-gitreceive quay.io/dtan4/paus-gitreceive SFDFJWFS XFC EC XFC SFEJT

Slide 44

Slide 44 text

Deploy phase Paus QBVTHJUSFDFJWF QBVTGSPOUFOE XFC EC XFC SFEJT XFC $ git push paus master :2222

Slide 45

Slide 45 text

Access to application Paus http://dtan4-rails-ffe7rf8.pausapp.com QBVTHJUSFDFJWF QBVTGSPOUFOE XFC EC XFC SFEJT XFC :80

Slide 46

Slide 46 text

Access to dashboard Paus http://pausapp.com QBVTHJUSFDFJWF QBVTGSPOUFOE XFC EC XFC SFEJT XFC :80

Slide 47

Slide 47 text

Introduce & Feedbacks

Slide 48

Slide 48 text

Introduce ϓϩτλΠϓ: 1೔ ։ൃ: 1ϲ݄ऑ ΤϯδχΞ޲͚ϋϯζΦϯΛ࣮ࢪ progrium/gitreceive

Slide 49

Slide 49 text

Feedbacks ศར ύϑΥʔϚϯε͕ѱ͍
 ϝϞϦॏࢹͰ r3 ࢖ͬͯͨ => c4 ʹஔ͖׵͑ ઃఆ͕໘౗
 ϦϙδτϦʹσϑΥϧτ஋ຒΊࠐΜͩ .env ஔ͍ͯ
 docker-compose.yml Ͱಡ·ͤΔ progrium/gitreceive

Slide 50

Slide 50 text

Latest Updates & Future

Slide 51

Slide 51 text

Deploy from CI ʮgit push ͢Δͷ΋໘౗ʯ GitHub ʹ push ͨ͠Β Paus ʹσϓϩΠʂ
 ؾ͕͍ͭͨΒউखʹσϓϩΠ͞ΕͯΔʂ CircleCI ͔Β git push paus σϓϩΠ਺্ݶΛઃఆͰ͖ΔΑ͏ʹ

Slide 52

Slide 52 text

Deploy from CI

Slide 53

Slide 53 text

Deploy from CI

Slide 54

Slide 54 text

Replace backend CoreOS + Swarm Ϋϥελ؅ཧ͕໘౗ Docker Compose ͱີ݁߹ ϩάͷ໰୊

Slide 55

Slide 55 text

Replace backend to ECS Ϋϥελ؅ཧͱεέδϡʔϦϯάΛ ECS ʹ೚ͤΔ API ܦ༝ͰαʔϏε৘ใΛऔಘ CloudWatch Logs Ͱϩά΋औΕΔ ΫϥελϝτϦΫεʹج͍ͮͨΦʔτεέʔϧ => ECS ͸ PaaS backend ͱͯ͠࠷దͰ͸ʁ

Slide 56

Slide 56 text

Replace backend to ECS ΠϯϑϥνʔϜతʹ͸ Kubernetes ͷ෩ை ref: ͏·͍۩߹ʹ΍͍ͬͯ͘

Slide 57

Slide 57 text

Recap

Slide 58

Slide 58 text

Recap ڞ༗ QA ؀ڥʹݶք͕དྷͨ & ؾܰʹσϓϩΠ͔ͨͬͨ͠ ෳ਺ͷ OSS Λ૊Έ߹Θͤɺࣗ෼ͨͪͷཁٻΛຬͨ͢
 Docker Compose PaaS: Paus Λ࡞ͬͨ ࣾ಺ಋೖͯ͠Έͨ΋ͷͷɺվળͷ༨஍͋Γ ECS ࢼ͍ͨ͠