まだRailsで消耗してるの?
by
h3poteto
Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
·ͩRailsͰ ফͯ͠Δͷʁ @h3_poteto
Slide 2
Slide 2 text
About me • ౡ ໌ • CrowdWorksͷRailsΤϯδχΞ • github: h3poteto • twitter: h3_poteto • ͖: ѨՂಸ
Slide 3
Slide 3 text
·ͩRailsͰ ফͯ͠Δͷʁ
Slide 4
Slide 4 text
ಥવͰ͕͢ɺ RailsͭΒ͘ͳ͍ʁ
Slide 5
Slide 5 text
CrowdWorksͷRails ͭΒ͍Ͱ͢
Slide 6
Slide 6 text
࠷ۙͷݴಈ • ͜ΕΠϯλʔϑΣʔεΛఆ͍͚ٛͨͩͩ͠ΑͶʁ • ͳΜͰԿҕৡ͠ͳ͍ͷʹϙϦϞʔϑΟοΫʁ • ໊લม͑Δͱ͔Өڹൣғ͗ͯ͢ແཧ • ͬͺܕ͡ΌͶʁ
Slide 7
Slide 7 text
ʊਓਓਓਓਓਓਓਓʊ ʼɹܕ͡ΌͶʁʂɹʻ ʉ̮̮̮̮̮̮̮̮
Slide 8
Slide 8 text
goͷ͔ͳʁ
Slide 9
Slide 9 text
elixirͷ͠·͢
Slide 10
Slide 10 text
͋Μ·Γਂ͍͠ͳ͍Ͱ͢
Slide 11
Slide 11 text
RailsΤϯδχΞͷͨΊͷ Phoenixೖ
Slide 12
Slide 12 text
elixirͬͯʁ
Slide 13
Slide 13 text
elixir • ErlangVM্Ͱಈ͘ • ؔܕ • rubyΈ͍ͨͳγϯλοΫε
Slide 14
Slide 14 text
phoenixͬͯʁ
Slide 15
Slide 15 text
phoenix • elixirͷwebϑϨʔϜϫʔΫ • ͍͍ͩͨRails
Slide 16
Slide 16 text
ҰԠίϯύΠϧ͞Ε·͢
Slide 17
Slide 17 text
ܕͳ͍
Slide 18
Slide 18 text
RailsͰ͍͏˓˓ Ͳ͏Δͷʁ
Slide 19
Slide 19 text
bundler
Slide 20
Slide 20 text
mix͍ͬͯ͏ͷ͕͋Δ • bundler, rakeΛ߹ΘͤͨΈ͍ͨͳ • mix —help͢ΔͱԿ͕Ͱ͖Δ͔ݟ͑Δ
Slide 21
Slide 21 text
Gemfile
Slide 22
Slide 22 text
mix.exs • ґଘ͢Δhex(rubygems)Λॻ͘ • mix deps.getͯ͠Πϯετʔϧ • lockϑΝΠϧ࡞ΒΕΔ(mix.lock)
Slide 23
Slide 23 text
mix.exs
Slide 24
Slide 24 text
mix phoenix.newͨ͠Β ܗ࡞ͬͯ͘Ε·͢
Slide 25
Slide 25 text
mix phoenix.new
Slide 26
Slide 26 text
mix phoenix.server
Slide 27
Slide 27 text
mix phoenix.server • js, cssͷίϯύΠϧಉ࣌ʹͯ͘͠ΕΔ • devͰLive reloadͯ͘͠ΕΔ
Slide 28
Slide 28 text
generate
Slide 29
Slide 29 text
generate • mix phoenix.gen.model ( rails g model ) • mix phoenix.gen.html ( rails g scaffold ) • σΟϨΫτϦߏ͍͍ͩͨRails
Slide 30
Slide 30 text
σΟϨΫτϦߏ
Slide 31
Slide 31 text
ActiveRecord
Slide 32
Slide 32 text
Ecto • elixirͷORM • ͪΐͬͱػೳͷগͳ͍ActiveRecord • has_many, has_one, belongs_to͑Δ
Slide 33
Slide 33 text
Ecto • schemaͱ͍͏ͷΛఆٛ͢Δ
Slide 34
Slide 34 text
Ecto • where, order, preload
Slide 35
Slide 35 text
routing
Slide 36
Slide 36 text
router.ex • mix phoenix.routesͰ֬ೝͰ͖Δ • จ๏΄΅Rails
Slide 37
Slide 37 text
controller, view(template)
Slide 38
Slide 38 text
΄ͱΜͲRailsͩΖ͜Ε
Slide 39
Slide 39 text
eex(erb)
Slide 40
Slide 40 text
ςετ
Slide 41
Slide 41 text
ExUnit • phoenixʹඪ४Ͱ͍ͭͯ͘Δςετ • Ϣχοτςετ͕Ͱ͖Δ • setup, setup_allʢRSpecͷbeforeͱͪΐͬ ͱҧ͏ • describe͋Δ
Slide 42
Slide 42 text
ESpec • RSpecΈ͍ͨͳ…… • จ๏΄΅RSpec • before, let, describe, context…
Slide 43
Slide 43 text
ESpec
Slide 44
Slide 44 text
خ͔ͬͨ͜͠ͱ
Slide 45
Slide 45 text
sprockets͕ͳ͍
Slide 46
Slide 46 text
Sprocketsͱ͍͑…… • node͕ϝδϟʔ͡Όͳ͍࣌ʹΑ͘ؤுͬͨ • helperͱͷ૬ੑྑ͍ • precompileͯ͘͠ΕΔ
Slide 47
Slide 47 text
Ͱ࠷ۙͭΒ͍
Slide 48
Slide 48 text
ES6͍͍ͨ
Slide 49
Slide 49 text
React͍͍ͨ
Slide 50
Slide 50 text
browserifyͲ͏͠Α͏
Slide 51
Slide 51 text
npm͕͍͍……
Slide 52
Slide 52 text
No content
Slide 53
Slide 53 text
phoenixͷϑϩϯτΤϯυ • npmʹ͔ͬΔ • branchͰτϥϯεύΠϧ͍ͯ͠Δ • gulpͱ͔webpackʹมߋՄೳ
Slide 54
Slide 54 text
phoenixͷϑϩϯτΤϯυ • devͰมߋݕʴLive Reload • mix phoenix.serverίϚϯυͰશ෦ͬͯ͘Ε Δ • ຊ൪༻ʹɺmix phoenix.digest ( assets:precompile )
Slide 55
Slide 55 text
ඇಉظॲཧ
Slide 56
Slide 56 text
RailsͰඇಉظॲཧͬͯʁ • DelayedJobʢCrowdWorksͰͬͯΔ • Resque • Sidekiq • ShoryukenʢCrowdWorksͰͬͯΔ
Slide 57
Slide 57 text
͍ͣΕʹͯ͠ ϫʔΧʔΛผϓϩηεͰཱͪ ্͓͛ͯ͘
Slide 58
Slide 58 text
Ωϡʔredisͱ͔ࣗͰ ༻ҙ͢Δ
Slide 59
Slide 59 text
elixirͷඇಉظॲཧ • ͦͦܰྔϓϩηεͰಈ͍ͯΔ • OTP(actorͬΆ͍ͭ) • ৽͍͠ϓϩηε্ཱͪ͛ͯɺϝοηʔδΛૹ Ζ͏
Slide 60
Slide 60 text
elixirͷඇಉظॲཧ • Taskͱ͔Agentͱ͍͏ͷ͕ͦͦ༻ҙ͞Εͯ ͍Δ • όοΫάϥϯυॲཧΛ͚ͨ͠ΕTaskʹ ͛Δ͚ͩ
Slide 61
Slide 61 text
elixirͷඇಉظॲཧ • ݁ՌΛͪड͚Δ͜ͱͰ͖Δʢͨͳͯ͘ ͍͍
Slide 62
Slide 62 text
elixirͷඇಉظॲཧ • ϓϩηεͷϦϯΫ • ࢠ͕ࢮΜͩͱ͖ʹࢮ͵ • ࢠ͕ࢮΜͰԿΒ͞Εͳ͍ • ࢠ͕ࢮΜͩΒʹ௨͚ͩߦ͘
Slide 63
Slide 63 text
RailsʹൺΔͱ • ΩϡʔͷཧΛ͠ͳ͍͍ͯ͘ • sidekiqͱ͔ϓϩηεΛੜ͔͢͜ͱʹؾΛΘ ͳ͍͍ͯ͘ • ͦͦRailsͬͯͦ͜·ͰεϨουηʔϑ ͡Όͳ͍Ͱ͠ΐ
Slide 64
Slide 64 text
shoryukenͷίϛολʔͱઓ Θͳ͍͍ͯ͘!!!
Slide 65
Slide 65 text
ϙϦϞʔϑΟοΫ
Slide 66
Slide 66 text
RailsͷϙϦϞʔϑΟοΫ • ActiveRecord͕༻ҙͯ͘͠ΕͯΔ • **able_id, **able_typeͰDBςʔϒϧͷؔ࿈Λ ࡞ͬͯ͘ΕΔ
Slide 67
Slide 67 text
ศརͳ͜ͱ͋Δ
Slide 68
Slide 68 text
Ͱ୯७ʹΫϥεʹ ΠϯλʔϑΣʔεΛఆٛͨ͠ ͍ͱ͖͋Δ
Slide 69
Slide 69 text
elixirͷprotocol • protocol͕ఆٛͰ͖Δ • ͷΠϯλʔϑΣʔεͩΑʂʂʂ
Slide 70
Slide 70 text
ظ
Slide 71
Slide 71 text
modelͱschema ͢ΔͬͯΑ
Slide 72
Slide 72 text
No content
Slide 73
Slide 73 text
RailsͰݴ͏ͱɺ model͕ActiveRecord͔Β Γ͞ΕΔ
Slide 74
Slide 74 text
ࣾαʔϏε࡞ͬͯΔ
Slide 75
Slide 75 text
No content
Slide 76
Slide 76 text
Yadockeri • ࣾherokuΈ͍ͨͳ • CrowdWorksͷDockerίϯςφΛDocker swarm্ʹσϓϩΠ͢Δ • WebUIͱAPIΛ࡞
Slide 77
Slide 77 text
·ͱΊ • ͋·Γ෭࡞༻ͷ͋ΔϝιουΛॻ͘ؾʹͳΕ ͳ͍ • ΦϒδΣΫτͱ͔ͳ͍͠Ͷʂ • ͰτϥϯβΫγϣϯॻ͖࢝ΊΔͱؔײθϩ • sprocketsͳͲͳ͍ɺશ෦npmͩʂ
Slide 78
Slide 78 text
͓ΘΓ