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

Serverspec and OSS at IEICE Society Conference 2018

Serverspec and OSS at IEICE Society Conference 2018

Gosuke Miyashita

September 11, 2018
Tweet

More Decks by Gosuke Miyashita

Other Decks in Technology

Transcript

  1. ӡ༻؅ཧOSS
    Serverspecͷެ։ͱ
    ͦͷӨڹ
    2018೥ిࢠ৘ใ௨৴ֶձιαΠΤςΟେձ اըߨԋηογϣϯBI-7 ʮγεςϜӡ༻؅ཧOSS ͷ։ൃͱެ։ʯ 1

    View full-size slide

  2. ΞδΣϯμ
    • Serverspecͷ֓ཁ
    • Serverspec͕ੜ·Εͨഎܠ
    • ͳͥOSSͱͯ͠ެ։ͨ͠ͷ͔
    • Serverspec͕΋ͨΒͨ͠Өڹ
    2018೥ిࢠ৘ใ௨৴ֶձιαΠΤςΟେձ اըߨԋηογϣϯBI-7 ʮγεςϜӡ༻؅ཧOSS ͷ։ൃͱެ։ʯ 2

    View full-size slide

  3. ࣗݾ঺հ
    • ٶԼ ߶ี
    • ߹ಉձࣾServerspec Operations୅ද
    • ϑϦʔϥϯε5೥໨
    • ओʹαʔόʔ/Πϯϑϥํ໘Λಘҙͱ͢Διϑτ΢ΣΞΤϯδχΞ
    • OSSϏδωε͸ͯ͠ͳ͍͚ͲOSSͰ൧Λ৯ͬͯ࠺ͱ5ਓͷࢠͲ΋
    Λཆͬͯ·͢
    2018೥ిࢠ৘ใ௨৴ֶձιαΠΤςΟେձ اըߨԋηογϣϯBI-7 ʮγεςϜӡ༻؅ཧOSS ͷ։ൃͱެ։ʯ 3

    View full-size slide

  4. Serverspecͷ֓ཁ
    2018೥ిࢠ৘ใ௨৴ֶձιαΠΤςΟେձ اըߨԋηογϣϯBI-7 ʮγεςϜӡ༻؅ཧOSS ͷ։ൃͱެ։ʯ 4

    View full-size slide

  5. 2018೥ిࢠ৘ใ௨৴ֶձιαΠΤςΟେձ اըߨԋηογϣϯBI-7 ʮγεςϜӡ༻؅ཧOSS ͷ։ൃͱެ։ʯ 5

    View full-size slide

  6. Serverspecͱ͸
    • αʔόͷঢ়ଶΛίʔυʹΑΓࣗಈతʹςετ͢ΔͨΊͷπʔ
    ϧ
    • Ruby੡ͷςετϑϨʔϜϫʔΫͰ͋ΔRSpec͕ϕʔε
    • RSpecͷه๏Λ༻͍ͯςετίʔυΛهड़
    • Server+RSpec=Serverspec
    2018೥ిࢠ৘ใ௨৴ֶձιαΠΤςΟେձ اըߨԋηογϣϯBI-7 ʮγεςϜӡ༻؅ཧOSS ͷ։ൃͱެ։ʯ 6

    View full-size slide

  7. Serverspecͷίʔυྫ
    describe package('nginx') do
    it { should be_installed }
    end
    describe service('nginx') do
    it { should be_enabled }
    it { should be_running }
    end
    2018೥ిࢠ৘ใ௨৴ֶձιαΠΤςΟେձ اըߨԋηογϣϯBI-7 ʮγεςϜӡ༻؅ཧOSS ͷ։ൃͱެ։ʯ 7

    View full-size slide

  8. Serverspecͷཪଆ
    • ςετର৅ͷαʔό಺ͰUNIXίϚϯυ΍PowerShellίϚϯυ
    Λ࣮ߦ
    • OSຖͷίϚϯυͷҧ͍͸Serverspec͕ٵऩ
    • ϩʔΧϧͰ௚઀ɺSSHܦ༝ɺWinRMܦ༝ɺDocker APIܦ༝ͳ
    Ͳબ΂Δ
    2018೥ిࢠ৘ใ௨৴ֶձιαΠΤςΟେձ اըߨԋηογϣϯBI-7 ʮγεςϜӡ༻؅ཧOSS ͷ։ൃͱެ։ʯ 8

    View full-size slide

  9. Serverspecͷ࣮ߦྫ
    $ rake spec
    Package "nginx"
    should be installed
    Finished in 3.11 seconds
    1 example, 0 failures
    2018೥ిࢠ৘ใ௨৴ֶձιαΠΤςΟେձ اըߨԋηογϣϯBI-7 ʮγεςϜӡ༻؅ཧOSS ͷ։ൃͱެ։ʯ 9

    View full-size slide

  10. Serverspecͷ࣮ߦྫ
    $ rake spec
    Package "nginx"
    should be installed (FAILED - 1)
    Failures:
    1) Package "nginx" should be installed
    Failure/Error: it { should be_installed }
    sudo rpm -q nginx
    package nginx is not installed
    expected Package "nginx" to be installed
    # ./spec/app/nginx_spec.rb:4:in `block (2 levels) in '
    Finished in 3.16 seconds
    1 example, 1 failure
    2018೥ిࢠ৘ใ௨৴ֶձιαΠΤςΟେձ اըߨԋηογϣϯBI-7 ʮγεςϜӡ༻؅ཧOSS ͷ։ൃͱެ։ʯ 10

    View full-size slide

  11. Serverspec͕
    ੜ·Εͨഎܠ
    2018೥ిࢠ৘ใ௨৴ֶձιαΠΤςΟେձ اըߨԋηογϣϯBI-7 ʮγεςϜӡ༻؅ཧOSS ͷ։ൃͱެ։ʯ 11

    View full-size slide

  12. Serverspec͕ੜ·Εͨഎܠ
    • 2006೥ɺ౰࣌ͷ৬৔ͰखಈͩͬͨαʔόߏஙΛࣗಈԽ͢Δͨ
    ΊʹPuppetΛ࢖͍࢝Ίͨ
    • ߏங͸ࣗಈԽͰ͖͕ͨɺςετ͸खಈ
    • ExcelνΣοΫγʔτΛࢴʹҹ࡮
    • खಈʹΑΔίϚϯυ࣮ߦͱ໨ࢹ֬ೝ݁ՌΛهೖ
    2018೥ిࢠ৘ใ௨৴ֶձιαΠΤςΟେձ اըߨԋηογϣϯBI-7 ʮγεςϜӡ༻؅ཧOSS ͷ։ൃͱެ։ʯ 12

    View full-size slide

  13. Serverspec͕ੜ·Εͨഎܠ
    • ͦͷޙPuppetΛ࢖͍ଓ͚͍ͯͨ
    • 6,7೥࢖͍ͬͯͯɺPuppetͷίʔυ͕ϨΨγʔίʔυԽ
    • PuppetίʔυͷϦϑΝΫλϦϯά͕͍ͨ͠
    • ϦϑΝΫλϦϯά͢ΔͳΒςετπʔϧ͕ඞཁ
    • ServerspecΛ։ൃͨ͠
    2018೥ిࢠ৘ใ௨৴ֶձιαΠΤςΟେձ اըߨԋηογϣϯBI-7 ʮγεςϜӡ༻؅ཧOSS ͷ։ൃͱެ։ʯ 13

    View full-size slide

  14. ͳͥServerspecΛ
    OSSͱͯ͠ެ։ͨ͠ͷ͔
    2018೥ిࢠ৘ใ௨৴ֶձιαΠΤςΟେձ اըߨԋηογϣϯBI-7 ʮγεςϜӡ༻؅ཧOSS ͷ։ൃͱެ։ʯ 14

    View full-size slide

  15. OSSΛެ։͢Δͱ͍͏͜ͱ
    • ʮOSS׆ಈʯʹର͢ΔΠϝʔδ͸ʁ
    • ಛผͳߦҝʁ
    • ϋʔυϧ͕ߴ͍ʁ
    • ੈͷதʹର͢Δߩݙʁ
    • ٕज़ྗ͕ͳ͍ͱͰ͖ͳ͍ʁ
    • ͔ͭͯࣗ෼͸ͦ͏ࢥͬͯ·ͨ͠
    2018೥ిࢠ৘ใ௨৴ֶձιαΠΤςΟେձ اըߨԋηογϣϯBI-7 ʮγεςϜӡ༻؅ཧOSS ͷ։ൃͱެ։ʯ 15

    View full-size slide

  16. OSS׆ಈΛ͢ΔΑ͏ʹͳͬͨܦҢ
    • ؆୯ͳίʔυΛެ։͢Δ(BlosxomϓϥάΠϯ)
    • ར༻͍ͯ͠ΔOSSʹύονΛૹΔ
    • ໘നͦ͏ͳOSSϓϩδΣΫτʹࢀՃ͢Δ(Plagger)
    • ָ͍͠ͷͰ͞ΒʹOSS׆ಈ͢Δ
    • OSSʹର͢Δಛผͳҙࣝ͸ബΕ͍ͯͬͨ
    2018೥ిࢠ৘ใ௨৴ֶձιαΠΤςΟେձ اըߨԋηογϣϯBI-7 ʮγεςϜӡ༻؅ཧOSS ͷ։ൃͱެ։ʯ 16

    View full-size slide

  17. Ϗδωεʹ͓͚ΔOSS؀ڥͷมԽ
    • 97೥ SIerʹೖࣾ
    • 98೥ Open Source Initiativeઃཱ/Netscape NavigatorͷOSSԽ
    • Netscape੡඼୲౰ΤϯδχΞͩͬͨͷͰ࢓ࣄʹ΋Өڹ͕͋ͬͨ
    • ͦͷޙϓϩϓϥΠΤλϦͳ੡඼ʹApache͕ಉࠝ͞ΕΔɺLinux୲౰ͷ
    ෦ॺ͕Ͱ͖ΔͳͲɺOSSͷӨڹ͕ࣗ෼͕ॴଐ͢ΔձࣾʹٴΜͰ͖ͨ
    • झຯͷOSS͕࢓ࣄʹ΋໾ཱͭΑ͏ʹ
    2018೥ిࢠ৘ใ௨৴ֶձιαΠΤςΟେձ اըߨԋηογϣϯBI-7 ʮγεςϜӡ༻؅ཧOSS ͷ։ൃͱެ։ʯ 17

    View full-size slide

  18. OSSΛެ։͢Δͱ͍͏͜ͱ
    • ެ։͢Δ͜ͱͰ৭ʑͳ΋ͷ͕ಘΒΕΔ
    • ٕज़తͳϑΟʔυόοΫɺশࢍɺਓ຺ɺָ͠͞
    • ഓٕͬͨज़͕࢓ࣄʹ΋໾ཱͭ
    • ͜Ε͸OSS׆ಈ͚ͩͰ͸ͳ͘ɺ৘ใΛΦʔϓϯʹ͢Δ͜ͱશൠʹݴ͑Δ
    • OSSΛެ։͢Δͱ͍͏ߦҝ͸ɺ৘ใΛΦʔϓϯʹ͠ɺͦΕʹΑͬͯԿΒ͔ͷϝϦο
    τΛಘΔɺͱ͍͏ߦҝͷҰ؀
    • OSS׆ಈ͸ɺϒϩάΛॻ͍ͨΓSNSʹ౤ߘͨ͠Γɺͱ͍͏ߦҝͱԿΒࠩ͸ͳ͍
    • Serverspecͷެ։΋͜͏ͨ͠ߦҝͷҰ؀
    2018೥ిࢠ৘ใ௨৴ֶձιαΠΤςΟେձ اըߨԋηογϣϯBI-7 ʮγεςϜӡ༻؅ཧOSS ͷ։ൃͱެ։ʯ 18

    View full-size slide

  19. Serverspec͕
    ΋ͨΒͨ͠Өڹ
    2018೥ిࢠ৘ใ௨৴ֶձιαΠΤςΟେձ اըߨԋηογϣϯBI-7 ʮγεςϜӡ༻؅ཧOSS ͷ։ൃͱެ։ʯ 19

    View full-size slide

  20. Ϗδωε΁ͷӨڹʢॴଐձࣾʣ
    • ձࣾһͩͬͨ͜Ζʹɺ࢓ࣄʹ໾ཱͯΔͨΊʹͭͬͨ͘
    • Serverspecͦͷ΋ͷͰ௚઀తͳϏδωε͸͍ͯ͠ͳ͍
    • ϏδωεΛࢧ͑Δπʔϧͱͯ͠׆༻
    • มߋʹڧ͔ͭ҆͘ఆͨ͠γεςϜΛ࣮ݱ͢ΔͨΊͷҰखஈ
    • ձࣾͷٕज़ϓϨθϯε޲্
    • ΤϯδχΞ࠾༻ʹ໾ཱͯΔ
    2018೥ిࢠ৘ใ௨৴ֶձιαΠΤςΟେձ اըߨԋηογϣϯBI-7 ʮγεςϜӡ༻؅ཧOSS ͷ։ൃͱެ։ʯ 20

    View full-size slide

  21. Ϗδωε΁ͷӨڹʢଞࣾʣ
    • ϏδωεΛࢧ͑Δπʔͱͯ͠׆༻
    • DevOps/Infrastructur as Codeͷ࣮ݱ
    • ServerspecΛ׆༻ͨ͠Ϗδωε
    • TISגࣜձࣾ͞ΜͷʮSHIFT wareʯ
    • CTCͷʮOpen Cloud Packageʯ
    2018೥ిࢠ৘ใ௨৴ֶձιαΠΤςΟେձ اըߨԋηογϣϯBI-7 ʮγεςϜӡ༻؅ཧOSS ͷ։ൃͱެ։ʯ 21

    View full-size slide

  22. OSSίϛϡχςΟ΁ͷӨڹ
    • ೿ੜOSSͷ஀ੜ
    • ServerspecͷίΞϥΠϒϥϦͰ͋ΔSpecinfraΛར༻ͨ͠
    OSS
    • Itamae/ServeKit/(MItamae)
    • Serverspecͱಛఆͷπʔϧͷ਌࿨ੑΛߴΊΔOSS
    • Dockerspec, Ansiblespec
    2018೥ిࢠ৘ใ௨৴ֶձιαΠΤςΟେձ اըߨԋηογϣϯBI-7 ʮγεςϜӡ༻؅ཧOSS ͷ։ൃͱެ։ʯ 22

    View full-size slide

  23. OSSίϛϡχςΟ΁ͷӨڹʢ͖ͭͮʣ
    • ྨࣅOSS
    • Goss, Testinfra, InSpecͳͲ
    • Serverspecʹண૝ΛಘͨOSS
    • awspec
    2018೥ిࢠ৘ใ௨৴ֶձιαΠΤςΟେձ اըߨԋηογϣϯBI-7 ʮγεςϜӡ༻؅ཧOSS ͷ։ൃͱެ։ʯ 23

    View full-size slide

  24. ࣗ਎΁ͷϙδςΟϒͳӨڹ
    • ༷ʑͳձࣾ΍ਓͱͷܨ͕Γ͕Ͱ͖ͨ
    • ࠓ·Ͱͱ͸ҧ͏ྖҬͷਓୡͱͷܨ͕Γ
    • ΦϥΠϦʔ͔ΒຊΛग़ͤͨ
    • ಠཱޙɺࠓͷͱ͜Ζॱௐʹ࢓ࣄ͕ಘΒΕ͍ͯΔ
    • ServerspecʹؔΘΔ࢓ࣄ͸͘͝Ұ෦Ͱ͋Δ͕
    2018೥ిࢠ৘ใ௨৴ֶձιαΠΤςΟେձ اըߨԋηογϣϯBI-7 ʮγεςϜӡ༻؅ཧOSS ͷ։ൃͱެ։ʯ 24

    View full-size slide

  25. ࣗ਎΁ͷωΨςΟϒͳӨڹ
    • শࢍ΋͋Ε͹൷൑΋͋Δ
    • Serverspecͷ৔߹͸ಛʹϝϯςφϯεϙϦγʔʹର͢Δ൷൑
    2018೥ిࢠ৘ใ௨৴ֶձιαΠΤςΟେձ اըߨԋηογϣϯBI-7 ʮγεςϜӡ༻؅ཧOSS ͷ։ൃͱެ։ʯ 25

    View full-size slide

  26. ͓ΘΓʹ
    • ݸਓͱͯ͠ͳͥOSS׆ಈΛ͢Δͷ͔Λड़΂ͨ
    • ࣗ෼ʹϝϦοτ͕͋ΔͷͰ΍͍ͬͯΔ
    • ϑΟʔυόοΫɺশࢍɺਓ຺ɺָ͠͞
    • Ϗδωεͱ͍͏΄ͲͰ͸ͳ͍͕൧͕৯͍͑ͯΔ
    • ૊৫ͱͯ͠ͷOSS׆ಈ͸Ϗδωε΍ίϛϡχςΟͱͷؔΘΓ
    ํ͕·ͨશવҧͬͯ͘Δ
    2018೥ిࢠ৘ใ௨৴ֶձιαΠΤςΟେձ اըߨԋηογϣϯBI-7 ʮγεςϜӡ༻؅ཧOSS ͷ։ൃͱެ։ʯ 26

    View full-size slide