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

Introduction of SQALE

SHIBATA Hiroshi
March 15, 2014
670

Introduction of SQALE

SHIBATA Hiroshi

March 15, 2014
Tweet

Transcript

  1. ! Introduction of SQALE ! Hiroshi SHIBATA @hsbt WIDE Camp

    Spring 2014
  2. self

  3. SHIBATA Hiroshi(@hsbt)

  4. Ruby Jenkins RailsGirls tDiary

  5. None
  6. None
  7. ຊࣾ ࢧࣾ

  8. None
  9. ϛυϧ΢ΣΞͷΞοϓάϨʔυ ࣾ಺։ൃج൫ͷߏங ౷ܭج൫ͷߏங +409ͷӡ༻੔උ HJUIVC ηΩϡϦςΟ؂ࠪ ίʔυϨϏϡʔ ςετج൫ͷߏங ΞΫηεղੳج൫ͷߏங ։ൃϓϩηε

    ৽ਓڭҭ ݪߘࣥච ΧϯϑΝϨϯεൃද 044։ൃ αʔόʔߏ੒؅ཧͷ࡮৽ ϦʔϯελʔτΞοϓ +FOLJOT 3VCZ3BJMT 3%#.4
  10. ϛυϧ΢ΣΞͷΞοϓάϨʔυ ࣾ಺։ൃج൫ͷߏங ౷ܭج൫ͷߏங +409ͷӡ༻੔උ HJUIVC ηΩϡϦςΟ؂ࠪ ίʔυϨϏϡʔ ςετج൫ͷߏங ΞΫηεղੳج൫ͷߏங ։ൃϓϩηε

    ৽ਓڭҭ ݪߘࣥච ΧϯϑΝϨϯεൃද 044։ൃ αʔόʔߏ੒؅ཧͷ࡮৽ ϦʔϯελʔτΞοϓ +FOLJOT 3VCZ3BJMT 3%#.4
  11. 00:03:00

  12. SQALE

  13. None
  14. None
  15. None
  16. Ruby on Rails AWS/LXC puppet/chef

  17. Ruby on Rails ๛෋ͳϛυϧ΢ΣΞ ࣗಈςετ Open Source

  18. AWS EC2 EBS Route53 ELB RDS αʔόʔ ӬଓԽྖҬ(Ϣʔβʔσʔλ) ϢʔβʔυϝΠϯ ϦόʔεϓϩΩγ

    ڞ༗DB
  19. AWS Amazon Linux Patched Kernel RedHat Linux ϕʔε ӡ༻ϊ΢ϋ΢͕͋Δ grsecurity

    fork bomb restrict bind
  20. AWS ฼؋ͷEC2Πϯελϯε lxc ͰϚϧνςφϯτΛ࣮ݱ Ruby ͱ PHP Λར༻Մೳ

  21. 00:06:00

  22. 1BB4ͷ࡞Γํ 4RBMFͷ৔߹ !IJCPNB QBQFSCPZDP

  23. 3VCZίϯςφ w /HJOY 3VCZ 3BDLΞϓϦ Λಈ͔ͤΔ-9$؀ڥ w 3VCZʙͷ࠷৽ύονϨϕϧΛఏڙ w TVQFSWJTPSEͰ/HJOYͱ3BDLΞϓϦΛ؂ࢹ

    w 44) $SPO࢖༻Մ w σϓϩΠ͢ΔͱCVOEMFJOTUBMM BTTFUTQSFDPNQJMFͳͲΛ ࣗಈͰߦ͍3BDLΞϓϦΛ࠶ىಈ͢Δ ஫΋ఏڙத
  24. 3VCZίϯςφ w /HJOY͸QPSU OͰMJTUFO  w TTIE͸QPSU OͰMJTUFO  w

    O͸ίϯςφ͝ͱʹҰҙͷ਺஋ w OFUXPSLOBNFTQBDF͸࢖༻͍ͯ͠ͳ͍ w ίϯςφ಺Ͱ5$1QPSUͷCJOE  Λ੍ݶ͢Δύον౰ͯͨ
  25. 1)1ίϯςφ w "QBDIF QIQ—GQNΛಈ͔ͤΔ-9$؀ڥ w  ܥΛఏڙ w TVQFSWJTPSEͰ"QBDIFͱQIQGQNΛ؂ࢹ w

    44) $SPO࢖༻Մ
  26. SPPUGT w ίϯςφ༻ͷϑΝΠϧπϦʔΛSPPUGTͱݺΜͰ͍·͢ w શͯͷίϯςφͰNPVOU͢ΔσΟϨΫτϦπϦʔ

  27. $ sudo yum --releasever=$ver --installroot=/var/rootfs/$role/ groupinstall Base SPPUGTͷߏங w 3VCZ

    1)1ͦΕͧΕ༻ͷSPPUGT 㲈DISPPU؀ڥ Λ࡞Δ ZVNJOTUBMMSPPUͰϕʔεΛ࡞Δ SVCZ΍DIFGTPMP΋ೖΕΔ DISPPUͯ͠DIFGTPMPͰϖνϖνͯ͠ߏங ɾ/HJOYͱ͔"QBDIFͱ͔3VCZ 1)1Λ͍Εͯ͘ w ߏங࣌ʹMYDͷςϯϓϨʔτ͸࢖ͬͯͳ͍ w ͓खຊͱͯ͠Կ౓΋ࢀর͠·ͨ͠
  28. SPPUGT w SPPUGTΛMYDTUBSUىಈ࣌ʹͱͯ͠NPVOUCJOE SP ߋʹϢʔβྖҬ &#4 ΛNPVOUCJOE w ϢʔβྖҬҎ֎͸SFBEPOMZ FSSOPJT&30'4

  29. Ϧιʔε੍ݶ w 2ίϯςφͷ$16 ϝϞϦͷϦιʔε੍ݶ͸ w "DHSPVQDQVTFU DHSPVQNFNPSZͰجຊ௨Γ w MYDTUBSUͷઃఆϑΝΠϧʹهड़ w

    ಈతʹมߋ͢Δӡ༻͸ ·ͩ ͍ͯ͠ͳ͍
  30. MYDTUBSUͷ؂ࢹ w MYDTUBSU͸NPOJUͰ؂ࢹ MYDTUBSU͕όάͰࢭ·ͬͨ͜ͱ͸ࠓΜॴ؍ଌͯ͠ແ͍ w ͘͝ॳظʹTVQFSWJTPSEͰ؂ࢹ͕ͯͨ͠ TVQFSWJTPSEΛఀࢭ͢ΔͱMYDTUBSU͕PSQIBOFE ʹͳͬͯ໽հͳͷͰNPOJUʹͨ͠

  31. 00:10:00

  32. ϧʔςΟϯά w ίϯςφΛ࡞ͬͯ࣍ʹߟ͑ͳ͍ͱ͍͚ͳ͍͜ͱ w υϝΠϯ؅ཧͲ͏͢Δ w )551 44) (JU PWFS44)

    ͰͲ͏ΞΫηεͤ͞Δ w ϩʔυόϥϯα΍ϦόʔεϓϩΩγΛհͯ͠ΞΫηε͍ͤͨ͞ w )5513FWFSTF1SPYZ w 44)3FWFSTF1SPYZ
  33. υϝΠϯ؅ཧ w 3PVUFͰTRBMFKQυϝΠϯΛ؅ཧ w $/".&Λ&-#ʹ޲͚͍ͯΔ w w ίϯςφ࡞੒ഁغͷλΠϛϯάͰ3PVUFͷ"1*Λୟ͘ ELB Proxy

    CNAME: ruby-hiboma.sqale.jp ruby-hiboma.sqale.jp. 0 IN CNAME proxy-lb001-******.ap-northeast-1.elb.amazonaws.com. Route53 HTTP DNS
  34. )551ͷಈతϧʔςΟϯά Redis ELB Nginx + Lua CNAME: ruby-hiboma.sqale.jp Hostϔομ (CNAME)

    ಺෦ϗετ ruby-hiboma.sqale.jp users001.sqale.lan:8000 php-sushi.sqale.jp users002.sqale.lan:8100 users001.sqale.lan:8001 Hostϔομ(CNAME) Λ Redis ʹ౤͛ͯ ಺෦ϗετʹม׵ CNAME Λ ELB ʹ޲͚ͯΔ (Route53؅ཧ) ᶃ ᶄ ᶅ ᶆ
  35. 44)ͷϧʔςΟϯά ELB SSH Router Patched OpenSSH SSH Git SFTP Git

    Server File server DB (MySQL) ެ։伴ೝূ ɾϢʔβ͕ొ࿥ͨ͠ެ։伴ͱর߹͢Δ ɾऩ༰͞Ε͍ͯΔίϯςφΛ໰͍߹ΘͤΔ SSH Git SFTP Git SFTP SSH ᶃ ᶄ ᶅ ᶆ
  36. HJUQVTIͷϧʔςΟϯά ELB SSH Router Patched OpenSSH git push Build Server

    Git Server DB (MySQL) ... ... ᶃ ᶄ ᶅ ᶆ bundle install assets:precompile etc ... git ͷ hook εΫϦϓτ ͰΩϡʔʹjob௥Ճ git clone rsync RackΞϓϦͷ࠶ىಈ
  37. ಠࣗυϝΠϯ44- w 44-͝ͱʹ&-#ΛׂΓ౰ͯ w 44-ূ໌ॻΛΞοϓϩʔυͯ͠΋Β͍&-#ʹΞλον Redis ELB Nginx + Lua

    ELB ಠࣗυϝΠϯ HTTPS +SSL HTTP
  38. 00:13:00

  39. Feature ϩάू໿ ࣾ಺ϓϥοτϑΥʔϜ fluentd, logplex, etc. طଘͷϗεςΟϯά΁ͷԠ༻ ࠷৽ͷ Ruby ͱ

    PHP ͷఏڙ ӬଓԽσʔλͷݟ௚͠
  40. Feature গਓ਺Ͱͷӡ༻ ઐ༻Πϯελϯε OSSͷੵۃత׆༻ ࣗಈԽ ϏδωεϢʔε VPS

  41. None
  42. 00:15:00