Docker Compose PaaS の作り方、そして社内に導入した話 / #yapc8oji

Docker Compose PaaS の作り方、そして社内に導入した話 / #yapc8oji

YAP(achimon)C::Asia Hachioji 2016 mid in Shinagawa での発表資料です。

https://github.com/hachiojipm/yapcasia-8oji-2016mid-timetable/issues/80

Paus: https://github.com/dtan4/paus

92ce4587cc8465736433e698b1e50aaa?s=128

Daisuke Fujita

July 03, 2016
Tweet

Transcript

  1. 2.

    Daisuke Fujita / @dtan4 Engineer, Infrastructure Team
 @ Wantedly, Inc.

    AWS, Terraform / Terraforming, Developer Productivity
  2. 3.
  3. 15.

    Deploy apps easily αʔϏεϦϦʔεʹ͋ͨͬͯɺΠϯϑϥߏஙʹ
 2ਓ೔͘Β͍අ΍͞ΕΔ • Production... ͸ Kubernetes ೖΕΑ͏ͱͯ͠Δ

    ΋ͬͱؾܰʹΞϓϦΛσϓϩΠͰ͖Δ؀ڥ͕΄͍͠ Heroku Έ͍ͨʹ؆୯ʹɺࣗ෼ͨͪͷ޷͖ͳߏ੒Ͱ
  4. 16.

    Wantedly ❤ Docker Wantedly ͷશαʔϏε͸ 
 Docker on CoreOS ͰՔಇ͍ͯ͠Δ

    • Web app, Elasticsearch, ը૾ม׵αʔόɺ΄͔ॾʑ ৽نαʔϏε͸ Dockerfile ΛϦϙδτϦʹஔ͍ͯ΋Β͏ ผίϯϙʔωϯτʹґଘ͢Δ৔߹͸ docker-compose.yml ΋
  5. 23.

    PaaS in the world • Heroku • Heroku Private Spaces

    OSS PaaS • dokku / dokku-alt • Flynn • Deis • Tutum • DCHQ.io • Empire • Convox • pool • …
  6. 24.

    PaaS in the world Heroku ͩͱ buildpack + addons ߏ੒

    ͳͷͰ
 Ͱ͖Δ͜ͱ੍͕ݶ͞ΕΔ • ΧελϚΠζͨ͠ϛυϧ΢ΣΞͱ͔Λ࢖͑ͳ͍ • e.g. ಠࣗࣙॻΛ૊ΈࠐΜͩ Elasticsearch Docker Image
  7. 29.

    Paus docker-compose.yml ॻ͍ͯ git push ͢Δ͚ͩͰσϓϩΠ طଘΠϝʔδ pull ͚ͩͰͳ͘ɺbuild ΋Մೳ

    αϒυϝΠϯׂΓ͋ͯ GitHub ΞΧ΢ϯτ࿈ܞ for Development / Test dtan4/paus
  8. 31.
  9. 35.

    –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
  10. 36.

    CoreOS ίϯςφલఏͷܰྔ Linux Distribution ͢΂ͯͷΞϓϦέʔγϣϯΛ
 Docker ίϯςφ্Ͱಈ͔͢ Production in Wantedly,

    Inc. Update channel: beta
 Reboot strategy: no https://coreos.com/assets/images/media/Host-Diagram.png
  11. 37.

    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
  12. 38.

    Docker Swarm Docker ͕։ൃ͢Δ Clustering System ෳ਺ͷ Docker ϗετΛ·ͱΊͯ 


    1ͭͷڊେͳϦιʔεϓʔϧͱΈͳ͢ Docker Compose ΠϯςάϨʔγϣϯ Docker Engine 1.12 ʹ౷߹͞ΕΔ docker/swarm swarm
  13. 39.

    Vulcand etcd όοΫΤϯυͷ HTTP Reverse Proxy Mailgun ͕։ൃ αʔϏεϦελʔτͳ͠Ͱ
 มߋΛଈ࠲ʹద༻Մೳ

    vulcand/vulcand vulcand https://camo.githubusercontent.com/b91054e9220422d7cdad498c229ae254b41601f5/687474703a2f2f636f72656f732e636f6d2f6173736574732f696d616765732f6d656469612f76756c63616e2d312d757073747265616d2e706e67
  14. 41.

    paus-frontend Paus ͷ Web Dashboard GitHub ΞΧ΢ϯτͰαΠϯΠϯ ΞϓϦέʔγϣϯͷొ࿥ɺ
 build-time arguments,

    ؀ڥม਺ͷઃఆ Alpine Linux + (Go + gin-gonic/gin) dtan4/paus-frontend quay.io/dtan4/paus-frontend
  15. 43.

    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
  16. 49.

    Feedbacks ศར ύϑΥʔϚϯε͕ѱ͍
 ϝϞϦॏࢹͰ r3 ࢖ͬͯͨ => c4 ʹஔ͖׵͑ ઃఆ͕໘౗


    ϦϙδτϦʹσϑΥϧτ஋ຒΊࠐΜͩ .env ஔ͍ͯ
 docker-compose.yml Ͱಡ·ͤΔ progrium/gitreceive
  17. 51.

    Deploy from CI ʮgit push ͢Δͷ΋໘౗ʯ GitHub ʹ push ͨ͠Β

    Paus ʹσϓϩΠʂ
 ؾ͕͍ͭͨΒউखʹσϓϩΠ͞ΕͯΔʂ CircleCI ͔Β git push paus <branch> σϓϩΠ਺্ݶΛઃఆͰ͖ΔΑ͏ʹ
  18. 55.

    Replace backend to ECS Ϋϥελ؅ཧͱεέδϡʔϦϯάΛ ECS ʹ೚ͤΔ API ܦ༝ͰαʔϏε৘ใΛऔಘ CloudWatch

    Logs Ͱϩά΋औΕΔ ΫϥελϝτϦΫεʹج͍ͮͨΦʔτεέʔϧ => ECS ͸ PaaS backend ͱͯ͠࠷దͰ͸ʁ
  19. 57.
  20. 58.

    Recap ڞ༗ QA ؀ڥʹݶք͕དྷͨ & ؾܰʹσϓϩΠ͔ͨͬͨ͠ ෳ਺ͷ OSS Λ૊Έ߹Θͤɺࣗ෼ͨͪͷཁٻΛຬͨ͢
 Docker

    Compose PaaS: Paus Λ࡞ͬͨ ࣾ಺ಋೖͯ͠Έͨ΋ͷͷɺվળͷ༨஍͋Γ ECS ࢼ͍ͨ͠