20141210 rakuten techtalk

download 20141210 rakuten techtalk

of 100

  • date post

    12-Jul-2015
  • Category

    Technology

  • view

    2.743
  • download

    1

Embed Size (px)

Transcript of 20141210 rakuten techtalk

  • !How to Change Organization

    !

    Hiroshi SHIBATA @hsbt

    Rakuten TechTalk

  • SHIBATA !Hiroshi !@hsbt

  • ruby rubygems rake rdoc psych syck ruby-build

    railsgirls railsgirls-jp kaminari tdiary hiki jenkins.rb fastladder

    commit bit collector

  • Ruby Committer

  • asakusa.rb

  • RailsGirls in Japan

  • A long time ago..

  • Pepabo

    Hosting EC Media

  • Over 250 people

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

    M. Conway

  • PHP

    MySQL5

    PHP

    MySQL4

    Ruby and PHP

    Rails

    MySQL5

    Pepabo

  • JSOX

    github

    OSS

    Jenkins

    Ruby/Rails

    RDBMS

  • Pepabo

    PHP

    MySQL5

    PHP

    MySQL4

    Ruby and PHP

    Rails

    MySQL5

  • Ruby

    Rails

    MySQL5

    Ruby

    Rails

    MySQL5

    Ruby and PHP

    Rails

    MySQL5

    Pepabo

  • Why Ruby?

  • 3. references

    Why Ruby?

    2. environment1. testing

  • Testing

  • 3. rspec

    powerful testing framework

    2. minitest1. test-unit

  • Capybara

  • 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

  • 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

  • 3. run test -> fail -> detect fail reason

    Typical usecase

    2. add inspection code

    1. run test -> fail

    5. run test -> success

    4. fix code

  • 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

  • Typical usecase1. 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

  • Development Environment

    2. rbenv + ruby-build1. osx + homebrew

  • Many references

  • Why Rails?

  • 3. admin integration

    Why Rails?

    2. oss way1. modern architecture

  • enforce modern architecture

  • case.1 Ruby 1.8.6 to Ruby 2.1.2

  • http://30d.jp

  • from 2008/4

  • 380,000 users

    230,000,000 photos

  • Our Rails app46 models

    5000 lines in controllers

    400 lines in routes.rb1:1.3 code to test ratio

  • storage is over 450 TB

  • system architecture

  • application server

  • storage server

  • job server

  • transaction server

  • Ruby 1.8.6

    Rails 2.0.2

  • Ruby 1.8.6Rails 2.0.2

    Ruby 2.1.3Rails 4.1.6 new!

  • Ruby1.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

  • Rails 2.0

    Rails 2.3

  • Rails 2.0

    Rails 2.3

    hotfix A

    migration A

  • Rails 2.0

    Rails 2.3

    hotfix A

    migration A

  • Rails 2.0

    Rails 2.3

    hotfix A

    migration A

  • KyotoTycoon to

    memcached

    case.2 replace legacy middleware

  • app1

    app2

  • 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

  • kyoto tycoon is slower than mysql

    dalli is not support to kyoto tycoon

  • enforce oss way

  • Ruby

    Rails

    MySQL5

    Ruby

    Rails

    MySQL5

    Ruby and PHP

    Rails

    MySQL5

    Pepabo

  • Use trunk everyday.

  • 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

  • % 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

  • 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 => 'git@github.com:paperboy-all/osaipo_client.git', :branch => 'legacy'!gem 'jugem_client', :git => 'git@github.com:paperboy-all/jugem_client.git'!gem 'ppb_footer', :github => 'paperboy-all/ppb_footer'!

  • admin integration

  • 3. no console

    Whats admin?

    2. payment/refund1. customer support

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

    M. Conway

  • Developer DirectorCustomer

    Support

    Our Typical Team

  • unmaintained

  • 3. other app

    better admin

    2. Rails Engine1. app internal

  • app internalpros better testing better deploycons including difference application including effective code

  • Rails Enginepros splitting application code better deploycons difficulty testing cant use production code directly

  • Other apppros definitely splitting app

    cons separated develop cycle duplicated code

  • No silver bullet

  • Rails

    like a php

    MySQL5

    Rails

    like a java

    MySQL5

    Rails

    like a php

    MySQL5

    Optimize Your Company

  • ,,Web,Web,,,,,

  • PO

  • Lern to Rails

    Internal step by

    step

  • Lern to Active Record Internal

  • github workflow

  • ChatOps

    github issue

    costomers contact

    nagios

  • DevOps

  • 4 deploy/day

  • Go to the next

    10 years