オリジナリティのあるGitLabを標準に近づける

89b7112b39cc8b2a277eb5c7fb27a343?s=47 xorphitus
December 20, 2018

 オリジナリティのあるGitLabを標準に近づける

2018-12-20 Gitlab Meetup Tokyo #12

多量に独自パッチを当てたGitLabをOmnibus Packageに移行した話。

89b7112b39cc8b2a277eb5c7fb27a343?s=128

xorphitus

December 20, 2018
Tweet

Transcript

  1. ΦϦδφϦςΟͷ͋Δ (JU-BCΛඪ४ʹ͚ۙͮΔ 2018-12-20 GITLAB MEETUP TOKYO #12

  2. ͸͡Ίʹ about_me.edn {:name "@xorphitus"
 :role ["server side engineer", "SRE"]
 :language

    [{:name "Clojure", :desc "ॳ৺ऀ"}
 {:name "Haskell", :desc "ೖ໳த"}
 {:name "Rust", :desc "ͦΖͦΖ࢝ΊΔ"}]
 :keyboard "Nyquist (ࣗ࡞)"
 :favoite ["xmonad", "single malt whisky"]}
  3. ࠓ೔͓఻͑͢Δ͜ͱ ಠࣗύον͔Βͷ։์ ▸ ಠࣗύονΛ30͘Β͍౰ͯͯΑ͘ҭͬͨGitLabΛOmnibus PackageʹҠߦͨ͠࿩ ▸ ࠓ೔͸αϚϦ͚ͩ঺հ ▸ ৽نੑͷ͋ΔτϐοΫ͸ͳ͍Ͱ͢

  4. Ҡߦͷ࿩ͷલʹ ͳͥଟྔͷಠࣗύον͸౰͍͔ͨͬͯͨ ▸ ϓϩμΫτͱͯ͠ະ੒ख़ͩͬͨGitLabΛར༻͍ͯͨͨ͠Ί ▸ গͳ͘ͱ΋4ܥ͔Βར༻ɺGitHub͸༧ࢉతʹNG ▸ ݁ՌɺΞοϓάϨʔυ͕ਏ͍ ▸ 100ϑΝΠϧҎ্ͷconflict!

    w/o ճؼςετ ▸ ৬ਓʹΑΔmerge͕ඞཁ ▸ ͦͯ͠τϥϒϧγϡʔςΟϯά͕ਏ͍ ▸ ެࣜͷ໰୊ͳͷ͔ɺಠࣗύονͷ໰୊ͳͷ͔ͷ੾Γ෼͚͕ൃੜ
  5. ಠࣗύονͷଛӹ෼ذ ಠࣗύονͷӡ༻ίετ ಠࣗύονʹΑΔϦλʔϯ ࣌ͷྲྀΕ ↑͍·͜͜ ެࣜଆͷػೳڧԽ ʹΑΔϦλʔϯͷ ݮগ ύονͷ૿ՃʹΑ Δίετͷ૿େ

    ެࣜGITLABͷਐԽͱಠࣗύονͷՁ஋௿Լ PROFIT
 and
 LOSS
  6. ͦΜͳΘ͚Ͱ Ҡߦ͠·ͨ͠

  7. ಠࣗύον౳ͷ܏޲ͱରࡦ Ҏલͷঢ়گ ରԠํ਑ ιʔεΠϯετʔϧ Omnibus Package RPM΁ MySQLରԠνϡʔχϯά PostgreSQLԽͰఫഇ ݟͨ໨Λ੔͑Δύον

    GitLabͷਐԽΛ৴͡શഇࢭ ػೳ௥Ճɾมߋύον ɾGitLabʹಉ౳ͷ৽ػೳ ɹ͕͋Ε͹Ҡߦ ɾAPIΛར༻͢Δόον࡞੒
 ɾGitLab Pluginͷ׆༻
 ɾͲΕ΋ແཧͳΒύον
 ɹͱͯ͠࢒͢
  8. ·ͬઌʹݕূͨ͜͠ͱ MySQL͔ΒPostgreSQL΁ ▸ Ҏલ͸MySQLͰ஗͘ͳΔΫΤϦΛಠࣗύονͰղফ͍ͯͨ͠ ▸ MySQLར༻ʹ͖ͭzero downtime upgrade΋ෆՄ ▸ pgloaderͰMySQL͔ΒPostgreSQL΁σʔλҠߦͨ͠

    ▸ GitLabͷެࣜυΩϡϝϯτʹ΋ར༻ํ๏͕ॻ͍ͯ͋Δ ▸ ύοέʔδ൛Λ࢖ͬͨΒώʔϓϝϞϦ͕ෆ଍ͨ͠ͷͰɺࣗ લͰϏϧυ
  9. Ͱ͖Δ͚ͩअຐ͠ͳ͍ಠࣗύον ୅ସखஈ͕ͳ͍͕ඞཁͳ΋ͷ͸ಠࣗύον ▸ ݱࡏͰ͸ίϝϯτؚΊ60ߦఔ౓ͷRubyϑΝΠϧΛ1ͭઃஔ ͢Δ͚ͩʹͱͲ·͍ͬͯΔ ▸ config/initializers/zzzz_my_patches.rb ▸ GitLabͷRailsͷઃఆͷ্ॻ͖ ▸

    ϞϯΩʔύονʹΑΔϥΠϒϥϦͷڍಈมߋ ▸ CapistranoͰGitLab Plugin౳ͱ·ͱΊͯઃஔ
  10. ੒Ռൃද Ҡߦͯ͠ΞοϓάϨʔυָ͕ʹͳͬͨʂ ▸ Before ▸ ४උʹ਺೔ ▸ ຊ൪ద༻͸μ΢ϯΛ൐͏ͷͰٳ೔ग़ۈ࣮ͯ͠ࢪ ▸ After

    ▸ ४උɺຊ൪ద༻߹Θͤͯ1࣌ؒ͘Β͍ ▸ ຊ൪ద༻Ͱ΋μ΢ϯ͠ͳ͍ͷͰӦۀ࣌ؒதʹ࣮ࢪ ▸ ΞοϓάϨʔυͰτϥϒϧղফͨ͠έʔε΋਺݅
  11. ͜Ε͔Β΍Δ͜ͱ ࢒՝୊͸Կ͔ ▸ GitLab Runnerͷ࡮৽ ▸ GitLabຊମ͸࡮৽Ͱ͖͕ͨɺRunner͸·ͩख෇͔ͣ ▸ ver 9.5.0͕AWSͱΦϯϓϨʹෳ਺ཱ͍ͬͯΔ…

    ▸ GKE্ͷߏஙΛݕ౼த
  12. ͝ਗ਼ௌ͋Γ͕ͱ ͏͍͟͝·ͨ͠

  13. ૝ఆ໰౴ू

  14. ૝ఆ໰౴ू ಠࣗύονͰ΍͍ͬͯͨ͜ͱͷ୅ସԽͷத਎ ▸ ৽ػೳ΁Ҡߦͤͨ͞΋ͷ ▸ GitHubϛϥʔϦϯάػೳ౳ ▸ API΍PluginΛ׆༻ͯ͠৐Γ੾ͬͨ΋ͷ ▸ LDAP͔Βফ͑ͨϢʔβΛblock͢Δ౳

    ▸ WebhookԽͨ͠΋ͷ ▸ ChatWork௨஌ઃఆ ▸ ύονͰ͸ͳ͍͕ɺMySQLͷఆظόοΫΞοϓʢɾϦετΞʣεΫϦϓτ͸ Omnibus PackageͷػೳΛར༻͢ΔΑ͏ʹมߋ
  15. ૝ఆ໰౴ू ࢒ͨ͠ಠࣗύονͷத਎͸Կ͔ ▸ ᶃ Markdown rendererͷมߋ ▸ GitLabͰ͸௨ৗͷվߦΛ<br>ʹͳ͍͕ɺզʑͱͯ͠͸<br>ʹ ͳͬͯཉ͍͠ ▸

    ᶄ ֎෦౰ͯʹϝʔϧΛૹΒͳ͍Α͏ʹ͢Δ ▸ υϝΠϯ͕ࣾ಺Ͱͳ͚Ε͹ૹΒͳ͍ɺ҆શ૷ஔ ▸ ᶅ ݹ͍Πϕϯτ৘ใΛ࡟আ͢Δworkerͷఀࢭ ▸ աڈͷܦҢ͕ࣦΘΕͳ͍Α͏ʹ͢Δରࡦ
  16. ૝ఆ໰౴ू ਏ͔ͬͨ͜ͱ͸ ▸ Ҡߦʹ൐͍όʔδϣϯΞοϓΛ͕ͨ͠ɺͦ͜ͰΤϥʔ͕ൃੜͨ͠ ▸ ಠࣗύονͷ୅ସػೳ࡞੒ʹGitLab Plugin System͕ඞཁͩͬͨ ▸ ͕ɺόʔδϣϯΛ্͛ͳ͍ͱ࢖͑ͳ͔ͬͨ

    ▸ όʔδϣϯΛ্͛Δ࣌ʹ૸ΔDB migrationͰɺաڈͷෆ׬શͳσʔ λ͕ࠞࡏͯ͠Τϥʔʹͳͬͨ ▸ طଘσʔλ͔Βؾ߹Ͱαϧϕʔδͯ͠ɺ໬΋Β͍͠σʔλΛಥͬ ࠐΉεΫϦϓτΛॻ͍ͯԿͱ͔ͨ͠
  17. ૝ఆ໰౴ू Ͳͷ͘Β͍͕͔͔͔࣌ؒͬͨ ▸ 1ਓͰ΍ͬͯɺ4ϲ݄͘Β͍ ▸ ݁ߏ΍Δ͜ͱ͕ଟ͔ͬͨ ▸ ଟྔʹ͋Δಠࣗύονͷഎܠཧղ ▸ DBҠߦͷݕূ࡞ۀ

    ▸ Webhook༻ΤϯυϙΠϯτͷ࡞੒ΛServerlessͰ͢Δ ▸ Etc