Slide 1

Slide 1 text

Long Live Ride on Rails Koichi ITO / ESM, Inc.

Slide 2

Slide 2 text

@koic Community Manager at ESM, Inc RuboCop committer Active Record Oracle enhanced adapter committer Cucumber Committer T ech Speaker

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

Goal “Software is made for people by people” -Kenji Hiranabe (CEO at ESM, Inc.) * Oritinal phrase is “ιϑτ΢ΣΞ͸ਓ͕ਓͷͨΊʹ࡞͍ͬͯΔ” (JA) .

Slide 6

Slide 6 text

Agenda Context: A continuous team Stage of upgrading Rails application(s) One for all, All for one

Slide 7

Slide 7 text

Three laws for continuous software Money is Matter Money is Matter Money is Matter

Slide 8

Slide 8 text

Three laws for continuous software Money is Matter Money is Matter Money is Matter

Slide 9

Slide 9 text

Core members and temporary members Members will graduate someday But it will be done gently (minimize pain) Make core members (Increase truck number) The accumulated experience increases speed and quality to the system Members who know a lot of code can take the initiative to the team and proposals

Slide 10

Slide 10 text

Give members the same authorities Anyone can participate in the meeting Anyone can proposal a new feature Anyone can report a bug Anyone can review, merge, release, etc… Positions are different for each member

Slide 11

Slide 11 text

The real world development In fact, I think a specialized features will occur for each person, so it depends on that person Especially the author is detailed e.g. Review requests on GitHub I’m not sure if Mob and Pair Programming will solve it, but listening is important anyway

Slide 12

Slide 12 text

T o make change, and embrace change This story will talk about RailsApp that involved more than 20 developers over 
 5 years ago.

Slide 13

Slide 13 text

T o make change, and embrace change

Slide 14

Slide 14 text

Upgrade Rails for (new) developers motivation Which project do you like prefer, Rails 4.2 or Rails 5.2?

Slide 15

Slide 15 text

Stage of upgrading App bundle update without Rails Upgrading RailsApp Upgrading RailsApp(s) starts with you

Slide 16

Slide 16 text

5W1H of `bundle update` Who: Bancho or somebody When: Weekly, daily, or not (CI tools or a noticed member, With new features or only updated gem release) Where: local development -> CI -> staging -> production What: Dependent gems (`>= 5.1.0, < 6.0.0`) Why: A few (breaking) change is easy understand How: `bundle outdated`, `gemdiff` or others

Slide 17

Slide 17 text

When, Where When: Weekly, daily, or not (CI tools or a noticed member, with new features or only updated gem release) Where: local development -> CI -> staging -> production

Slide 18

Slide 18 text

Who, What Who: Bancho or somebody What: Dependent gems e.g. `>= 5.1.0, < 6.0.0`

Slide 19

Slide 19 text

Why, How Why: A few (breaking) change is easy understand How: `bundle outdated`, `gemdiff` or others

Slide 20

Slide 20 text

5W1H of `bundle update rails` Who: Bancho or somebody When: Beta 1, RC 1... (only updated gem release) Where: local development (early preparing `bump_rails_to_6_0` branch)-> CI -> staging -> production What: Rails and dependent gems Why: A few (breaking) change is easy understand How: `bundle update rails` or handcraft after investigate

Slide 21

Slide 21 text

When, Where When: Beta 1, RC 1... (only updated gem release, don’t include new features) Where: local development (early preparing `bump_rails_to_6_0` branch)-> CI -> staging -> production Don’t forget batch scripts

Slide 22

Slide 22 text

Who, What Who: Bancho or somebody What: Rails and dependent gems

Slide 23

Slide 23 text

Why, How Why: A few (breaking) change is easy understand How: `bundle update rails` or handcraft after investigate

Slide 24

Slide 24 text

Do you develop the way? Or wait? Rails 6.0 Beta 1 has been released You can opening a new (bug) issue You maybe able to fix the bug and reduction to upstream "Let's go upgrade Rails app by everyone." by Ginza.rb

Slide 25

Slide 25 text

First step: bundle update Loose the dependence of gems You can use the `:path` and `:github` options with Bundler When `bundle update` passes, it ends

Slide 26

Slide 26 text

`:path` option (1/2) Loose dependency of gemspec in local gem code % cd path/to/devise % git diff devise.gemspec - s.add_dependency("railties", ">= 4.1.0", "< 6.0") + s.add_dependency("railties", ">= 4.1.0", "< 6.1")

Slide 27

Slide 27 text

`:path` option (2/2) Specify the path where the code is being changed locally % cd path/to/rails-app % git diff Gemfile - gem 'devise' + gem 'devise', path: '/Users/ koic/src/github.com/ plataformatec/devise'

Slide 28

Slide 28 text

`:github` option Specify the URL where the code has been updated in remote repo (e.g. GH) % git diff Gemfile - gem 'activerecord- oracle_enhanced-adapter' + gem 'activerecord- oracle_enhanced-adapter', github: 'rsim/oracle-enhanced'

Slide 29

Slide 29 text

Second step: rails console Can you start the console without error? Can you use Active Record without error? If they do not pass, an error will also occur in “bin/rails server”

Slide 30

Slide 30 text

Example: Bullet % bin/rails c (snip) /Users/koic/.rbenv/versions/ 2.6.0/lib/ruby/gems/2.6.0/gems/ bullet-5.8.1/lib/bullet/ dependency.rb:32:in `active_record_version': Bullet does not support active_record 6.0.0.beta1 yet (RuntimeError)

Slide 31

Slide 31 text

Example: Devise 1: from /Users/koic/src/github.com/ plataformatec/devise/app/ controllers/devise_controller.rb: 4:in `' /Users/koic/src/github.com/ plataformatec/devise/app/ controllers/devise_controller.rb: 18:in `': undefined local variable or method `mimes_for_respond_to' for DeviseController:Class (NameError)

Slide 32

Slide 32 text

After that, rails s, testing… Code without automated tests Monthly or Weekly batch script, etc Please note the AC::Parameters when upgrading from Rails 4.2 to Rails 5.0 I made “Everlasting” gem https://github.com/koic/everlasting

Slide 33

Slide 33 text

Release cycle In terms of textbooks, it is better to separate feature release and bundle update release For example, when performance regression occurs in release, if it is only feature or bundle update release, we can quickly investigate the cause The reality is that bundle update whose change is known may be put in the feature release

Slide 34

Slide 34 text

You may encounter issue first with the upgrade Our team try to upgrade to Rails 5.2 from Rails 5.1 Unfortunately we reverted the release. The result reverted to Rails 5.1, but we were able to exposed the problem “ORA-03113 end-of-file on communication channel”

Slide 35

Slide 35 text

Rails/OSS patch meetup The Meetup hold in monthly at ESM, Inc We asked @yahonda in the meetup. He is an Oracle ACE and Oracle enhanced adapter maintainer

Slide 36

Slide 36 text

Enable TCP keepalive

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

The beginning of monkey patch Place the code commenting out the following in the config/initializers directory I often use “open class” there :-)

Slide 39

Slide 39 text

Monkey patch is a debt White box code monkey patch may break with gem upgrade Someday should be reduced to upstream And our troubled problem may be a troubled problem for everyone

Slide 40

Slide 40 text

My colleague started for Rails 6.0

Slide 41

Slide 41 text

At the end of a dream If you know where I mean When the mist just stars to clear -Long Live Rock’n’Roll (Rainbow)