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

共通基盤システムの開発について

 共通基盤システムの開発について

http://aiming.connpass.com/event/25004/ での発表資料です

Tsukuru Tanimichi

January 27, 2016
Tweet

More Decks by Tsukuru Tanimichi

Other Decks in Technology

Transcript

  1. ࣗݾ঺հ • ୩ಓ ૑ (Tsukuru Tanimichi) • @ttanimichi • Ruby,

    Java, DevOps • 2014/06 ೖࣾ • ౷߹ KPI γεςϜͷ։ൃ • ڞ௨ج൫γεςϜͷ։ൃ • ήʔϜλΠτϧͷ API ։ൃ • https://github.com/ttanimichi • https://twitter.com/ttanimichi
  2. ॎׂΓͰͦΕͧΕ࣮૷͍ͯͨ͠ɾɾɾ • ೝূ • ՝ۚॲཧ • νϟοτ • Push ௨஌

    • ೝূ • ՝ۚॲཧ • Push ௨஌ • ೝূ • ՝ۚॲཧ • νϟοτ • Push ௨஌
  3. • ϩετϨΨϦΞ • 2015೥10݄22೔ϦϦʔε • ӡӦݩ: גࣜձࣾ Aiming • ։ൃݩ:

    Perfect World Co.,Ltd ։ൃݩ͸தࠃͷ Perfect World ࣾ
  4. Ͳ͏͍͏͜ͱʁ • தࠃ͸ GooglePlay Store ͡Όͳ͍ • தࠃಠࣗͷετΞʹܨ͕ΔΑ͏ʹͳ͍ͬͯΔ • ͦͷลͷ࢓૊Έ͸ӡӦݩ͕༻ҙ͢ΔจԽ

    • SNS ΞΧ΢ϯτͱͷඥ෇͚ʢޙड़ʣ • Facebook, Twitter ͸தࠃ͔Βܨ͕Βͳ͍ • άϨʔτϑΝΠΞ΢Υʔϧ
  5. • ೝূ • ՝ۚ • νϟοτ • Push ௨஌ •

    ૬ޓૹ٬ • ͳͲͳͲ ← ࡞Γ·ͨ͠ ← ࡞Γ·ͨ͠
  6. νʔϜϏϧσΟϯά • ࣾ಺ͷΫϥΠΞϯταΠυͷΤϯδχΞʹ͸ Unity(C#) ͕ଟ͍ɻiOS(Objective-C) ΍ Android(Java) Λॻ͚Δਓ͕গͳ͍ • ۀ຿ҕୗͷ

    iOS, Android ΤϯδχΞΛޏͬͨ • ۀ຿ҕୗͷΤϯδχΞʹ GitHub ͷ࢖͍ํ΍ ΞδϟΠϧ։ൃͷϑϩʔΛ·֮ͣ͑ͯ΋Β͏
  7. • Objective-C, Java Ͱ 
 ࡞ͬͨڞ௨ج൫
 ϥΠϒϥϦΛϥοϓͯ͠ Unity Plugin ʹ͢Δ

    • ΫϥΠΞϯτଆʹ͸
 ڞ௨ج൫γεςϜ༻ͷ Unity Plugin Λ૊ΈࠐΉ • αʔόʔͱ HTTPS Ͱ௨৴ ڞ௨ج൫ γεςϜ HTTPS (JSON) Client Unity Plugin
  8. Network ήʔϜ αʔόʔ ڞ௨ج൫ γεςϜ • ڞ௨ج൫ͱήʔϜ͸
 ผʑͷݴޠͰ΋͍͍ • IaaS

    ͷো֐ͰҰํ͚ͩ
 མͪΔ͜ͱ͕ͳ͍Α͏ಉҰ ͷωοτϫʔΫ಺ʹஔ͘ Client Unity Plugin
  9. SNS ΞΧ΢ϯτͱͷඥ෇͚ ڞ௨ج൫ γεςϜ ᶄ αʔόʔʹૹΔ Twitter Facebook google+ ᶃ

    access_token Λऔಘ ᶅ SNS ͷ uid Λऔಘ ΞΧ΢ϯτͱ uid Λඥ͚ͮΔ Client Unity Plugin
  10. ػछมߋ࣌ͳͲͷҾ͖ܧ͗ ᶅ SNS ͷ uid Λऔಘ SNS ͷ uid ͔ΒΞΧ΢ϯτΛऔಘ

    → ͦͷΞΧ΢ϯτΛ࢖͏ ڞ௨ج൫ γεςϜ ᶄ αʔόʔʹૹΔ Twitter Facebook google+ ᶃ access_token Λऔಘ Client Unity Plugin
  11. # app/models/account.rb class Account < ActiveRecord::Base has_many :connections, dependent: :destroy

    has_many :orders, class_name: 'Purchase::Order' before_create do self.auth_id = SecureRandom.uuid self.auth_token = SecureRandom.hex end def already_connected_with?(provider) connections.find_by(provider: provider).present? end def overwrite_connection(provider:, provider_uid:) connections.find_by!(provider: provider).update!(provider_uid: provider_uid) end def register_birth_date(year, month) update!(birth_date: build_birth_date(year, month)) end def child? become_adult_day.future? end private def become_adult_day birth_date + 20.years + 1.month end
  12. ߪೖͱϨγʔτͷडཧ Client Unity Plugin ڞ௨ج൫ γεςϜ ᶄϨγʔτૹ৴ AppStore GooglePlay τϥϯβΫγϣϯID

    Λ
 ɾapplicationUsername (iOS)
 ɾdeveloper payload (Android) ʹ٧ΊͯɺߪೖΛ࣮ߦ
 ͜͏͓ͯ͘͠ͱϨγʔτͱҰॹʹ τϥϯβΫγϣϯ ID ͕ฦͬͯ͘Δ → ࠶Πϯετʔϧͯ͠΋อ࣋͞ΕΔ ᶃ ߪೖ
  13. Verify ͱৼΓࠐΈ ήʔϜ αʔόʔ ڞ௨ج൫ γεςϜ AppStore ᶃ Ϩγʔτͷݕূ ᶄৼࠐ

    iOS ͸ Apple ͷαʔόʔͰ verify
 Android ͸खݩͰ verify Ͱ͖Δ verify Ͱ͖ͨΒΞΠςϜΛৼࠐΉ
  14. • gem “venice” • iOS Ϩγʔτͷ verify Λ΍ͬͯ͘ΕΔ gem •

    iOS 7ͷ৽ϨγʔτܗࣜʹରԠ͔ͨͬͨ͠
 ͷͰ fork ൛ͷ “amoslanka/venice” Λ࢖ͬͨ • ສ͕Ұফ͞ΕΔͱࠔΔͷͰ fork ͠ͱ͍ͨ ศརͩͬͨ gem
  15. # app/models/purchase/receipt/app_store.rb module Purchase module Receipt class AppStore def initialize(raw_receipt:,

    bundle_id:, store_transaction_id:) @raw_receipt = raw_receipt @bundle_id = bundle_id @store_transaction_id = store_transaction_id end def verify verify_receipt fail_unless_correct_bundle_id build_result end private def verify_receipt begin @receipt ||= Venice::Receipt.verify!(@raw_receipt).to_h rescue Venice::Receipt::VerificationError => e handle_error(e.code, e.message) end end def fail_unless_correct_bundle_id unless @bundle_id == receipt[:bundle_id] fail Incorrect, "bundle_id is incorrect" end end
  16. ΞϓϦέʔγϣϯαʔόʔͷબఆ • unicorn ͸ߴ଎͕ͩɺϓϩηεϕʔεͷͨΊ
 ಉ͡ϝϞϦʔྔͰ༻ҙͰ͖Δ Worker ਺͸
 εϨουϕʔεͷ Puma ͷ΄͏͕ଟ͍

    • Puma ʹมߋ • ຊ౰͸Πϕϯτۦಈͷ Thin ͕ϕετͩͬͨ ͷ͔΋ɻPuma Ͱे෼ͳੑೳ͕ग़͔ͨΒ Thin ͸ݕূ͠ͳ͔ͬͨ
  17. • ೝূ • ՝ۚ • νϟοτ • Push ௨஌ •

    ૬ޓૹ٬ • ͳͲͳͲ ͜ͷลΛਐΊ͍͖͍ͯͨ
  18. • ೝূ • ՝ۚ • νϟοτ • Push ௨஌ •

    ૬ޓૹ٬ • ͳͲͳͲ ͪ͜Βʹؔͯ͠΋ ػೳ௥Ճͷ ཁ๬͕Ͱ͍ͯΔ