Pro Yearly is on sale from $80 to $50! »

Docker ApplicationをDaaSにデプロイ #dockerjp

Docker ApplicationをDaaSにデプロイ #dockerjp

at Docker meetup Tokyo #2

Ecb3acc2d246962361a4f8b3f7a6dd12?s=128

taichi nakashima

April 11, 2014
Tweet

Transcript

  1. Deploying Docker Application to DaaS by @deeeet

  2. Taichi Nakashima @deeeet ! • http://deeeet.com/writing (SOTA) • tcnksm/rbdock •

    Docker ދͷר, Serf ދͷר
  3. Rails Application Λ Docker ίϯςφʹͷͤͯ Docker as a Service (DaaS)

    ʹσϓϩΠ͢Δ
  4. DaaS Docker as a Service Docker ϗεςΟϯάαʔϏε https://orchardup.com/ https://orchardup.com/

  5. DaaS Rails Application Λ Docker ίϯςφʹͷͤͯ Docker as a Service

    (DaaS) ʹσϓϩΠ͢Δ https://orchardup.com/ DaaS https://orchardup.com/ https://orchardup.com/
  6. DaaS Rails Application Λ Docker ίϯςφʹͷͤͯ Docker as a Service

    (DaaS) ʹσϓϩΠ͢Δ https://orchardup.com/ DaaS https://stackdock.com/
  7. DaaS Rails Application Λ Docker ίϯςφʹͷͤͯ Docker as a Service

    (DaaS) ʹσϓϩΠ͢Δ https://orchardup.com/ DaaS http://www.tutum.co/
  8. Orchard • ؆୯ͳίϚϯυϥΠϯϥούʔΛ௨ͯ͡ ϩʔΧϧ͔Βಉ͡ίϚϯυୟ͚ͩ͘Ͱ࢖͑Δ • 1࣌ؒ1ԁ/1݄1000ԁఔ౓Ͱ࢖͑Δ (512MB RAM/20GB SSD) •

    Fig (ίϯςφؒͷ࿈ܞΛࢧԉ͢Δπʔϧ)ͷ ։ൃΛ͍ͯ͠Δ
  9. Environment • OSX • boot2docker • mkwiatkowski/todo-rails4-angularjs (Rails) worked with

    ruby2.0.0p-247, postgresql (DB)
  10. Overview Postgresql Container Rails Container :3000 5432:5432

  11. Dockerfile (Rails) $ gem install rbdock $ rbdock 2.0.0-p247 --app

    todo-rails4-angularjs https://github.com/tcnksm/rbdock
  12. development: adapter: postgresql template: template0 encoding: unicode database: todo_rails4_angularjs_development pool:

    5 username: docker password: docker host: <%= ENV.fetch('DB_PORT_5432_TCP_ADDR') %> port: <%= ENV.fetch('DB_PORT_5432_TCP_PORT') %> http://deeeet.com/writing/2014/03/20/docker-link-container/ config/database.yml
  13. Development at local

  14. $ docker run -d -p 5432:5432 \ -e POSTGRESQL_USER=docker \

    -e POSTGRESQL_PASS=docker \ -name pg \ orchardup/postgresql Postgresql Container
  15. $ docker run -d -p 5432:5432 \ -e POSTGRESQL_USER=docker \

    -e POSTGRESQL_PASS=docker \ -name pg \ orchardup/postgresql Rails Container $ docker run -i t —p 3000:3000 \ -link pg:db \ tcnksm/rails \ 'rake db:create && rake db:migrate && rails server'
  16. http://localhost:3000

  17. Development at local • มߋ͕ೖͬͨΒ build && run (+Guard) •

    VolumesػೳΛ࢖͑͹ϦΞϧλΠϜߋ৽ (+ ONBUILD)
  18. Docker Share (ngrok) $ orchard hosts create Orchard username: tcnksm

    Password: Default host running at 162.243.106.93 $ ngrok 3000 http://36a98c94.ngrok.com -> 127.0.0.1:3000
  19. http://36a98c94.ngrok.com

  20. Deploy to Orchard

  21. Login to Orchard $ orchard hosts create Orchard username: tcnksm

    Password: Default host running at 162.243.106.93
  22. $ orchard docker run -d -p 5432:5432 \ -e POSTGRESQL_USER=docker

    \ -e POSTGRESQL_PASS=docker \ -name pg \ orchardup/postgresql Postgresql Container
  23. $ docker run -d -p 5432:5432 \ -e POSTGRESQL_USER=docker \

    -e POSTGRESQL_PASS=docker \ -name pg \ orchardup/postgresql Rails Container $ orchard docker run -i t —p 80:3000 \ -link pg:db \ tcnksm/rails \ 'rake db:create && rake db:migrate && rails server'
  24. http://162.243.106.93

  25. Conclusion • DaaSʹRails ApplicationΛDeploy • Orchard ͸ͱͯ΋γϯϓϧ -> ϩʔΧϧ͔Βಉ͡ίϚϯυΛୟ͚ͩ͘

  26. Future • Herokuʹpushͱൺ΂ͯԿ͕ྑ͍ͷ? -> DockerͰ΍Δར఺ͷ௥ٻʢ޷͖উखͰ͖Δ+αʣ • ίϯςφ্ཱͪ͛ͨޙ͸? -> ࣮ࡍͷӡ༻

  27. Thanks