まだRailsで消耗してるの?

Ba0b2e7a2783ae54f12665086315ed83?s=47 h3poteto
October 25, 2016

 まだRailsで消耗してるの?

Ba0b2e7a2783ae54f12665086315ed83?s=128

h3poteto

October 25, 2016
Tweet

Transcript

  1. ·ͩRailsͰ ফ໣ͯ͠Δͷʁ @h3_poteto

  2. About me • ෱ౡ ໌ • CrowdWorksͷRailsΤϯδχΞ • github: h3poteto

    • twitter: h3_poteto • ޷͖: Ѩ੅Ղಸ
  3. ·ͩRailsͰ ফ໣ͯ͠Δͷʁ

  4. ಥવͰ͕͢ɺ RailsͭΒ͘ͳ͍ʁ

  5. CrowdWorksͷRails͸ ͭΒ͍Ͱ͢

  6. ࠷ۙͷݴಈ • ͜ΕΠϯλʔϑΣʔεΛఆ͍͚ٛͨͩͩ͠ΑͶʁ • ͳΜͰԿ΋ҕৡ͠ͳ͍ͷʹϙϦϞʔϑΟοΫʁ • ໊લม͑Δͱ͔Өڹൣғ޿͗ͯ͢ແཧ • ΍ͬͺܕ͡ΌͶʁ

  7. ʊਓਓਓਓਓਓਓਓʊ ʼɹܕ͡ΌͶʁʂɹʻ ʉ̮̮̮̮̮̮̮̮

  8. goͷ࿩͔ͳʁ

  9. elixirͷ࿩͠·͢

  10. ͋Μ·Γਂ͍࿩͸͠ͳ͍Ͱ͢

  11. RailsΤϯδχΞͷͨΊͷ Phoenixೖ໳

  12. elixirͬͯʁ

  13. elixir • ErlangVM্Ͱಈ͘ • ؔ਺ܕ • rubyΈ͍ͨͳγϯλοΫε

  14. phoenixͬͯʁ

  15. phoenix • elixirͷwebϑϨʔϜϫʔΫ • ͍͍ͩͨRails

  16. ҰԠίϯύΠϧ͞Ε·͢

  17. ܕ͸ͳ͍

  18. RailsͰ͍͏˓˓͸ Ͳ͏΍Δͷʁ

  19. bundler

  20. mix͍ͬͯ͏ͷ͕͋Δ • bundler, rakeΛ߹ΘͤͨΈ͍ͨͳ • mix —help͢ΔͱԿ͕Ͱ͖Δ͔ݟ͑Δ

  21. Gemfile

  22. mix.exs • ґଘ͢Δhex(rubygems)Λॻ͘ • mix deps.getͯ͠Πϯετʔϧ • lockϑΝΠϧ΋࡞ΒΕΔ(mix.lock)

  23. mix.exs

  24. mix phoenix.newͨ͠Β ਽ܗ࡞ͬͯ͘Ε·͢

  25. mix phoenix.new

  26. mix phoenix.server

  27. mix phoenix.server • js, cssͷίϯύΠϧ΋ಉ࣌ʹͯ͘͠ΕΔ • devͰ͸Live reload΋ͯ͘͠ΕΔ

  28. generate

  29. generate • mix phoenix.gen.model ( rails g model ) •

    mix phoenix.gen.html ( rails g scaffold ) • σΟϨΫτϦߏ੒͸͍͍ͩͨRails
  30. σΟϨΫτϦߏ੒

  31. ActiveRecord

  32. Ecto • elixirͷORM • ͪΐͬͱػೳͷগͳ͍ActiveRecord • has_many, has_one, belongs_to౳΋࢖͑Δ

  33. Ecto • schemaͱ͍͏ͷΛఆٛ͢Δ

  34. Ecto • where, order, preload

  35. routing

  36. router.ex • mix phoenix.routesͰ֬ೝͰ͖Δ • จ๏΄΅Rails

  37. controller, view(template)

  38. ΄ͱΜͲRailsͩΖ͜Ε

  39. eex(erb)

  40. ςετ

  41. ExUnit • phoenixʹඪ४Ͱ͍ͭͯ͘Δςετ • Ϣχοτςετ͕Ͱ͖Δ • setup, setup_allʢRSpecͷbeforeͱ͸ͪΐͬ ͱҧ͏ •

    describe͸͋Δ
  42. ESpec • RSpecΈ͍ͨͳ…… • จ๏΄΅RSpec • before, let, describe, context…

  43. ESpec

  44. خ͔ͬͨ͜͠ͱ

  45. sprockets͕ͳ͍

  46. Sprocketsͱ͍͑͹…… • node͕ϝδϟʔ͡Όͳ͍࣌୅ʹΑ͘ؤுͬͨ • helperͱͷ૬ੑ΋ྑ͍ • precompileͯ͘͠ΕΔ

  47. Ͱ΋࠷ۙͭΒ͍

  48. ES6࢖͍͍ͨ

  49. React࢖͍͍ͨ

  50. browserifyͲ͏͠Α͏

  51. npm͕͍͍……

  52. None
  53. phoenixͷϑϩϯτΤϯυ • npmʹ৐͔ͬΔ • branchͰτϥϯεύΠϧ͍ͯ͠Δ • gulpͱ͔webpackʹมߋՄೳ

  54. phoenixͷϑϩϯτΤϯυ • devͰ͸มߋݕ஌ʴLive Reload • mix phoenix.serverίϚϯυͰશ෦΍ͬͯ͘Ε Δ • ຊ൪༻ʹ͸ɺmix

    phoenix.digest ( assets:precompile )
  55. ඇಉظॲཧ

  56. RailsͰඇಉظॲཧͬͯʁ • DelayedJobʢCrowdWorksͰ࢖ͬͯΔ • Resque • Sidekiq • ShoryukenʢCrowdWorksͰ࢖ͬͯΔ

  57. ͍ͣΕʹͯ͠΋ ϫʔΧʔΛผϓϩηεͰཱͪ ্͓͛ͯ͘

  58. Ωϡʔ΋redisͱ͔ࣗ෼Ͱ ༻ҙ͢Δ

  59. elixirͷඇಉظॲཧ • ͦ΋ͦ΋ܰྔϓϩηεͰಈ͍ͯΔ • OTP(actorͬΆ͍΍ͭ) • ৽͍͠ϓϩηε্ཱͪ͛ͯɺϝοηʔδΛૹ Ζ͏

  60. elixirͷඇಉظॲཧ • Taskͱ͔Agentͱ͍͏ͷ͕ͦ΋ͦ΋༻ҙ͞Εͯ ͍Δ • όοΫάϥ΢ϯυॲཧΛ͚ͨ͠Ε͹Taskʹ౤ ͛Δ͚ͩ

  61. elixirͷඇಉظॲཧ • ݁ՌΛ଴ͪड͚Δ͜ͱ΋Ͱ͖Δʢ଴ͨͳͯ͘ ΋͍͍

  62. elixirͷඇಉظॲཧ • ϓϩηεͷϦϯΫ • ࢠ͕ࢮΜͩͱ͖ʹ਌΋ࢮ͵ • ࢠ͕ࢮΜͰ΋਌͸Կ΋஌Β͞Εͳ͍ • ࢠ͕ࢮΜͩΒ਌ʹ௨஌͚ͩ͸ߦ͘

  63. Railsʹൺ΂Δͱ • Ωϡʔͷ؅ཧΛ͠ͳ͍͍ͯ͘ • sidekiqͱ͔ϓϩηεΛੜ͔͢͜ͱʹؾΛ࢖Θ ͳ͍͍ͯ͘ • ͦ΋ͦ΋Railsͬͯͦ͜·ͰεϨουηʔϑ ͡Όͳ͍Ͱ͠ΐ

  64. shoryukenͷίϛολʔͱઓ Θͳͯ͘΋͍͍!!!

  65. ϙϦϞʔϑΟοΫ

  66. RailsͷϙϦϞʔϑΟοΫ • ActiveRecord͕༻ҙͯ͘͠ΕͯΔ • **able_id, **able_typeͰDBςʔϒϧͷؔ࿈Λ ࡞ͬͯ͘ΕΔ

  67. ศརͳ͜ͱ΋͋Δ

  68. Ͱ΋୯७ʹΫϥεʹ ΠϯλʔϑΣʔεΛఆٛͨ͠ ͍ͱ͖΋͋Δ

  69. elixirͷprotocol • protocol͕ఆٛͰ͖Δ • ଴๬ͷΠϯλʔϑΣʔεͩΑʂʂʂ

  70. ظ଴

  71. modelͱschema ෼཭͢ΔͬͯΑ

  72. None
  73. RailsͰݴ͏ͱɺ model͕ActiveRecord͔Β ੾Γ཭͞ΕΔ

  74. ࣾ಺αʔϏε࡞ͬͯΔ

  75. None
  76. Yadockeri • ࣾ಺herokuΈ͍ͨͳ • CrowdWorksͷDockerίϯςφΛDocker swarm্ʹσϓϩΠ͢Δ • WebUIͱAPIΛ࡞੒

  77. ·ͱΊ • ͋·Γ෭࡞༻ͷ͋ΔϝιουΛॻ͘ؾʹͳΕ ͳ͍ • ΦϒδΣΫτͱ͔ͳ͍͠Ͷʂ • Ͱ΋τϥϯβΫγϣϯॻ͖࢝ΊΔͱؔ਺ײθϩ • sprocketsͳͲͳ͍ɺશ෦npmͩʂ

  78. ͓ΘΓ