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

breakthrough point of web engineer

breakthrough point of web engineer

【LIVESENSE流】Webサービスの開発・運用におけるデータエンジニアリング
https://camphor.connpass.com/event/87720/

上記イベント登壇資料。

Livesense Inc.

June 23, 2018
Tweet

More Decks by Livesense Inc.

Other Decks in Programming

Transcript

  1. ϓϩμΫτίʔυͰޠΔʂ ΤϯδχΞͷ੒௕ͷϒϨʔΫεϧʔϙΠϯτ PROFILE ▸ 1978.11 ෱Ԭݝੜ·Ε ▸ 2002.03 ౦ژ޻ۀେֶཧֶ෦ଔ ▸

    2004.08 ϑϦʔϥϯεΤϯδχΞ ▸ 2011.08 ৽نࣄۀ։ൃPM ▸ 2013.05 Ϧϒηϯεೖࣾ ▸ 2015.04 ৽نࣄۀ্ཱͪ͛ ▸ 2018.06 ΤϯδχΞϦϯάϚωʔδϟʔʗ σʔλΤϯδχΞ
  2. RUBY ON RAILSΛߏ੒͢Δٕज़ ABOUT RUBY ON RAILS ▸ ఻౷తͳMVCϑϨʔϜϫʔΫ ▸

    RESTfulͳϧʔςΟϯά ▸ ActiveRecordʢڧྗͳORMʣ ▸ ϚΠάϨʔγϣϯʢDB؅ཧʣ ▸ ։ൃϞʔυʢdevelopmentʗtestʗproductionʣ ▸ ϑϩϯτΤϯυ ▸ Asset Pipeline ▸ SCSS ▸ CoffeeScript ▸ WebpackerʢRails 5.1ʙʣ ▸ RubyGemsΤίγεςϜ ▸ BDD
  3. RUBY ON RAILSΛߏ੒͢Δٕज़ RESTFULͳROUTING ▸ bin/rails g scaffold User name:string

    email:string ▸ bin/rails routes ▸ config/routes.rb ▸ resources :users
  4. RUBY ON RAILSΛߏ੒͢Δٕज़ ։ൃϞʔυ ▸ RAILS_ENV ▸ bin/rails s -e

    [mode name] ▸ config/environments/ ▸ development.rb ▸ production.rb ▸ test.rb
  5. RUBY ON RAILSΛߏ੒͢Δٕज़ ASSET PIPELINE ▸ RubyGems ▸ sprockets-railsʢΞηοτίϯύΠϧʣ ▸

    sass-railsʢSCSSʣ ▸ uglifierʢJSϑΝΠϧѹॖʣ ▸ coffee-railsʢJS→CoffeeScriptίϯύΠϧʣ ▸ bin/rails assets:precompile (for production) ▸ ϑΟϯΨʔϓϦϯτ ▸ application-908e25f4bf641868d8683022a5b62f54.css
  6. RUBY ON RAILSΛߏ੒͢Δٕज़ WEBPACKER (RAILS 5.1~) ▸ RubyGems ▸ webpacker

    ▸ bin/rails new myapp --webpack ▸ bin/rails webpacker:install ▸ app/views/layouts/application.html.erb ▸ bin/webpack-dev-server
  7. RUBY ON RAILSΛߏ੒͢Δٕज़ RUBY GEMS (ϚοϋόΠτ 2006.02~) ▸ grep 'gem

    ' Gemfile | wc -l ▸ 74 ※ ▸ ʲFYIʳgrep create_table db/schema.rb | wc -l ▸ 363
  8. RUBY ON RAILSΛߏ੒͢Δٕज़ RUBY GEMS (ब׆ձٞ 2015.04~) ▸ grep 'gem

    ' Gemfile | wc -l ▸ 71 ▸ ʲFYIʳgrep create_table db/schema.rb | wc -l ▸ 226
  9. RUBY ON RAILSΛߏ੒͢Δٕज़ RUBY GEMS (IESHIL 2015.08~) ▸ grep 'gem

    ' Gemfile | wc -l ▸ 113 ▸ ʲFYIʳgrep create_table db/schema.rb | wc -l ▸ 175
  10. RUBY ON RAILSΛߏ੒͢Δٕज़ RUBY GEMS (JOB-DRAFT 2015.11~) ▸ grep 'gem

    ' Gemfile | wc -l ▸ 119 ▸ ʲFYIʳgrep create_table db/schema.rb | wc -l ▸ 250
  11. BDD

  12. RUBY ON RAILSΛߏ੒͢Δٕज़ BDD (ৼ෣ۦಈ։ൃ) ▸ Minitest (Default) ▸ bin/rails

    test ▸ Rspec (RubyGems) ▸ bin/rails g rspec:install ▸ bin/bundle binstubs rspec-core ▸ bin/rspec
  13. [COFFEE BREAK] RAILSॳ৺ऀ͋Δ͋Δ Ͳ͔͜ΒͲ͜·Ͱ͕RAILS WAYͳͷ͔ʁ ▸ ෳ਺ܗͱ୯਺ܗͷҧ͍ ▸ Routing →

    resources :usersʢෳ਺ܗʣ ▸ Controller → class UsersControllerʢෳ਺ܗʣ ▸ Model → class Userʢ୯਺ܗʣ ▸ Table → usersςʔϒϧʢෳ਺ܗʣ ▸ View → app/views/usersʢෳ਺ܗʣ
  14. [COFFEE BREAK] RAILSॳ৺ऀ͋Δ͋Δ Ͳ͔͜ΒͲ͜·Ͱ͕RAILS WAYͳͷ͔ʁ ▸ ύʔγϟϧͷ໋໊ ▸ app/views/users/index.html.erb ▸

    render ‘layouts/header’ ▸ app/views/layouts/_header.html.erb ▸ FAQ ▸ Missing TemplateౖͬͯΒΕΔΜͰ͚͢Ͳ… ▸ ͳΜͰΞϯμʔείΞ͕ඞཁͳΜͰ͔͢ʁ
  15. RUBY ON RAILSΛߏ੒͢Δٕज़ RUBY ON RAILSͷ࢖͍ॴ ▸ webΞϓϦέʔγϣϯͷϓϩτλΠ ϓΛૉૣ͘࡞Δ ▸

    ϑϩϯτΤϯυ(HTMLʗCSSʗ JavaScript)΋αʔόʔαΠυ(Ruby) ΋1ਓͰαΫοͱ࡞Δ https://logmi.jp/6034
  16. RAILSͰ࣮ફతͳWEBΞϓϦέʔγϣϯ։ൃ͢Δצॴ ABOUT צॴ ▸ αʔόʔαΠυ ▸ ؀ڥߏங ▸ RubyGemsબఆ ▸

    MVCҎ֎ͷϨΠϠʔ ▸ ϑϩϯτΤϯυ ▸ Webpacker or notʢRails 5.1~ʣ ▸ SPAཁ݅ʢReact.jsʗVue.jsʗAngularJS etc.ʣ
  17. RAILSͰ࣮ફతͳWEBΞϓϦέʔγϣϯ։ൃ͢Δצॴ SERVER SIDE - RUBYGEMSબఆ ▸ બఆ͕؊ ▸ ؾΛ͚ͭΔϙΠϯτ ▸

    ཁ݅ʹԊ͍ͬͯΔ͔ ▸ ྨࣅͷػೳΛ࣋ͭgemͷௐࠪ ▸ ࢖༻࣮੷͕͋Δ͔ ▸ OSS։ൃίϛϡχςΟ ▸ ϓϩδΣΫτͷRubyʗRailsͷόʔδϣϯͱͷ੔߹ੑ ▸ Railsػೳ֦ுܥ͸ཁ஫ҙʢparanoiaͳͲʣ ▸ ։ൃνʔϜͱͷ߹ҙܗ੒
  18. RAILSͰ࣮ફతͳWEBΞϓϦέʔγϣϯ։ൃ͢Δצॴ ABOUT צॴ ▸ αʔόʔαΠυ ▸ ؀ڥߏங ▸ RubyGemsબఆ ▸

    MVCҎ֎ͷϨΠϠʔ ▸ ϑϩϯτΤϯυ ▸ Webpacker or notʢRails 5.1~ʣ ▸ SPAཁ݅ʢReact.jsʗVue.jsʗAngularJS etc.ʣ
  19. RAILSͰ࣮ફతͳWEBΞϓϦέʔγϣϯ։ൃ͢Δצॴ FRONTEND ▸ bin/rails new myapp --webpack ▸ bin/rails new

    myapp --webpack=react ▸ bin/rails new myapp --webpack=vue ▸ bin/rails new myapp —webpack=angular ▸ bin/yarn add [package] ▸ bin/yarn install/update
  20. IESHILͷࣄྫ Πϯϑϥ ▸ Herokuʢ~2018.05ʣ ▸ ্ཱͪ͛࣌ͷεϐʔυ༏ઌ ▸ ๛෋ͳΞυΦϯ ▸ Heroku

    Private Spaces ▸ TokyoϦʔδϣϯͰಈ࡞ ▸ 3ഒҎ্ߴ଎ʹʂ ▸ Ұ෦AWS
  21. IESHILͷࣄྫ ࣮ߦ؀ڥ ▸ ։ൃ؀ڥ ▸ MacʢϩʔΧϧʣ or CentOSʢOpenStackʣ ▸ PRຖͷಈ࡞֬ೝ؀ڥ

    ▸ Heroku Review Apps ▸ εςʔδϯά؀ڥ ▸ staging.ieshil.com ▸ ຊ൪؀ڥ ▸ www.ieshil.com
  22. IESHILͷࣄྫ CIʗDEPLOY ▸ CI ▸ GitHub + CircleCIʢtest+lintʣ ▸ Deploy

    ▸ ChatOps with slack ▸ /h deploy ieshil-front/master to prod
  23. IESHILͷࣄྫ RUBYGEMS ▸ Ϣʔβʔొ࿥ཁ݅ʢsorceryʗomniauthʣ ▸ ϝʔϧૹ৴ཁ݅ʢsendgrid4rʣ ▸ ը૾ॲཧཁ݅ʢdragonfly-s3_data_storeʗshrineʗimage_processing etc.ʣ ▸

    SEOཁ݅ʢgretelʗsitemap_generatorʣ ▸ API࿈ܞʢfaraday etc.ʣ ▸ δϣϒΩϡʔʢrescue etc.ʣ ▸ ։ൃิॿ ▸ Rails֦ுܥʢslim-railsʗseed-fuʗforemanʗconfigʗdotenv-railsʗpry-rails etc.ʣ ▸ ςετؔ࿈ʢrubocopʗrspecʗcapybaraʗselenium-webdriverʗturnipʗfactory_bot_railsʗdatabase_rewinder etc.ʣ ▸ ͦͷଞʢletter_opener_webʗslack-notifierʗrollbarʗbullet etc.ʣ
  24. IESHILͷࣄྫ APPԼͷߏ੒ ▸ Decoratorsʢactive_decoratorʣ ▸ FormsʢActiveModel::Modelʣ ▸ Importers ▸ Search

    ▸ Services ▸ Tasks ▸ Uploaders ▸ Validators ▸ ValuesʢActiveModel::Modelʣ
  25. IESHILͷࣄྫ σʔλΤϯδχΞϦϯάͷਏΈ ▸ ॲཧ࣌ؒ ▸ ໊دͤॲཧ ▸ ҟৗ஋ݕग़ ▸ ࢼߦࡨޡ

    ▸ લॲཧ ▸ ӡ༻Λߟྀͨ͠࢓૊Έͮ͘Γ ▸ ϏδωευϝΠϯ஌ࣝ ▸ ౷ܭʗػցֶशʗࣗવݴޠॲཧͳͲͷલఏ஌ࣝ
  26. IESHILͷࣄྫ ϒϨʔΫεϧʔϙΠϯτ·ͱΊ ▸ ཁ͔݅ΒRails։ൃج൫Λ੔͑Δ ▸ νʔϜ։ൃΛલఏͱͯ͠पลྖҬΛ੔උ͢Δ ▸ νʔϜ಺Ͱ߹ҙΛܗ੒͢Δ ▸ RubyGemsબఆ

    ▸ appԼͷߏ੒ ▸ ϑϩϯτΤϯυ ▸ Ϗοάσʔλʗػցֶशͱͷ޲͖߹͍ํ ▸ ୤ɾϞϊϦγοΫʢMonolithicʗ༁ɿҰຕ൘ͷʣ ▸ Private gem ▸ ϚΠΫϩαʔϏεԽʢస৬ձٞʣ
  27. IESHILͷࣄྫ ʲFYIʳΠϯλʔϯืूத@౦ژ ▸ ᶃձһొ࿥ͳͲKPIվળࢪࡦͷ࣮ࢪʢ2िؒ૝ఆʣ ▸ ᶄ֤छSEOࢪࡦͷ࣮ࢪʢ1ϲ݄૝ఆʣ ▸ αʔόʔαΠυʗϑϩϯτΤϯυΤϯδχΞͱͯ͠ɺσΟϨΫλʔ΍ΤϯδχΞɺσβΠφͱ ڠۀͯ͠վળࢪࡦʹ͍ͭͯৄࡉΛ٧Ίɺ։ൃʙϦϦʔε͢ΔɻඞཁʹԠͯ͡ϦϦʔεޙͷσʔ λ෼ੳʗධՁͳͲ΋ߦ͏ɻ

    ▸ ࢖༻ٕज़ɿHeroku, AWS, Rails, React, TypeScript, PostgreSQL, TresureDataͳͲɻ ▸ ᶅσʔλϑϩʔͷઃܭɾ੔උ(2िؒ~1ϲ݄૝ఆɺͦͷޙ΋Ԡ૬ஊ) ▸ ϫʔΫϑϩʔΤϯδϯʹΑΔλεΫઃܭ/੔උΛߦ͍ɺଐਓԽ͍ͯ͠ΔλεΫͷղফ΍ޮ཰Խ Λߦ͏ɻ ▸ ࢖༻ٕज़: Digdag, Embulk, PostgreSQL, TreasureDataͳͲɻ
  28. Q&A