Skip to content

Instantly share code, notes, and snippets.

@kevinmtrowbridge
Created August 4, 2014 23:24
Show Gist options
  • Save kevinmtrowbridge/846aa5d29e53110f8be7 to your computer and use it in GitHub Desktop.
Save kevinmtrowbridge/846aa5d29e53110f8be7 to your computer and use it in GitHub Desktop.
example release plan -- June 2nd, 2012: migrate The Bold Italic from Engineyard to Heroku
RELEASE PLAN
==========================================================================
BEFORE STARTING:
* delete old files
cd ../convert_mysql_to_postgresql
rm *.dump *.sql
ssh tbi@thebolditalic.com
rm thebolditalic_production.sql.gz
* reset local hitrecord_production database
postgresql:
tbi3
RAILS_ENV=production rake db:drop db:create
verify with GUI
mysql:
mysql -uroot
DROP DATABASE thebolditalic_production; CREATE DATABASE thebolditalic_production;
verify with GUI
START TIMING
use iPhone timer w/Lap button
1) put up splash screen on legacy thebolditalic production
ey web disable --environment=thebolditalic_production_unicorn
2) PROD:
ssh tbi@thebolditalic.com
DEMO:
ssh tbi@184.73.213.198
3) PROD:
http://stackoverflow.com/questions/2167522/innodb-takes-over-an-hour-to-import-600mb-file-myisam-in-a-few-minutes
time mysqldump -u tbi -p thebolditalic --single-transaction --opt | gzip -9 > thebolditalic_production_fast_import.sql.gz
time mysqldump -u tbi -p thebolditalic --single-transaction | gzip -9 > thebolditalic_production.sql.gz
pwd: GTmDkpjYby
real 3m34
real 4m42.550s
real 5m31.759s
real 5m1.176s
DEMO:
time mysqldump -u tbi -p thebolditalic_demo --single-transaction | gzip -9 > thebolditalic_demo.sql.gz
pwd: 8jas2phjbp
4) exit
5) cd /Users/kmtrowbr/kmt/git/thebolditalic/convert_mysql_to_postgresql
6) PROD:
time scp tbi@thebolditalic.com:thebolditalic_production.sql.gz .
real 29m20.274s
real 34m35.952s
real 33m15.339s
DEMO:
time scp tbi@184.73.213.198:thebolditalic_demo.sql.gz .
real 1m54.970s
7) PROD:
time gunzip thebolditalic_production.sql.gz
real 2m17.876s
real 0m42.710s
real 0m53.239s
DEMO
time gunzip thebolditalic_demo.sql.gz
real 0m10.141s
8) PROD:
time pv thebolditalic_production.sql | mysql -u root -D thebolditalic_production
real 124m19.975s
real 88m8.643s
real 94m45.388s
DEMO:
time mysql -uroot thebolditalic_production < thebolditalic_demo.sql
real 8m41.473s
9) EDIT mysql2psql.yml then É
time mysql2psql
PROD:
real 23m53.770s
real 37m51.729s
real 34m22.736s
real 36m54.926s
DEMO:
real 7m13.171s
10) PROD:
time pg_dump -Fc --no-acl --no-owner thebolditalic_production > thebolditalic_production_postgresql.dump
real 0m34.462s
real 4m8.752s
real 1m55.050s
real 2m9.499s
DEMO:
time pg_dump -Fc --no-acl --no-owner thebolditalic_demo > thebolditalic_demo_postgresql.dump
real 0m29.089s
11) PROD:
time scp thebolditalic_production_postgresql.dump kevinmtrowbridge.com:/home/deploy/kevinmtrowbridge_com/current/public/thebolditalic_production_postgresql_nadE4af4.dump
real 63m30.267s
DEMO:
time scp thebolditalic_demo_postgresql.dump kevinmtrowbridge.com:/home/deploy/kevinmtrowbridge_com/current/public/thebolditalic_demo_postgresql_nadE4af4.dump
real 14m38.682s
12) cd ../rails3
13) heroku maintenance:on --app thebolditalic
13.5) heroku pg:reset HEROKU_POSTGRESQL_TEAL --app thebolditalic
14) PROD:
time heroku pgbackups:restore HEROKU_POSTGRESQL_TEAL http://kevinmtrowbridge.com/thebolditalic_production_postgresql_nadE4af4.dump --app thebolditalic
real 29m52.911s
real 31m17.239s
DEMO:
time heroku pgbackups:restore SHARED_DATABASE_URL http://kevinmtrowbridge.com/thebolditalic_demo_postgresql_nadE4af4.dump --app thebolditalic-demo
real 5m32.141s
15) DELETE DUMP FILE FOR SECURITY
ssh kevinmtrowbridge.com 'rm -rf /home/deploy/kevinmtrowbridge_com/current/public/thebolditalic_production_postgresql_nadE4af4.dump'
** DO AFTERWARDS --> 16) test that file is not there by going here w/browser:
http://kevinmtrowbridge.com/thebolditalic_demo_postgresql_nadE4af4.dump
16) Reset config variables É FACEBOOK_CONNECT_URI_SITE_URL, HOST_URI
** not sure if will have to do this yet but probably **
17) migrate database (move varchar(255) to text type)
time heroku run rake db:migrate --app thebolditalic
real 1m35.688s
19) turn on EMAIL
20) heroku maintenance:off --app thebolditalic
20.5) turn heroku scheduler jobs back on ...
21) ad hoc testing at http://thebolditalic.herokuapp.com
22) change DNS service
TOTAL TIME
10/28 -- 1h19m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment