Slide 1

Slide 1 text

! How to Change Organization ! Hiroshi SHIBATA @hsbt Rakuten TechTalk

Slide 2

Slide 2 text

SHIBATA ! Hiroshi ! @hsbt

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

ruby rubygems rake rdoc psych syck ruby-build railsgirls railsgirls-jp kaminari tdiary hiki jenkins.rb fastladder commit bit collector

Slide 5

Slide 5 text

Ruby Committer

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

จࣈ

Slide 8

Slide 8 text

asakusa.rb

Slide 9

Slide 9 text

RailsGirls in Japan

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

΋ͬͱ ͓΋͠Ζ͘ Ͱ͖Δ

Slide 12

Slide 12 text

ຊࣾ ࢧࣾ

Slide 13

Slide 13 text

"MPOHUJNFBHP

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

Pepabo Hosting EC Media

Slide 19

Slide 19 text

0WFSQFPQMF

Slide 20

Slide 20 text

organizations which design systems ... are constrained to produce designs which are copies of the communication structures of these organizations — M. Conway

Slide 21

Slide 21 text

PHP MySQL5 PHP MySQL4 Ruby and PHP Rails MySQL5 Pepabo

Slide 22

Slide 22 text

ϛυϧ΢ΣΞͷΞοϓάϨʔυ ࣾ಺։ൃج൫ͷߏங ౷ܭج൫ͷߏங +409ͷӡ༻੔උ HJUIVC ηΩϡϦςΟ؂ࠪ ίʔυϨϏϡʔ ςετج൫ͷߏங ΞΫηεղੳج൫ͷߏங ։ൃϓϩηε ৽ਓڭҭ ݪߘࣥච ΧϯϑΝϨϯεൃද 044։ൃ αʔόʔߏ੒؅ཧͷ࡮৽ ϦʔϯελʔτΞοϓ +FOLJOT 3VCZ3BJMT 3%#.4 ٕज़ج൫νʔϜ

Slide 23

Slide 23 text

Pepabo ٕज़ج൫νʔϜ PHP MySQL5 PHP MySQL4 Ruby and PHP Rails MySQL5

Slide 24

Slide 24 text

Ruby Rails MySQL5 Ruby Rails MySQL5 Ruby and PHP Rails MySQL5 Pepabo ٕज़ج൫νʔϜ

Slide 25

Slide 25 text

Why Ruby?

Slide 26

Slide 26 text

3. references Why Ruby? 2. environment 1. testing

Slide 27

Slide 27 text

Testing

Slide 28

Slide 28 text

3. rspec powerful testing framework 2. minitest 1. test-unit

Slide 29

Slide 29 text

Capybara

Slide 30

Slide 30 text

1) Failure: TestPowerAssert#test_power_assert_failed [test/test_power_assert.rb:10]: assert { "0".class == "3".to_i.times.map {|i| i + 1 }.class } | | | | | | | | | Array | | | [1, 2, 3] | | # | 3 String Power Assert

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

1) Failure: TestPowerAssert#test_power_assert_failed [test/test_power_assert.rb:10]: assert { "0".class == "3".to_i.times.map {|i| i + 1 }.class } | | | | | | | | | Array | | | [1, 2, 3] | | # | 3 String class TestPowerAssert < Minitest::Test! def test_power_assert_failed! assert { "0".class == "3".to_i.times.map {|i| i + 1 }.class }! end! end testcase assertion

Slide 33

Slide 33 text

3. run test -> fail -> detect fail reason Typical usecase 2. add inspection code 1. run test -> fail 5. run test -> success 4. fix code

Slide 34

Slide 34 text

3. run test -> fail -> detect fail reason Typical usecase 2. add inspection code 1. run test -> fail 5. run test -> fail!!! -> turn to 2 4. fix code

Slide 35

Slide 35 text

Typical usecase 1. run test -> fail 5. run test -> fail!!! -> turn to 4 4. fix code 1) Failure: TestPowerAssert#test_power_assert_failed [test/test_power_assert.rb:10]: assert { "0".class == "3".to_i.times.map {|i| i + 1 }.class } | | | | | | | | | Array | | | [1, 2, 3] | | # | 3 String

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

