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

Technical Successes and Failures in the History of Cookpad Development

Technical Successes and Failures in the History of Cookpad Development

2016/01/23 Cookpad TechConf 2016
http://techconf.cookpad.com/

Issei Naruta

January 23, 2016
Tweet

More Decks by Issei Naruta

Other Decks in Technology

Transcript

  1. ΫοΫύουͷܧଓతͳ੒௕
    ͷͨΊʹ։ൃͱӡ༻͕

    ԿΛ͖ͯͨ͠ͷ͔ɺ
    ͦͷࣦഊͱ੒ޭʹ͍ͭͯ
    $PPLQBE5FDI$POG
    ΫοΫύουגࣜձࣾΠϯϑϥετϥΫνϟʔ෦
    ੒ాҰੜ

    View full-size slide

  2. ੒ాҰੜ
    ͳΔͨ ͍͍ͬͤ
    !NJSBLVJ
    ΫοΫύουגࣜձࣾ
    ΠϯϑϥετϥΫνϟʔ෦௕
    ೖࣾ೥໨

    View full-size slide

  3. େલఏ
    • ࣄۀ͸มԽ͢Δ
    • ૊৫͸มԽ͢Δ
    • ϓϩμΫτ΍ίʔυʹ͸ण໋͕͋Δ
    • ։ൃϦιʔε͸༗ݶͰ͋Δ

    View full-size slide

  4. ࠓ೔ͷςʔϚ
    • ݶΒΕͨϦιʔεͰɺͲ͏΍ͬͯ

    ૊৫΍ࣄۀͷมԽʹڧ͍։ൃΛߦ͏͔
    • ௕ण໋Խͨ͠ΞϓϦέʔγϣϯͱ

    Ͳ͏޲͖߹͍͔ͬͯ͘

    View full-size slide

  5. ʮΫοΫύουʯ͸
    ͍͔ͭΒ͋Δͷʁ

    View full-size slide

  6. IUUQTJOGPDPPLQBEDPNDPSQPSBUFIJTUPSZ

    View full-size slide

  7. IUUQTXFCBSDIJWFPSHXFCIUUQXXXDPPLQBEDPN

    View full-size slide

  8. IUUQTJOGPDPPLQBEDPNDPSQPSBUFIJTUPSZ

    View full-size slide


  9. $PME'VTJPO3BJMT

    View full-size slide

  10. IUUQTJOGPDPPLQBEDPNDPSQPSBUFIJTUPSZ

    View full-size slide

  11. IUUQTTQFBLFSEFDLDPNB@NBUTVEBUIFSFDJQFGPSUIFXPSMETMBSHFTUSBJMTNPOPMJUI

    View full-size slide

  12. ߃ྫͷSBLFTUBUT ൛

    +----------------------+-------+-------+---------+---------+-----+-------+
    | Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
    +----------------------+-------+-------+---------+---------+-----+-------+
    | Controllers | 53487 | 43106 | 578 | 4326 | 7 | 7 |
    | Helpers | 16467 | 13482 | 19 | 1544 | 81 | 6 |
    | Models |109238 | 86118 | 1938 | 9700 | 5 | 6 |
    | Mailers | 2259 | 1821 | 47 | 209 | 4 | 6 |
    | Workers | 797 | 678 | 23 | 38 | 1 | 15 |
    | Chanko units | 12737 | 10967 | 20 | 373 | 18 | 27 |
    | Libraries | 52295 | 43235 | 649 | 3954 | 6 | 8 |
    | Feature specs | 56569 | 45583 | 0 | 192 | 0 | 235 |
    | Request specs | 46276 | 39906 | 0 | 18 | 0 | 2215 |
    | Routing specs | 614 | 495 | 0 | 0 | 0 | 0 |
    | Controller specs | 64188 | 53000 | 6 | 128 | 21 | 412 |
    | Helper specs | 84918 | 70300 | 3 | 71 | 23 | 988 |
    | Model specs |163524 |135337 | 5 | 130 | 26 | 1039 |
    | Worker specs | 1156 | 959 | 0 | 1 | 0 | 957 |
    | Chanko unit specs | 9214 | 7596 | 0 | 11 | 0 | 688 |
    | Library specs | 26054 | 21809 | 25 | 125 | 5 | 172 |
    +----------------------+-------+-------+---------+---------+-----+-------+
    | Total |699793 |574392 | 3313 | 20820 | 6 | 25 |
    +----------------------+-------+-------+---------+---------+-----+-------+
    Code LOC: 199407 Test LOC: 374985 Code to Test Ratio: 1:1.9

    View full-size slide

  13. Ͱ͔͍ͱԿ͕ى͜Δͷ͔
    ىಈʹ͕͔͔࣌ؒΔ
    ςετʹ͕͔͔࣌ؒΔ
    ੩తղੳܥπʔϧ͕ಈ͔ͳ͍
    ϥΠϒϥϦ͕ಈ͔ͳ͍
    σϓϩΠ͕େม
    Ϩʔϧʹ৐Εͳ͍

    View full-size slide

  14. ίʔυ΍؀ڥͷ࿝ٺԽ

    View full-size slide

  15. ͳͥਓ͸
    શ෦ॻ͖௚ͨ͘͠
    ͳΔͷ͔

    View full-size slide


  16. શϦχϡʔΞϧܭը

    View full-size slide

  17. ϦχϡʔΞϧܭը
    • ΤϯδχΞ10ਓ͘Β͍
    • ίʔυ͕ڊେɾෳࡶ͗ͯ͢ɺ৽ػೳͷ࣮૷͕ࠔ೉
    • ͦ΋ͦ΋ࠓͷαʔϏε͸͜ΕͰ͍͍ͷͩΖ͏͔ʁ
    • ίʔυ΋αʔϏε΋ཧ૝తͳঢ়ଶʹͨ͠ɺ

    Զͨͪͷߟ͑ͨ࠷ߴͷΫοΫύουʹ͠Α͏
    w Α͠ϑϧεΫϥονͰॻͧ͘

    View full-size slide

  18. ϦχϡʔΞϧେࣦഊ

    View full-size slide

  19. Կ͕ىͬͨ͜ͷ͔
    ʮαʔϏεͷίΞόϦϡʔΛநग़͢Δʯ
    ʮ៉ྷͳίʔυͰΠν͔Βॻ͖௚͢ʯ
    ͷ྆ํΛಉ࣌ʹ΍Ζ͏ͱͨ͠
    ˠ͍ͭ·Ͱܦͬͯ΋࣮૷͕ऴΘΒͳ͍

    View full-size slide

  20. ࢓༷ͷ੔ཧͱ
    ϦϑΝΫλϦϯάΛ
    ಉ࣌ʹ΍Βͳ͍ํ͕͍͍
    ֶͼ

    View full-size slide

  21. ख஗Εʹͳ͔ͬͯΒ
    ΍Βͳ͍
    ֶͼ

    View full-size slide

  22. ೥ͷ3BJMTҠߦ͸

    ͳͥ͏·͍ͬͨ͘ͷ͔
    ΤϯδχΞ5ਓ
    Rails ʹৄ͍ࣾ͠һ 0ਓ
    ͦΕ΄Ͳ೔ຊͰྲྀߦͬͯͳ͍

    View full-size slide

  23. ౰࣌ͷؔ܎ऀͷূݴ
    • αʔϏεͷػೳ͕·ͩগͳ͔ͬͨ
    • ͢Ͱʹ΅Ζ΅Ζ͔ͩͬͨΒɺ

    ͦΕҎ্ࣦഊ͠Α͏͕ͳ͔ͬͨ
    • ͦ΋ͦ΋ͦΜͳʹ੒ޭ͍ͯ͠ͳ͔ͬͨ
    • ʢҠߦ͸͕ͨ͠ɺ౰ॳ͔ͳΓෆ҆ఆͩͬͨʣ
    • ए͔ͬͨ

    View full-size slide

  24. Ͱ͸Ͳ͏͢Ε͹͍͍ͷ͔

    View full-size slide

  25. ຊ౰ʹཉ͍͠΋ͷ͸

    Կͩͬͨͷ͔ʁ

    View full-size slide

  26. ͳͥॻ͖௚͔ͨͬͨ͠ͷ͔
    • αʔϏεͷܧଓతͳվળ͕͔ͨͬͨ͠
    • ṖͷෳࡶͳϨΨγʔίʔυ͕ଟ͗ͯ͢

    ػೳͷվળ΍௥Ճ͕ࠔ೉

    View full-size slide

  27. ϨΨγʔίʔυΛ

    શ෦ॻ͖௚͞ͳͯ͘΋

    ։ൃ଎౓Λམͱͣ͞

    ܧଓతͳվળ͕Ͱ͖ΔΑ͏ʹ
    ͢Ε͹͍͍ͷͰ͸

    View full-size slide

  28. ϦχϡʔΞϧࣦഊ͕ੜΈग़ͨ͠
    $IBOLP

    View full-size slide

  29. $IBOLP
    ຊ൪؀ڥͰͷτϥΠ&ΤϥʔΛࢧԉ͢Δ Rails ༻ gem
    Unit ͱ͍͏୯ҐͰطଘίʔυ΁ͷύονΛهड़
    IUUQTHJUIVCDPNDPPLQBEDIBOLP

    View full-size slide

  30. " #
    طଘͷίʔυ A ΛɺελοϑϢʔβͷΈʹରͯ͠
    ϕʔλ൛ͷίʔυ B ʹஔ͖׵͍͑ͨ
    ͨͩ͠ɺB ͸๯ݥతͳ࣮૷ͳͷͰɺྫ֎͕ൃੜ͢Δ͔΋͠Εͳ͍
    طଘͷ$POUSPMMFSͷίʔυ ϕʔλ൛ͷίʔυ

    View full-size slide

  31. ελοϑͳΒ#
    #Ͱྫ֎͕ى͖ͨΒ"
    ελοϑҎ֎ͳΒ"
    ϑϥάͰ෼ذ͍ͤͯ͘͞ͱίʔυ͕ԚΕ͍ͯ͘

    View full-size slide

  32. ϕʔλػೳͷ6OJU
    طଘͷ$POUSPMMFSͷίʔυ
    "
    #

    Chanko Ͱ͸ɺUnit ͱ͍͏ϑΝΠϧʹϕʔλػೳͷϩδοΫΛهड़͢Δ
    invoke ৚݅Λຬͨͨ͠৔߹ʹɺطଘϩδοΫ (A) ͷ୅ΘΓʹ Unit (B) ͕࣮ߦ͞ΕΔ
    B ͕ྫ֎Λىͨ͜͠৔߹͸ɺݩͷ A ͕࣮ߦ͞ΕΔͨΊɺϢʔβʹ͸Τϥʔ͕ฦΒͳ͍
    JOWPLF৚݅

    View full-size slide

  33. ແࣄʹՁ஋͕ೝΊΒΕͨΒ
    ຊ൪ͷ඼࣭ͷίʔυʹ࢓্͛Δ
    طଘίʔυΛॻ͖׵͑ɺUnit ϑΝΠϧΛফ͢

    ʢ௨শ Un-chankoʣ

    View full-size slide

  34. d
    ଟαʔϏε࣌୅

    View full-size slide

  35. ΫοΫύου

    ຊମίʔυ
    ผϓϩδΣΫτ
    3BJMT

    View full-size slide

  36. ϓϩδΣΫτͷ෼͔Εํ
    • ࠷ॳ͔ΒผϓϩδΣΫτͱͯ͠࡞ΒΕɺ
    ޙ͔Βຊମͱ࿈ܞͨ͠ύλʔϯ
    • ࠷ॳ͸ຊମͷҰ෦ͱͯ͠࡞ΒΕɺ

    ޙ͔Β෼཭ͨ͠ύλʔϯ

    View full-size slide

  37. 8PSME`TMBSHFTU
    SBJMTNPOPMJUI
    Λ୤٫͍ͨ͠

    View full-size slide

  38. ϓϩδΣΫτ෼ׂํ਑
    • ৽نαʔϏεΛ࡞Δͱ͖
    • ຊମͱີ݁߹ͤ͟ΔΛಘͳ͍΋ͷ͸ຊମͰ࣮૷
    • ͦ͏Ͱͳ͍΋ͷ͸࠷ॳ͔ΒผϓϩδΣΫτͰ
    • طଘαʔϏε
    • ෼ׂՄೳͳ΋ͷ͸ॱ࣍෼ׂ͍ͯ͘͠

    View full-size slide

  39. ʙ
    αʔϏεͷ෼ׂ

    View full-size slide

  40. IUUQUFDIMJGFDPPLQBEDPNFOUSZ
    ͱͯ΋͍͍هࣄɺ͓͢͢Ί

    View full-size slide

  41. ʮຊ౰͸Կ͕͍ͨ͠ͷ͔ʯΛݟۃΊΔ
    • γϯϓϧͳ࡞Γʹม͍͑ͨ
    • ෆཁͳίʔυ͕ॏͳΓɺಈ࡞͕஗͘ͳͬ
    ͍ͯΔͱ͜ΖΛղফ͍ͨ͠
    • ৽͍͠ϥΠϒϥϦɺ৽͍ٕ͠ज़ΛऔΓ
    ࠐΊΔΑ͏ʹ͍ͨ͠

    View full-size slide

  42. େࣄͳ͜ͱ
    Ұͭͣͭ΍Δ

    View full-size slide

  43. ೋஈ֊ͷΞϓϦέʔγϣϯ෼཭
    1.ΫοΫύουຊମΛ fork ͠ɺෆཁ෦෼
    Λૈํফͯ͠ςετΛ௨͢
    2.rails new ͨ͠৽نϓϩδΣΫτʹ

    ࣸܦͯ͠ςετΛ௨͢

    View full-size slide

  44. ຊମίʔυΛGPSL
    ෆཁͳ෦෼Λૈํ࡟আ
    ςετΛ௨͢
    ୈஈ֊

    View full-size slide

  45. ͜ͷ࣌఺Ͱ͸
    • ʮ͓͍͍݈͠߁ʯ͚ͩͷςετ࣮ߦɺ

    σϓϩΠ͕Մೳʹͳͬͨ
    • ͜Ε͚ͩͰ΋े෼ࣄۀతͳԸܙ͕͋Δ
    • ফ͖͠Εͳ͔ͬͨґଘϥΠϒϥϦɺ

    ϞϯΩʔύον౳͕ଟ਺࢒͍ͬͯΔঢ়ଶ
    • ςετ࣮ߦ͕஗͔ͬͨΓɺϨʔϧ͔Β

    ͸ͣΕͨΓ͍ͯ͠Δͷ͕໰୊

    View full-size slide

  46. SBJMTOFXͨ͠৽نίʔυϕʔεʹ
    ϩδοΫΛҠ২͍͖ͯ͠ɺ
    طଘͷςετ͕௨Δ͜ͱΛ໨ࢦ͢
    ୈஈ֊

    View full-size slide

  47. ஫ҙ఺
    • ϩδοΫ͸Ҡಈ͢Δ͚ͩ
    • ϦϑΝΫλϦϯάͨ͘͠ͳͬͯ΋

    զຫ͢Δ
    • ςετΛ௨աͤ͞Δ͜ͱʹूத

    View full-size slide

  48. ʮ͓͍͍݈͠߁ʯ෼཭੒ޭ͔Βͷֶͼ
    • ϑϧεΫϥονͰॻ͖௚͞ͳ͔ͬͨ
    • ࢓༷มߋ΍ϦϑΝΫλϦϯάΛߦΘͣɺ
    ෼཭͚ͩΛߦͬͨ
    • খن໛ʹগͣͭ͠ਐΊ͍ͯ͘͜ͱͰɺ
    ͦΕͧΕͷஈ֊ͰࣄۀతͳϝϦοτΛ
    ڗडͰ͖ͨ

    View full-size slide

  49. ෼཭ʹΑΔԸܙ
    • ΫοΫύουຊମ
    • ࣄۀͻͱͭ෼ίʔυ͕খ͘͞ͳͬͨ
    • ͓͍͍݈͠߁
    • Ϩʔϧʹ৐ͬͨී௨ͷ

    Rails ΞϓϦέʔγϣϯʹͳΕͨ
    • ܰྔͰϞμϯͳ։ൃ؀ڥʹͳͬͨ

    View full-size slide

  50. ίʔυ඼࣭

    View full-size slide

  51. ίʔυ඼࣭͸Ϗδωεʹ
    Өڹ͢Δ͔ʁ

    View full-size slide

  52. ΫοΫύουͷ౴͑
    :&4

    View full-size slide

  53. ίʔυͷ඼࣭
    • Մಡੑ
    • ϝϯςφϯεੑ
    • όάͷ༗ແ
    • ηΩϡϦςΟ

    View full-size slide

  54. ίʔυͷ඼࣭͕Өڹ͢Δ΋ͷ
    • ։ൃޮ཰
    • ଐਓੑ
    wίʔυͷण໋

    View full-size slide

  55. Ͳ͜·Ͱ΍Δ΂͖͔ʁ
    ΍Γ͗͢ͳ͍
    ʮ៉ྷͳίʔυʯΛॻ͘͜ͱࣗମ͕໨తͰ͸ͳ͍
    ࣄۀϑΣʔζʹͱͬͯඞཁͳ඼࣭·ͰΛ໨ࢦ͢

    View full-size slide

  56. ίʔυϨϏϡʔ
    • ࣭ͷߴ͍ίʔυϨϏϡʔ͕ίʔυ඼࣭
    Λ͋Δఔ౓୲อ͢Δ
    • ෛͷҨ࢈Λ࢒͠ʹ͘͘ͳΔ

    View full-size slide

  57. ίʔυϨϏϡʔΞϯνύλʔϯ
    • ࠣࡉͳจ๏ͷ޷ΈͰᎍΊΔ
    • ΠϯσϯτɺׅހͳͲ
    • ͱʹ͔͘ෆໟ

    View full-size slide

  58. ίʔυن໿͕͋Δͱ
    ίʔυϨϏϡʔͷޮ཰͕
    ྑ͘ͳΔ
    ֶͼ

    View full-size slide

  59. IUUQTHJUIVCDPNDPPLQBETUZMFHVJEF

    View full-size slide

  60. ಛ௃
    ͦΜͳΜͲͬͪͰ΋͍͍ͩΖͱ
    ͍͏ͷ΋݁ߏܾΊͯΔ

    View full-size slide

  61. ೥͘Β͍ӡ༻ͯ͠Έͯ
    • ࠷ॳ͸൓ରҙݟ΋ଟ͔ͬͨʢ๻΋ʣ
    • ϏδωεͷίʔυϨϏϡʔͳͷʹจ๏
    ͷ͠ΐ͏΋ͳ͍࿦૪͕ల։͞ΕΔɺ

    Έ͍ͨͳͷΛݟ͔͚ͳ͘ͳͬͨ
    • จ๏ͷ࿦૪͸ελΠϧΨΠυͷํͰ

    ΍Ε͹Α͍
    • ͋ͬͯΑ͔ͬͨελΠϧΨΠυ

    View full-size slide

  62. Πϯϑϥͷ࿝ٺԽ

    View full-size slide


  63. &$$MBTTJD71$

    View full-size slide

  64. ೋ౓ͷʮશ୆࡞Γ௚͠ʯΛܦͯ
    • ໾ׂͷΑ͘Θ͔Βͳ͍

    Ṗͷαʔό͕౫ଡ͞Εͨ
    • શαʔό͕ Infra as Code Խ͞Εͨ
    • Ͳ͘͞͞Ͱ OS ΍֤छύοέʔδ͕
    ΞοϓσʔτͰ͖ͨ

    View full-size slide

  65. Πϯϑϥ࿝ٺԽ໰୊
    • ͢Ͱʹଘࡏ͠ͳ͍αʔόͷ Puppet
    • OS ΍ϛυϧ΢ΣΞ͕ݹ͍··
    • ؀ڥ͕ݹͯ͘ੈ͔ؒΒִ཭͞ΕΔ

    View full-size slide

  66. Πϯϑϥ࿝ٺԽͷಛ௃
    • ಈ͍͍ͯ͑͞Ε͹ɺΞϓϦέʔγϣϯ
    ίʔυ΄Ͳ͸࿝ٺԽ͕໰୊ʹ

    ͳΓʹ͍͘
    • େ෯ͳόʔδϣϯΞοϓ͸େม͔ͭ࣌
    ͕͔͔ؒΔͷͰɺඞཁʹͳ͔ͬͯΒ

    ಈ͖࢝ΊΔͷͰ͸஗͍

    View full-size slide

  67. ࣜ೥ભٶ
    IUUQTKBXJLJQFEJBPSHXJLJਆٶࣜ೥ભٶ

    View full-size slide

  68. ࣜ೥ભٶ
    ਆٶࣜ೥ભٶ͸ɺਆٶʢҏ੎ਆٶʣʹ͓͍ͯߦΘΕΔࣜ೥ભ
    ٶʢఆظతʹߦΘΕΔભٶʣͰ͋Δɻ
    ਆٶͰ͸ɺݪଇͱͯ͠20೥͝ͱʹɺ಺ٶʢߖେਆٶʣɾ֎ٶ
    ʢ๛डେਆٶʣͷೋͭͷਖ਼ٶͷਖ਼఼ɺ14ͷผٶͷશͯͷ఼ࣾ
    Λ଄Γସ͑ͯਆ࠲Λભ͢ɻ
    IUUQTKBXJLJQFEJBPSHXJLJਆٶࣜ೥ભٶ

    View full-size slide

  69. ࣜ೥ભٶͷ͕͍͜͜͢͝
    • ଱༻೥਺ͷ୹͍ݐஙํࣜͳͷʹ

    ҏ੎ਆٶ͸͓Αͦ1300೥ଘࡏ͍ͯ͠Δ
    • 7ੈلͷ໻ੜݐஙͷٕज़͕ݱ໾Ͱ

    ఻ঝ͞Ε͍ͯΔ
    • ભٶͷ༻ࡐͱͳΔ໦ΛҭͯΔͷʹ

    200೥Ҏ্͔͔Δ

    View full-size slide

  70. ࡞Γ௚͢͜ͱΛ

    લఏʹ͢Δ͜ͱͰ

    ௕ण໋Խ
    ֶͼ

    View full-size slide

  71. *OGSB*OGSB
    • CentOS 6.2 -> Ubuntu 14.04 (16.04)
    • Puppet -> Itamae
    • VPCωοτϫʔΫͷ࠶ઃܭ
    • ֤छύοέʔδɺϛυϧ΢ΣΞͷ

    όʔδϣϯΞοϓ
    • ͦͷଞϨΨγʔͷ࡮৽

    View full-size slide

  72. Πϯϑϥࣜ೥ભٶ
    • ৽͘͠࡞Δαʔό͸ infra2 Ͱ

    ϓϩϏδϣχϯά͢Δ
    • طଘͷαʔό΋গͣͭ͠ infra2 Ͱ

    ࡞Γ௚͍ͯ͘͠

    View full-size slide

  73. େલఏʢ࠶ʣ
    • ࣄۀ͸มԽ͢Δ
    • ૊৫͸มԽ͢Δ
    • ϓϩμΫτ΍ίʔυʹ͸ण໋͕͋Δ
    • ։ൃϦιʔε͸༗ݶͰ͋Δ

    View full-size slide

  74. ௕ੜ͖͢ΔࣄۀͷͨΊʹ

    ٕज़͕Ͱ͖Δ͜ͱ
    • ඼࣭΍৽͠͞Λอͭ͜ͱࣗମΛ

    ࢓૊ΈԽ͢Δ
    • ख஗ΕʹͳΔલʹগͣͭ͠΍Δ
    • ࡉ͔͘੒ޭମݧΛ࡞ΓɺΞοϓσʔτ
    ͷՁ஋Λ૊৫ʹ࣮ײͤ͞Δ

    View full-size slide