Slide 1

Slide 1 text

Monolithic Rails: 
 deal with it Railsclub 2016 Kir Shatrov

Slide 2

Slide 2 text

Kir Shatrov Developer acceleration @ Shopify " Rails, Capistrano, RubyBench

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

Developer acceleration team

Slide 5

Slide 5 text

Rails Ruby Developer Tools

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

git clone … brew install postgres brew install redis bundle install rake db:create

Slide 8

Slide 8 text

git clone … brew install postgres brew install redis bundle install rake db:create где-то тут ломается nokogiri

Slide 9

Slide 9 text

git clone … brew install postgres brew install redis rake db:create vagrant up

Slide 10

Slide 10 text

VM creation is slow VM has to be updated every week from Chef Development in VM is slower VM file system has limitations for frontend stuff

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

The xhyve hypervisor is a port of bhyve to OS X. It is built on top of Hypervisor.framework in OS X 10.10 Yosemite and higher, runs entirely in userspace, and has no other dependencies.

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

install Homebrew packages provision language and dependencies ruby, node, go create and prepare database setup Git hooks

Slide 15

Slide 15 text

git clone … brew install postgres brew install redis rake db:create dev up

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

Detect dangerous patterns ☠

Slide 18

Slide 18 text

Detect dangerous patterns changing existing migrations adding new gems changing application configuration

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

⚓ CI ⚓

Slide 21

Slide 21 text

50 000

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

⚰ Rails upgrade

Slide 29

Slide 29 text

1. Make your application boot (fix gem conflicts) 2. Setup two Gemfiles and two CI statuses 3. Fix failings tests 4. Deploy to 10% of nodes

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

1. Make your application boot (fix gem conflicts) 2. Setup two Gemfiles and two CI statuses 3. Fix failings tests 4. Deploy to 10% of nodes

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

1. Make your application boot (fix gem conflicts) 2. Setup two Gemfiles and two CI statuses 3. Fix failings tests 4. Gradually deploy

Slide 36

Slide 36 text

⏱ Application boot ⏱

Slide 37

Slide 37 text

$ rails new railsclub --skip-spring $ time bundle exec rails runner "puts 1+1" 2 0.64s user 0.09s system 24% cpu 2.969 total

Slide 38

Slide 38 text

require 'activerecord' require '/Users/kir/Projects/shopify/vendor/bundle/gems/ activerecord-4.2.7.1/lib/activerecord.rb'

Slide 39

Slide 39 text

github.com/byroot/bootscale

Slide 40

Slide 40 text

Rails hacks

Slide 41

Slide 41 text

block any external calls from inside database transaction instrument Net::HTTP by host lint database migrations circuit breaker

Slide 42

Slide 42 text

continuous improvements share as many tools as possible make people happy

Slide 43

Slide 43 text

shopify.com/careers

Slide 44

Slide 44 text

@kirs @kirshatrov Спасибо!