Development Environment 2. rbenv + ruby-build 1. osx + homebrew

Slide 38

Slide 38 text

Many references

Slide 39

Slide 39 text

Why Rails?

Slide 40

Slide 40 text

3. admin integration Why Rails? 2. oss way 1. modern architecture

Slide 41

Slide 41 text

enforce modern architecture

Slide 42

Slide 42 text

case.1 Ruby 1.8.6 to Ruby 2.1.2

Slide 43

Slide 43 text

http://30d.jp

Slide 44

Slide 44 text

from 2008/4

Slide 45

Slide 45 text

380,000 users 230,000,000 photos

Slide 46

Slide 46 text

Our Rails app 46 models 5000 lines in controllers 400 lines in routes.rb 1:1.3 code to test ratio

Slide 47

Slide 47 text

storage is over 450 TB

Slide 48

Slide 48 text

system architecture

Slide 49

Slide 49 text

application server

Slide 50

Slide 50 text

storage server

Slide 51

Slide 51 text

job server

Slide 52

Slide 52 text

transaction server

Slide 53

Slide 53 text

Ruby 1.8.6 Rails 2.0.2

Slide 54

Slide 54 text

Ruby 1.8.6 Rails 2.0.2 Ruby 2.1.3 Rails 4.1.6 new!

Slide 55

Slide 55 text

Ruby 1.8.6 1.8.7 1.9.3 2.0.0 2.1 Rails 2.0/2.1 2.3 3.0 3.2 4.0/4.1

Slide 56

Slide 56 text

Rails 2.0 Rails 2.3

Slide 57

Slide 57 text

Rails 2.0 Rails 2.3 hotfix A migration A

Slide 58

Slide 58 text

Rails 2.0 Rails 2.3 hotfix A migration A

Slide 59

Slide 59 text

Rails 2.0 Rails 2.3 hotfix A migration A

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

KyotoTycoon to memcached case.2 replace legacy middleware

Slide 63

Slide 63 text

app1 app2

Slide 64

Slide 64 text

begin! require 'dalli'! rescue LoadError => e! $stderr.puts "You don't have dalli installed in your application. Please add it to your Gemfile and run bundle install"! raise e! end rails4 need to dalli

Slide 65

Slide 65 text

kyoto tycoon is slower than mysql… dalli is not support to kyoto tycoon…

Slide 66

Slide 66 text

No content

Slide 67

Slide 67 text

enforce oss way

Slide 68

Slide 68 text

Ruby Rails MySQL5 Ruby Rails MySQL5 Ruby and PHP Rails MySQL5 Pepabo ٕज़ج൫νʔϜ

Slide 69

Slide 69 text

Use trunk everyday.

Slide 70

Slide 70 text

No content

Slide 71

Slide 71 text

No content

Slide 72

Slide 72 text

No content

Slide 73

Slide 73 text

class Bar! def bar(foo = foo())! foo! end! ! def buzz(foo = foo)! foo! end! ! def foo! :buzz! end! end! ! p Bar.new.bar! p Bar.new.buzz

Slide 74

Slide 74 text

% ruby -v r45272.rb! ruby 2.2.0dev (2014-04-13 trunk 45580) [x86_64-darwin13]! :buzz! nil! ! ! ! ! ! ! ! % ruby -v r45272.rb! ruby 2.1.2p80 (2014-03-01 revision 45231) [x86_64-darwin13.0]! :buzz! :buzz

Slide 75

Slide 75 text

No content

Slide 76

Slide 76 text

source 'https://rubygems.org'! ! gem 'rails', '~> 2.3.18'! gem 'rake', '~> 0.9.2'! gem 'rdoc'! gem 'rake-confirm'! ! gem 'mysql'! gem "mysql_retry_lost_connection"! gem 'acts_as_paranoid', :github => 'paperboy-30days/acts_as_paranoid'! gem 'passenger', '~> 3.0'! gem 'memcache-client', :require => 'memcache'! gem 'system_timer'! gem 'yajl-ruby', :require => 'yajl'! gem 'will_paginate', '~> 2.3'! gem 'mail'! ! gem 'sass'! gem 'compass-rails'! ! gem 'osaipo_client', :git => '[email protected]:paperboy-all/ osaipo_client.git', :branch => 'legacy'! gem 'jugem_client', :git => '[email protected]:paperboy-all/ jugem_client.git'! gem 'ppb_footer', :github => 'paperboy-all/ppb_footer'!

