サービス基盤におけるRuby~JSOX編~ / speee_pepabo_ruby

C84357a21083c81c5ccd5550422abc8d?s=47 Ryo Takaishi
January 18, 2017

サービス基盤におけるRuby~JSOX編~ / speee_pepabo_ruby

C84357a21083c81c5ccd5550422abc8d?s=128

Ryo Takaishi

January 18, 2017
Tweet

Transcript

  1. ʙ+409ฤʙ ∁ੴྒ(.01FQBCP *OD 3VCZΤϯδχΞ͕ޠΔɺ೥ͷৼΓฦΓͱ͜Ε͔Β αʔϏεج൫ʹ͓͚Δ3VCZ

  2. ιϑτ΢ΣΞΤϯδχΞ ∁ੴྒ!S@UBLBJTIJ (.01FQBCP *ODNJOOFج൫νʔϜ

  3. ΩʔϘʔυপ w ڈ೥ɿࣗ୐ΩʔϘʔυϦϓϨʔε͍ͨ͠ʜ w ڈ೥݄ɿ&SHP%PY&; w ڈ೥݄ɿ)BQQZ)BDLJOH,FZCPBSE1SP+1 w ڈ೥݄ɿ,JOFTJT'SFF4UZMF w

    ࠓ೥݄ɿ)BQQZ)BDLJOH,FZCPBSE1SPࠓ͜͜ w ࠓޙɿࣗ࡞͔ʜʂʁ
  4. None
  5. ࠓ೔ͷ࿩

  6. ఆظδϣϒͷϩάΛ 4MBDLʹఴ෇͢Δ

  7. ͳͥ΍ͬͨͷ͔

  8. ͳͥ΍ͬͨͷ͔ w +409ͷ؂ࠪͰඞཁʹͳͬͨ w +409  w ࣾ಺ΛͪΌΜͱίϯτϩʔϧ͠·͠ΐ͏ɺͱ͍͏͜ͱ ࡶ 

    w ͨͱ͑͹ʜ w ݖݶΛ࣋ͭϢʔβͷΈγεςϜʹΞΫηεͰ͖Δ͔ʁ w γεςϜมߋͷཤྺ͕؅ཧ͞Ε͍ͯΔ͔ʁ
  9. ͱ͸͍͑ w ؂ࠪʹؔ܎ͳ͘΍͓ͬͯ͘ͱศར w αʔϏε্Ͱಈ͘ఆظδϣϒͷ࣋ͭ՝୊ ͪΌΜͱఆظతʹಈ͍͍ͯΔͷ͔ͳʁ ϩά͸Ͳ͜ʹ͋ΔΜͩΖ͏ʁ ͦͷϩά͸ɺͲͷδϣϒͷ΋ͷͩΖ͏ʁ

  10. ղܾࡦɿՄࢹԽ ͪΌΜͱఆظతʹಈ͍͍ͯΔͷ͔ͳʁ w ಈ͍͍ͯΔͷ͕ݟ͑Δ͜ͱ ϩά͸Ͳ͜ʹ͋ΔΜͩΖ͏ʁ w ࣦഊͨ࣌͠ɺ͙͢ʹΘ͔Δ͜ͱ ͦͷϩά͸ɺͲͷδϣϒͷ΋ͷͩΖ͏ʁ w ϩάͱδϣϒ͕ؔ࿈͚ͮΒΕ͍ͯΔ͜ͱ

  11. +409ؔ܎ͳ͘ศར

  12. Ͳ͏ՄࢹԽ͢Δ͔

  13. Ͳ͔͜Λݟʹ͍͘ͷ͸ ݁ߏΊΜͲ͏ʜ

  14. ීஈ͔Β͍Δ৔ॴ͕͍͍

  15. ීஈ͔Β͍Δ৔ॴʜ

  16. ͩʂ

  17. 4MBDLʹ࢒ͦ͏

  18. λεΫ͕ࣦഊͨ࣌͠΋0,

  19. Ͳ͏΍Δ͔

  20. Ͳ͏΍Δ͔ Batch Tempfile ǎǽǬῘ൓Ƶ๙ᆩ ㊗ǎǽǬປਔƵ๙ᆩ ၂ℭǫƷƺȁƎℼŰ䴘Ƣ ǎǽǬƑȃdžƵเڱ ǎǽǬƵ⻎ྛ

  21. Ͳ͏΍Δ͔

  22. Ͳ͏΍Δ͔  ࣮ߦલޙʹ4MBDLʹ௨஌ ࣮૷ࡁΈ䠼ʢNJ[P3SBLF@OPUJpDBUJPOʣ  ࣮ߦޙʹ4MBDLʹϩάΛఴ෇ ະ࣮૷䠼 ͜ΕΛ࣮ݱ͢Ε͹ཁ݅Λຬͨ͢ʂ

  23. λεΫͷϩάΛ 4MBDLʹఴ෇͢Δ

  24. λεΫͷϩάΛ4MBDLʹఴ෇͢Δ  λεΫͷϩάɾඪ४ग़ྗΛऔಘ  औಘͨ͠ϩάΛ4MBDLʹఴ෇

  25. λεΫͷϩάɾඪ४ग़ྗ Λऔಘ͢Δ

  26. λεΫͷϩάɾඪ४ग़ྗΛऔಘ͢Δ w ϩάɾඪ४ग़ྗͷ޲͖ઌΛҰ࣌ϑΝΠϧʹ͢Δ w ϩάɿ"DUJWF4VQQPSU-PHHFSCSPBEDBTU w ඪ४ग़ྗɿ.VMUJ*0

  27. "DUJWF4VQQPSU-PHHFSCSPBEDBTU

  28. "DUJWF4VQQPSU-PHHFSCSPBEDBTU w ϩάΛෳ਺ͷ-PHHFSʹૹΔͨΊͷϝιου w ྫʣඪ४ग़ྗ ϑΝΠϧ w ྫʣϑΝΠϧ ϑΝΠϧ new_logger

    = ActiveSupport::Logger.new(logdev) multiple_loggers = ActiveSupport::Logger.broadcast(new_logger) @logger.extend(multiple_loggers)
  29. .VMUJ*0

  30. .VMUJ*0 w ෳ਺ͷ*0ʹର͠ॲཧΛߦ͏ͨΊͷΫϥε w TUEPVUDMBTT*0 w ྫʣ45%065 ϑΝΠϧ class MultiIO

    # @param [Array<IO>] io_list def initialize(io_list) @io_list = io_list end [snip] def write(str) @io_list.each do |io| io.write(str) io.flush end end [snip] end
  31. ϩάΛ4MBDLʹఴ෇͢Δ

  32. ϩάΛ4MBDLʹఴ෇͢Δ w "1*Λ࢖ͬͯ4MBDLʹϑΝΠϧΛఴ෇Ͱ͖Δ pMFTVQMPBE  w XSBQQFSMJCSBSZΛ࢖༻ MJOZPXTCSFBDBO def send_log_slack(task,

    tmplog) Breacan.access_token = '#{SLACK_ACCESS_TOKEN}' arg = { channels: ENV['RAKE_NOTIFY_TO'] || '#minne_dev', file: Faraday::UploadIO.new(tmplog.path, 'text/plain'), filename: "#{File.basename(task.name)}_#{Time.now.strftime('%Y%m%d%H%M%S')}.log" } Breacan.files_upload(arg) end
  33. pMFTVQMPBEͷ᠘ w ௨ৗͷ౤ߘ༻"1*ͩͱΞΠίϯ΍໊લΛมߋͰ͖Δ w pMFTVQMPBE͸ෆՄ w ʮͱΓ͋͑ͣࣗ෼ͷτʔΫϯΛ͠͹Β͘࢖͏ʯͱ͔΍Δͱʜ

  34. pMFTVQMPBEͷ᠘ w ௨ৗͷ౤ߘ༻"1*ͩͱΞΠίϯ΍໊લΛมߋͰ͖Δ w pMFTVQMPBE͸ෆՄ w ʮͱΓ͋͑ͣࣗ෼ͷτʔΫϯΛ͠͹Β͘࢖͏ʯͱ͔΍Δͱʜ

  35. ͓ΘΓʹ

  36. ͓ΘΓʹ w 3BLFλεΫͷ࣮ߦલޙͰ4MBDLʹ௨஌ʢ࣮૷ࡁΈʣ w 3BLFλεΫ࣮ߦޙɺϩάΛ4MBDLʹఴ෇ʢ࣮૷ࡁΈʣ

  37. Ͳ͏΍Δ͔

  38. ͓ΘΓʹ wϩά͕4MBDLʹ͋Δ wˠδϣϒ͕ࣦഊ͙ͨ࣌͢͠ݟΒΕΔʂศརʂ wج൫νʔϜͰ΋ɺ3VCZͰαʔϏεΛΑ͍ͯͧ͘͘͠

  39. ܅΋ϖύϘͰಇ͔ͳ͍͔ʁ ࠷৽ͷ࠾༻৘ใΛνΣοΫˠ !QC@SFDSVJU