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

HashiCorpの新ツール 「Waypoint」をCloud Runで使ってみた

HashiCorpの新ツール 「Waypoint」をCloud Runで使ってみた

GCPUG Shonan vol.56 5周年 LT

C5b4d57a23b991d41ac0a89926ab4f8a?s=128

Ryuji Tsutsui

November 15, 2020
Tweet

Transcript

  1. HashiCorpͷ৽πʔϧ ʮWaypointʯΛCloud RunͰ ࢖ͬͯΈͨ Ryuji Tsutsui@ryu22e
 GCPUG Shonan vol.56 5प೥

    LT 2020/11/14
  2. ࣗݾ঺հ • Ryuji Tsutsui@ryu22e • GCPUG Shonanελοϑ • ීஈ͸࿡ຊ໦ͷϑΟϯςοΫܥاۀͰDjango੡΢ΣϒαʔϏεͷ
 ։ൃΛ͍ͯ͠·͢ɻ

    • झຯ: өըؑ৆ʢ2015೥ʙʣɺ֨ಆٕ؍ઓʢ2019೥ʙʣ • ࠓ೥͸ίϩφͷ͍ͤͰɺͲͪΒ΋͋·Γߦ͚ͯͳ͍
  3. ࠓ೔࿩͍ͨ͜͠ͱ • Waypointͷ؆୯ͳղઆ • WaypointΛ࢖ͬͯCloud RunʹσϓϩΠͯ͠Έͨײ૝ʢσϞ͋Γʣ

  4. Waypointͱ͸

  5. Waypointͱ͸ • TerraformɾVagrantͳͲͰ͓ೃછΈͷHashiCorp͕ࣾ2020೥10݄15 ೔ʹϦϦʔεͨ͠σϓϩΠπʔϧ • ؆୯ͳઃఆϑΝΠϧΛॻ͚ͩ͘Ͱ৭ʑͳϓϥοτϑΥʔϜ΁ͷσϓϩ Π͕Ͱ͖Δ

  6. Waypoint͸Go੡πʔϧ • ࣮ߦϑΝΠϧ1ݸμ΢ϯϩʔυ͢Δ͚ͩͰ࢖͑Δ • macOSɾWindowsɾLinuxʹରԠ • HomebrewɾaptɾyumͳͲͰ΋ΠϯετʔϧͰ͖Δ

  7. WaypointͬͯͲ͏͍͏ҙຯʁ • weblioʹΑΔͱ • ʮܦ࿏্ͷ஍఺৘ใʯͱͷ͜ͱ • https://ejje.weblio.jp/content/Waypoint

  8. MBP͔Βެࣜͷαϯϓϧίʔυ ʢ https://github.com/hashicorp/ waypoint-examples.git ʣΛ Cloud RunʹσϓϩΠͯ͠ΈΔ

  9. ४උฤ

  10. ඞཁͳ΋ͷ • waypoint(v0.1.5) • gcloud • Docker • git XBZQPJOUͱ௚઀ؔ܎ͳ͍͕ɺαϯϓϧίʔυ

    ͷμ΢ϯϩʔυʹ࢖͏ɻ
  11. waypointΠϯετʔϧ $ brew tap hashicorp/tap $ brew install hashicorp/tap/waypoint

  12. gcloudͷઃఆ $ gcloud auth application-default login $ gcloud config set

    project <my-project-name> $ gcloud auth configure-docker
  13. waypointαʔόʔىಈ $ docker pull hashicorp/waypoint:latest $ waypoint install --platform=docker -accept-tos

  14. ιʔείʔυͷ४උ $ git clone https://github.com/hashicorp/waypoint-examples.git $ cd ./waypoint-examples/google-cloud-run/nodejs/

  15. waypoint.hclͷ಺༰Λ֬ೝ & ฤू $ ls -l1 Procfile README.md index.js package.json

    public views waypoint.hcl εϥΠυͩͱݟͮΒ͍ͷͰΤσΟλͰݟ·͢ɻ
  16. σϓϩΠ·ͰͷྲྀΕ • build • CloudNative BuildpacksͰϏϧυ & GCRʹpush • deploy

    • Cloud RunʹσϓϩΠ • release • σϓϩΠͨ͠ίʔυΛΞΫςΟϒԽ
  17. waypointͷॳظԽ $ waypoint init XBZQPJOUTFSWFSʹϓϩδΣΫτ͕࡞ΒΕΔɻ

  18. ͍Α͍ΑσϓϩΠʂ

  19. σϓϩΠͷσϞʢ2෼͙Β͍͔͔Δ૝ఆʣ $ waypoint up ίϚϯυ͸͜Ε͚ͩʂ

  20. v0.1.5࣌఺Ͱͷ࢖ͬͯΈͨײ૝ • ͋·ΓቕΔ͜ͱͳ͘࢖͏͜ͱ͸Ͱ͖ͨ • ϓϩδΣΫτͷ಺༰͔ΒϏϧυʹඞཁͳखॱΛࣗಈ൑அ͢Δͷ͸ָ͕ͩɺͪΐͬͱखͷࠞΜ ͩ͜ͱΛ΍Δͱ೰Ή͜ͱʹͳΓͦ͏ͳ༧ײ • ϦϞʔτͰར༻Ͱ͖Δwaypoint serverΛࣗલͰཱͯΔͷ͕໘౗ •

    Ϛωʔδυͳwaypoint server͕΄͍͠ • waypoint server্ͷϓϩδΣΫτ͕ফͤͳ͍ • ফͤΔΑ͏ʹ͢Δ༧ఆ͸͋Δ͕ࠓͷͱ͜ΖͰ͖ͳ͍Β͍͠ • https://discuss.hashicorp.com/t/how-to-delete-the-project/16465/4
  21. v0.1.5࣌఺Ͱͷ࢖ͬͯΈͨײ૝ • Cloud Run΁ͷσϓϩΠ͔͠࢖͍ͬͯͳ͍͚Ͳɺ·ͩػೳతʹ଍Γ͍ͯͳ͍ͱ͜Ζ͕ ͋Δײ͡ • ΦʔτεέʔϦϯάͷmax͸ࢦఆͰ͖Δͷʹmin͸Ͱ͖ͳ͍ • Cloud SQL΍VPC઀ଓʹؔ͢Δύϥϝʔλ͕ͳͦ͞͏

    • Hookػೳ͸͋ΔͷͰɺσϓϩΠޙʹgcloudͰઃఆͯ͠΍Δ͔͠ͳ͍͔΋ʁ • waypoint destroyͱ͍͏ίϚϯυ͕͋Δͷʹಈ͔ͳ͍ • Issue͸ڍ͕͍ͬͯͨ https://github.com/hashicorp/waypoint/issues/533
  22. ·࣮ͩઓ౤ೖ͸ૣ͍ؾ͕͢Δ͚ͲɺOSSͷ΢Σ ϒΞϓϦέʔγϣϯΛ഑෍͢ΔࡍͷσϑΝΫτ ελϯμʔυʹͳͬͯ͘ΕΔͱخ͍͠ͳʔ

  23. Waypointͥͻ࢖ͬͯΈͯͶʂ