Slide 77

Slide 77 text

admin integration

Slide 78

Slide 78 text

3. no console What’s admin? 2. payment/refund 1. customer support

Slide 79

Slide 79 text

organizations which design systems ... are constrained to produce designs which are copies of the communication structures of these organizations — M. Conway

Slide 80

Slide 80 text

Developer Director Customer Support Our Typical Team

Slide 81

Slide 81 text

VONBJOUBJOFEʜ

Slide 82

Slide 82 text

3. other app better admin 2. Rails Engine 1. app internal

Slide 83

Slide 83 text

app internal pros better testing better deploy cons including difference application including effective code

Slide 84

Slide 84 text

Rails Engine pros splitting application code better deploy cons difficulty testing can’t use production code directly

Slide 85

Slide 85 text

Other app pros definitely splitting app cons separated develop cycle duplicated code

Slide 86

Slide 86 text

No silver bullet

Slide 87

Slide 87 text

Rails like a php MySQL5 Rails like a java MySQL5 Rails like a php MySQL5 Optimize Your Company ٕज़ج൫νʔϜ

Slide 88

Slide 88 text

Ͱ͖Δ͚ͩ௕͍ؒ ϢʔβʹՁ஋Λ ఏڙ͠ ར५ΛੜΈଓ͚Δ8FCαʔ ϏεΛӡӦ͢ΔͨΊʹ͸ ܧଓతͳ վળΛߦ͏͜ͱ͕ඞཁͰ͢ɻ8FCαʔ ϏεΛվળ͢Δʹ͸ ٕज़తͳऔΓ૊ Έ͸΋ͪΖΜ ։ൃ౤ࢿͱͦͷϦλʔ ϯͱ͍͏ܦӦతͳ؍఺ νʔϜϏϧ σΟϯάͳͲͷ։ൃϓϩηε Ϗδω εϝτϦΫε΁ͷ஫ࢹͳͲ ߟྀ͢΂ ͖͜ͱ͕ͨ͘͞Μ͋Γ·͢ɻ

Slide 89

Slide 89 text

εΫϥϜ͸ɺʮෳࡶͰมԽͷܹ͍͠ ໰୊ʯʹରԠ͢Δ͜ͱΛୈҰ໨ඪ ͱͨ͠ΞδϟΠϧ։ൃख๏Ͱ͢ɻ਺ ͋ΔΞδϟΠϧ։ൃख๏ͷதͰ΋ɺ ͍·ѹ౗తʹ࠾༻͞Ε͍ͯ·͢ɻ ɹ ຊಛूͰ͸ɺݱࡏͷιϑτ΢ΣΞ ։ൃʹ͓͚ΔεΫϥϜͷҙ͔ٛΒɺ ࣮ࡍͷݱ৔ʹ͓͚ΔऔΓ૊Έ· ͰɺεΫϥϜΛపఈղઆ͠·͢ɻ

Slide 90

Slide 90 text

ฏು͞ΜʹΑΔߨԋ

Slide 91

Slide 91 text

ΞδϟΠϧಋೖݚम

Slide 92

Slide 92 text

10ݚम

Slide 93

Slide 93 text

Lern to Rails Internal step by step

Slide 94

Slide 94 text

Lern to Active Record Internal

Slide 95

Slide 95 text

github workflow

Slide 96

Slide 96 text

ChatOps github issue costomer’s contact nagios

Slide 97

Slide 97 text

DevOps

Slide 98

Slide 98 text

4 deploy/day

Slide 99

Slide 99 text

Go to the next 10 years

Slide 100

Slide 100 text

΋ͬͱ ͓΋͠Ζ͘ Ͱ͖Δ