$30 off During Our Annual Pro Sale. View Details »

サーバにログインしない・させないサービス運用 / AWS Summit 2015 Devcon

koid
June 03, 2015

サーバにログインしない・させないサービス運用 / AWS Summit 2015 Devcon

koid

June 03, 2015
Tweet

More Decks by koid

Other Decks in Technology

Transcript

  1. αʔόʹϩάΠϯ͠ͳ͍ɾͤ͞ͳ͍
    αʔϏεӡ༻
    ɹ
    גࣜձࣾ!Gunosyɹখग़!޾య

    View Slide

  2. ࣗݾ঺հ
    • খग़"޾య"/"@koid
    • גࣜձࣾGunosy"։ൃຊ෦
    • ޙํࢧԉܥΤϯδχΞ
    • ͨ·ʹόονॻ͍ͨΓͨ·ʹAPI௚ͨ͠Γ

    View Slide

  3. ͜Μʹͪ͸GunosyͰ͢

    View Slide

  4. Gunosyʹ͍ͭͯ
    • χϡʔεΩϡϨʔγϣϯΞϓϦ
    • 2011.09'ϝʔϧαʔϏεͱͯ͠։࢝
    • 2013.01'iOS൛ΞϓϦϦϦʔε
    • 2013.02'Android൛ΞϓϦϦϦʔε
    • ݱࡏ900ສDLಥഁ

    View Slide

  5. ΍͍ͬͯΔ͜ͱ
    • χϡʔε഑৴
    • ޿ࠂ഑৴
    • ΞυωοτϫʔΫ
    • ϓϥοτϑΥʔϜ

    View Slide

  6. ΤϯδχΞʹ͍ͭͯ
    • ݱࡏ26໊
    • ͓͓Αͦͷकඋൣғ
    σβΠϯ+ϑϩϯτΤϯυ:&3ਓ
    ΫϥΠΞϯτ+QA:&5ਓ
    Web+API:&5ਓ
    Ξυ:&5ਓ
    ਺஋ղੳ+ίϯςϯπ:&5ਓ
    Πϯϑϥ:&1ਓ
    ͦͷଞSMͬΆ͍ਓ

    View Slide

  7. GunosyͰΑ͘࢖͍ͬͯΔ΋ͷ
    • ։ൃݴޠ
    ɹ"#API:#Golang
    ɹ"#ύʔτφʔ༷/޿ࠂओ༷޲͚؅ཧը໘:#Rails
    ɹ"#όονɾ಺෦޲͚؅ཧը໘:#Django#or#ૉͷPython
    • ͦͷଞ
    ɹ"#όʔδϣϯ؅ཧ:#GitHub
    ɹ"#ߏ੒؅ཧ/σϓϩΠ:#Chef#(+AWS#OpsWorks)

    View Slide

  8. ։ൃͷಛ௃
    • খ͍͞୯ҐͰ࡞͙ࣺͬͯͯ͢Δ
    • ϚΠΫϩαʔϏεతͳ
    • ػೳ͕૿͑ա͗ͨΒ෼ׂ
    • ϝϯς͢ΔΑΓϦϓϨʔε

    View Slide

  9. ຊ୊ɿ
    ։ൃੜ࢈ੑΛ্͛ΔͨΊͷऔΓ૊Έ
    αʔό΁ͷෆཁͳϩάΠϯΛ΍ΊΑ͏

    View Slide

  10. ͔͜͜Βஏ͔͍ͣ͠࿩Λ͠·͢

    View Slide

  11. αʔόʹϩάΠϯ͞ΕͯࠔΔ͜ͱ
    ʢϩάΠϯࣗମ͕௚઀ѱ͍Θ͚Ͱ͸ͳ͍Ͱ͕͢…ʣ

    View Slide

  12. ৴པͰ͖ͳ͍ϏϧυɾσϓϩΠ
    • ։ൃऀͷखݩͰϏϧυ→Ξοϓϩʔυ
    • αʔόʹೖͬͯσϓϩΠεΫϦϓτ࣮ߦ
    • ͦΕͲ͜ͷஅ໘ͳΜ͚ͩͬʁ࠷৽ͷmasterͱஅ໘߹ͬͯΔʁ
    • ࠓϓϩμΫγϣϯʹ্͕͍ͬͯΔϞϊ͕৴༻Ͱ͖ͳ͍
    • ࠓεςʔδϯάʹ্͕͍ͬͯΔϞϊɺຊ౰ʹςετ͍ͨ͠அ
    ໘͚ͩͬʁ

    View Slide

  13. উखʹՃ͑ΒΕΔมߋ
    • উखʹ௥Ճ͞ΕΔύοέʔδ
    • αʔό௥Ճ/ϦϓϨʔε͠Α͏ͱͨ͠Βಈ͔ͳ͍
    • উखʹมߋ͞ΕΔcrontab
    • ίϝϯτΞ΢τͨ͠ͷ୭ʁͦͯ͠Կނʁ

    View Slide

  14. ฐࣾɺҎલ͔ΒChefΛ࢖͍ͬͯ·ͨ͠

    View Slide

  15. ʮαʔόͱϨγϐͷؒʹဃ཭͕͋Δʯ
    ʮϨγϐΛ௥ਵͤ͞Δඞཁ͕͋Δʯ

    View Slide

  16. ͑ͬ…

    View Slide

  17. ϩάΠϯͯ͠௚઀͍͡Δͷ͸΍Ί·͠ΐ͏
    ʢ੾࣮ʣ

    View Slide

  18. ΞϓϦέʔγϣϯͷσϓϩΠ͸
    ৴པͰ͖Δ΋ͷͰ͋Δඞཁ͕͋Δ

    View Slide

  19. ৴པͰ͖ͳ͍σϓϩΠ
    • ࣄނͷϦεΫ
    • ख໭Γͷൃੜ
    • ΤϯδχΞͷ࣌ؒతɾਫ਼ਆతෛ୲

    View Slide

  20. ܧଓతσϦόϦ
    • όʔδϣϯ؅ཧ
    • ܧଓతΠϯςάϨʔγϣϯ
    • ܧଓతσϓϩΠ

    View Slide

  21. ͔͠͠
    • όʔδϣϯ؅ཧπʔϧΛ࢖͑͹ྑ͍ͱ͍͏΋ͷͰ͸ͳ͍
    • CIπʔϧΛ࢖͑͹ྑ͍ͱ͍͏΋ͷͰ͸ͳ͍
    • σϓϩΠπʔϧΛ࢖͑͹ྑ͍ͱ͍͏΋ͷͰ͸ͳ͍
    શͯΛ౷߹ͨ͠Ұ࿈ͷϫʔΫϑϩʔΛ࡞Δ͜ͱ͕ॏཁ

    View Slide

  22. ৭ʑͳਏ͍ࢥ͍Λͯ͠ɺݱࡏ

    View Slide

  23. GitHubΛத৺ͱͨ͠։ൃɾσϓϩΠϑϩʔ
    • Service(HookΛར༻͠ɺ֤αʔϏεΛ࿈ܞ
    • GitHub
    • CircleCI
    • AWS(OpsWorks
    • GunosyͰͷOpsWorksͷར༻ʹ͍ͭͯ͸Լه
    • h;ps:/
    /speakerdeck.com/koid/yokuwakaruCawsCopsworks

    View Slide

  24. MergeϘλϯʹશͯΛूதͤ͞Δ

    View Slide

  25. ۩ମతʹ
    • ֤ϒϥϯνΛϚʔδ͢Δ౓ʹࣗಈͰϏϧυɾςετɾσϓϩΠ

    View Slide

  26. σϓϩΠ͚ͨ͠Ε͹Pull$RequestΛ࡞Δ

    View Slide

  27. ༨ஊʣOpsWorksͰ΋σϓϩΠཤྺ͕௥͑Δ

    View Slide

  28. ݁Ռ
    • Pull%Request%Driven%Deploy
    • શͯͷ৘ใ͕GitHubʹू໿
    • ݟ͑ΔԽɺϏϧυɾσϓϩΠͷޮ཰Խɺࣄނͷ࡟ݮ
    • ϫʔΫϑϩʔ͕Θ͔Γ΍͘͢ͳͬͨ

    View Slide

  29. ΑΓαʔόʹϩάΠϯ͠ͳ͍ͨΊʹ

    View Slide

  30. Ͳ͏ͯ͠΋͖ͭ΋ͷͳͷ͕ௐࠪ
    • ϛυϧ΢ΣΞϩάऩू
    • ΞϓϦέʔγϣϯϩάऩू
    αʔόʹϩάΠϯͯ͠ௐ΂·͔͢ʁ

    View Slide

  31. ϒϥ΢β͔ΒશͯͷαʔόͷϩάΛݟΒΕΔΑ͏ʹ
    • OS/ϛυϧ΢ΣΞϩάऩू
    • papertrail
    • ΞϓϦέʔγϣϯϩάऩू
    • airbrake.(errbit)
    • kibana

    View Slide

  32. αʔό΁ͷෆཁͳϩάΠϯ͸΍Ί·͠ΐ͏

    View Slide

  33. ͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠

    View Slide