Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PHPerなポリドッグがchefとかPackerとかDocker頑張ってみた

polidog
November 28, 2015

 PHPerなポリドッグがchefとかPackerとかDocker頑張ってみた

polidog

November 28, 2015
Tweet

More Decks by polidog

Other Decks in Technology

Transcript

  1. PHPerͳϙϦυοά͕chef ͱ͔Packerͱ͔Dockerؤ ுͬͯΈͨ 2015/11/28 @polidog

  2. ࣗݾ঺հɻ

  3. ß

  4. ϙϦυοάͰ͢ɻ

  5. ޿੉Ξφ ͔Θ͍͍Ͱ͢ɻ

  6. એ఻

  7. nippo࡞ͬͨʂ https://github.com/polidog/nippo

  8. ೔ใॻ͖·͠ΐ͏ɻ

  9. એ఻2

  10. ౦ژͰSymfony Meetup։࠵ ͯ͠·͢ɻ

  11. ڵຯ͕͋Δํɺੋඇ༡ͼʹདྷ ͍ͯͩ͘͞ɻ

  12. ຊ୊΁໭͠·͢ɻ

  13. ·ͩؤு͍ͬͯΔ్தͰ ͢ɾɾɾ͝ΊΜͳ͍͞ɻ

  14. Πϯϑϥྗ௿͍ܥΤϯδχΞ Ͱ͝ΊΜͳ͍͞ɻ

  15. ؤுΖ͏ͱࢥͬͨϓϩδΣΫ τ͕ͳ͘ͳͬͨΜͩ΋ Μɾɾɾɻ

  16. ԿΛؤு͍ͬͯΔͷ͔ɻ

  17. ChefͷϨγϐΛPacker࢖ͬͯ ΠϝʔδԽͯ͠ɺdocker΍ awsͰར༻ग़དྷΔΑ͏ʹͨ͠ ͔ͬͨɻ

  18. None
  19. None
  20. None
  21. None
  22. ͳͥ͜ΜͳࣄΛؤுΖ͏ͱࢥͬ ͯ͠·ͬͨͷ͔ʁ

  23. None
  24. ؤுͬͨखॱΛ͝঺հ͠·͢ɻ 1. chefͷcookbookΛ࡞Δɻ(PHP+nginxͳ؀ڥ) 2. vagrantͳ؀ڥΛߏங͢Δ 3. packerͰchef͔ΒdockerΠϝʔδΛ࡞Δ(్த) 4. packerͰEC2ͷΠϝʔδ࡞੒͢Δ(్த)

  25. 1. chefͷcookbookΛ࡞Δ

  26. ChefDK͸ೖΕ͓͖ͯ·͠ΐ ͏ɻ https://downloads.chef.io/chef-dk/

  27. cookbookΛ࡞Γ·͢ɻ DIFGHFOFSBUFDPPLCPPLQIQ@OHJOY

  28. εʔύʔϚʔέοτͰྑͦ͞ ͏ͳΫοΫϒοΫΛړΔɻ https://supermarket.chef.io

  29. None
  30. ΫοΫϒοΫΛऔΓࠐΉɻ WJ#FSLTpMF DPPLCPPLQIQGQN d DPPLCPPLOHJOY d` CFSLTWFOEPS

  31. metadata.rb΋ॻ͘ɻ WJNFUBEBUBSC EFQFOETQIQ EFQFOETOHJOY

  32. ͦͯ͠recipeΛॻ͜͏ WJSFDJQFTEFGBVMUSC JODMVEF@SFDJQFOHJOYEFGBVMU

  33. ςετΛॻ͘ɻ WJUFTUJOUFHSBUJPOEFGBVMUTFSWFSTQFD OHJOY@TQFDSC SFRVJSFTQFD@IFMQFS EFTDSJCFQBDLBHF OHJOY EP JU\TIPVMECF@JOTUBMMFE^ FOE

  34. ςετΛ࣮ߦ LJUDIFOWFSJGZ

  35. None
  36. େମಈ͘ͷͰPHPͱ͔ͷϨγ ϐΛΰχϣΰχϣॻ͘ɻ

  37. ͜Μͳײ͡ʹͳΓ·ͨ͠ɻ https://github.com/polidog/packer_test

  38. 2. Vagrantͳ؀ڥΛߏங͢Δ

  39. VagrantfileΛ༻ҙ͢Δɻ https://github.com/polidog/packer_test/blob/ master/Vagrantfile

  40. vagrant up͢Δ͚ͩɻ

  41. 3. packerͰdockerϑΝΠϧ Λ࡞Δɻ

  42. packer͸Πϯετʔϧ͓ͯ͠ ͖·͠ΐ͏ɻ https://www.packer.io/

  43. Docker΋ඞཁͳͷͰೖΕ͓ͯ ͖·͠ΐ͏ɻ http://docs.docker.com/mac/started/

  44. packer.jsonϑΝΠϧΛ༻ҙ͢ Δɻ https://github.com/polidog/packer_test/blob/ master/packer.json

  45. ͋ͱ͸build͢Δ͚ͩɻ QBDLFSCVJMEQBDLFSTPO ϩάΛग़͢৔߹ 1"$,&3@-0(QBDLFSCVJMEQBDLFSKTPO

  46. ͔͠͠chefͷॻ͖ํ͕ѱͯ͘ ͏·͘buildͰ͖ͳ͍ɾɾɾ

  47. ࠓؤுͬͯΔ్தͰ͢ɻ

  48. ࢀߟهࣄɻ http://deeeet.com/writing/2014/03/02/build- docker-image-by-packer/

  49. 4. packerͰEC2ͷΠϝʔδΛ ࡞੒͢Δ

  50. ࢼ͕࣌ؒ͋͢Γ·ͤΜͰ͠ ͨɾɾɾɻ

  51. ࠷ޙʹɻ

  52. dockerͳΒdockerͰ౷Ұ͠ ͨ΄͏͕͍͍ͱࢥ͏ɻ