Rails meetup deployments tricks

Preview:

DESCRIPTION

A talk given at the San Francisco Rails Meetup about deployments tips and tricks.

Citation preview

@smathieurainforest

Deployment:!tips and tricks

@smathieurainforest

Why?

Deployments are scary

Major cause of downtime

Wasted time

@smathieurainforest

About

@smathieu

“We only deploy 20 times per day”

@smathieurainforest

Tip #1

@smathieurainforest

@smathieurainforest

Tip #2

@smathieurainforest

Have a staging server

rainforest @smathieu

@smathieurainforest

Tip #3

@smathieurainforest

@smathieurainforest

Tip #4

@smathieurainforest

Deploying Without Downtime

@smathieurainforest

Migrations

Major challenge to get right

It gets harder with data

@smathieurainforest

ActiveRecord’s Column Cache

@smathieurainforest

@smathieurainforest

Don’t delete columns

rename_column :users, :notes, :deprecated_notes_2014_01_01

@smathieurainforest

Adding Indexes

Slows on large tables

Locks the table

@smathieurainforest

Postgres

CREATE INDEX CONCURRENTLY

@smathieurainforest

MySQLPercona Toolkit:

http://www.percona.com/software/percona-toolkit

Facebook’s Online Schema Change:

https://www.facebook.com/notes/mysql-at-facebook/online-schema-change-for-mysql/

430801045932

@smathieurainforest

Renaming Columns

Don’t do it

@smathieurainforest

@smathieurainforest

Tip #5

@smathieurainforest

Having a staging server is nice, but…

@smathieurainforest

… on demand staging is better

@smathieurainforest

And many more…

@smathieurainforest

Conclusion

Your CI should be the only thing deploying your code

No-Downtime Deployments are harder, but possible

Invest in your deployment processes

rainforest @smathieu

Questions?

@smathieurainforest

Links

https://github.com/jipiboily/fourchette

https://www.facebook.com/notes/mysql-at-facebook/online-schema-change-for-mysql/430801045932

http://www.percona.com/software/percona-toolkit

Recommended