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

快適なサービス開発を支える技術/Cookpad TechConf 2017

快適なサービス開発を支える技術/Cookpad TechConf 2017

Cookpad TechConf 2017
https://techconf.cookpad.com/2017/

Takashi Kokubun

January 21, 2017
Tweet

More Decks by Takashi Kokubun

Other Decks in Programming

Transcript

  1. ࠓ೔࿩͢͜ͱ ΫοΫύου͕Ձ஋Λಧ͚ΔαΠΫϧ 2. ։ൃ 3. ςετ 4. σϓϩΠ 5. ؂ࢹ

    1. ։ൃ؀ڥͷ ηοτΞοϓ ▸ ͜ͷதͰͲͷΑ͏ͳ޻෉Λ ߦ͍ͬͯΔ͔঺հ͠·͢ (WebΞϓϦͷ࿩Λத৺ʹ࿩͠·͢)
  2. 1. ։ൃ؀ڥͷηοτΞοϓʹ͓͚Δ޻෉ ▸ curl https://ͻΈͭ/setup.sh | bash ▸ ͜ͷίϚϯυҰൃͰ Rails,

    iOS(macOSͷΈ), Android, ػցֶश ͷ։ൃ؀ڥ͕੔͏ ▸ ͦͷޙͷߋ৽΍ద༻΋ίϚϯυҰൃ ։ൃ؀ڥͷηοτΞοϓํ๏
  3. setup.sh ͰԿΛ͍ͯ͠Δͷ͔ ▸ ߏ੒؅ཧεΫϦϓτͷμ΢ϯϩʔυ ▸ Chef෩ͷRuby DSLͰهड़͞Ε͍ͯΔ ▸ DSLʹΑͬͯOSͳͲͷ؀ڥͷࠩҟΛٵऩ͠΍͍͢ ▸

    ߏ੒؅ཧπʔϧͷ࣮ߦ ▸ mrubyͰ࡞ΒΕͨMItamaeͱ͍͏πʔϧΛར༻͍ͯ͠Δ 1. ։ൃ؀ڥͷηοτΞοϓʹ͓͚Δ޻෉
  4. setup.sh ͰԿΛ͍ͯ͠Δͷ͔ ▸ Chef෩ͷRuby DSL (Itamae DSL) 1. ։ൃ؀ڥͷηοτΞοϓʹ͓͚Δ޻෉ package

    'memcached' package 'postgresql' brew install memcached brew install postgresql macOS
  5. setup.sh ͰԿΛ͍ͯ͠Δͷ͔ ▸ Chef෩ͷRuby DSL (Itamae DSL) 1. ։ൃ؀ڥͷηοτΞοϓʹ͓͚Δ޻෉ package

    'memcached' package 'postgresql' apt-get install -y memcached apt-get install -y postgresql brew install memcached brew install postgresql Ubuntu macOS
  6. Chat bot, RundeckΛ࢖ͬͨσϓϩΠ ▸ SlackͰ ruboty deploy cookpad ͱൃݴͯ͠σϓϩΠ ▸

    ruboty: Ruby੡ͷChat bot ▸ σϓϩΠ͸Rundeck্ͰߦΘΕɺଞͷਓ΋ϩάΛ ݟΔ͜ͱ͕Ͱ͖Δ ▸ ݖݶ؅ཧ͞Ε͓ͯΓɺ։ൃऀ͔͠σϓϩΠͰ͖ͣɺ audit log΋࢒Δ 4. σϓϩΠʹ͓͚Δ޻෉
  7. Amazon ECSΛ࢖ͬͨαʔϏεͷσϓϩΠ ▸ Amazon ECS΁ͷσϓϩΠʹ͸಺੡ͷσϓϩΠπʔϧʮHakoʯΛར༻ ▸ https://github.com/eagletmt/hako ▸ AWSͷαʔϏε΍؀ڥม਺͕YAMLͰ؅ཧ͞Ε͓ͯΓɺ αʔϏε։ൃऀ͕

    pull request ϕʔεͰมߋͰ͖Δ ▸ RundeckͷίϯιʔϧͰ hako deploy ͕࣮ߦ͞ΕɺAmazon ECS্ʹ Dockerίϯςφ͕σϓϩΠ͞ΕΔ ▸ DockerͷͨΊɺϝΠϯͰ࢖͍ͬͯΔRubyҎ֎ͷݴޠͰ΋σϓϩΠ͕ ༰қ 4. σϓϩΠʹ͓͚Δ޻෉
  8. σϓϩΠՄೳ࣌ؒ ▸ ݄ʙ໦༵೔ͷ 9:30-17:00 or ༵ۚ೔ͷ 9:30-15:00 ͔͠ σϓϩΠͰ͖ͳ͍ ▸

    Ϣʔβʔʹ໎࿭͕͔͔Βͳ͍Α͏ɺΠϯϑϥ͕؂ࢹ Ͱ͖ͳ͍໷΍ٳ೔ͷલ͸σϓϩΠ͠ͳ͍ ▸ ruboty͔ΒσϓϩΠ͠Α͏ͱ͢ΔͱνΣοΫ͞ΕΔ 4. σϓϩΠʹ͓͚Δ޻෉
  9. σϓϩΠϩοΫ ▸ ͙͢ʹσϓϩΠ͞ΕΔͱࠔΔΑ͏ͳมߋΛͨ࣌͠ͷͨΊͷ ҆શ૷ஔ ▸ RundeckͷδϣϒΛdisable͢ΔAPIΛୟ͍ͯϩοΫ ▸ ΫοΫύουͷΑ͏ʹ Docker Λ࢖Θͣී௨ͷ

    EC2 ΠϯελϯεʹσϓϩΠ͞Ε͍ͯΔҰ෦ͷαʔϏεͰ͸ɺ Φʔτεέʔϧ͍ͯ͠Δ࣌΋ࣗಈͰϩοΫ͞ΕΔ 4. σϓϩΠʹ͓͚Δ޻෉
  10. HakoΛ࢖ͬͨδϣϒͷ࣮ߦ ▸ Hako͸αʔϏεͷσϓϩΠ͚ͩͰͳ͘ɺAmazon ECS্Ͱ ίϚϯυΛ࣮ߦ͢Δͷʹ΋࢖͑Δ (hako oneshotίϚϯυ) ▸ ΦϑϥΠϯδϣϒ͸ hako

    oneshot Λ࢖ͬͯECS্Ͱ࣮ߦ͞ΕΔ ▸ δϣϒεέδϡʔϥ(Kuroko2)΍δϣϒΩϡʔ(Barbeque)͕ HakoΛαϙʔτ͍ͯ͠ΔͨΊ ▸ ςετΛ௨͍ͬͯΔ࠷৽ͷϦϏδϣϯΛ࢖͏Α͏ʹͳ͓ͬͯΓɺ σϓϩΠ͕ෆཁ (ඞཁͳ৔߹͸Slack͔ΒϩοΫՄೳ) 4. σϓϩΠʹ͓͚Δ޻෉