wp migrations

Click here to load reader

Post on 19-Jun-2015

335 views

Category:

Software

1 download

Embed Size (px)

DESCRIPTION

"WordPress Migrations Done Right" - my talk from WCEU

TRANSCRIPT

  • 1. WORDPRESSMIGRATIONSDONE RIGHT

2. @dvkanchevsiteground.com 3. 1. PREPARATION2. DRY RUN3. REAL MIGRATION 4. thePREPARATION 5. WEBSITE TRAFFIC 6. USERS HABITS 7. PROMOTIONS 8. ASK USERS WHENTO MIGRATE 9. INFORMEVERYONE 10. INFORMEVERYONE1. Notify Existing Users 11. PREPARE FORDOWNTIME 12. PREPARE FORDOWNTIME1. Create a Maintenance Page 13. thePREPARATIONRecap 14. Choose The Best TimeInform Your VisitorsPrepare For Downtime 15. theDRY RUN 16. WHAT ISA DRY RUNMIGRATION? 17. ALWAYS PERFORMA DRY RUN !!! 18. CREATE BACKUP 19. CREATE BACKUP1. USE SSH COMMANDS2. USE WORDPRESS PLUGINS3. USE PLATFORM TOOLS 20. MY CHOICEmysqldump danielka_wslp254> db_backup.sql!tar zcvf backup.tar.gzpublic_html 21. TRANSFER BACKUP 22. MY CHOICErsync -e "ssh -p 22" -rlptDH--delete /home/BACKUP_FILEserver.com:/home/ 23. OTHER TOOLS1. WordPress Plugins2. WP-CLI3. cPanel pkgacct/restorepkg4. FTP, scp, etc. 24. RESTORE BACKUP 25. TEST FROMNEW SERVER 26. LOCAL HOSTS FILE181.224.135.75 domain.com181.224.135.75 www.domain.com181.224.128.31 shop.domain.com 27. NOT INVENTEDwhile ($WP_broken=TRUE) {wp_resolve_issue();$Damn_it++;} 28. EXAMPLE 1PHP SERIALIZEDDATA 29. Before MigrationAfter Migrationa:2:{i:0;s:11:website.com;i:1;s:0:;}a:2:{i:0;s:11:new.website.com;i:1;s:0:;} 30. SOLUTIONS1. WP-CLIwp search-replace domain.com new.domain.com2. http://goo.gl/E4R4Wh 31. EXAMPLE 2SPECIALIZEDWP HOSTS 32. WP-CONFIG.PHP$varnish=array ( 0 => 'pod-1191', );$memcached_servers=array (155.2.4.1 );define( ROOT_FOLDER', '/nas/wp' ); 33. theDRY RUNRecap 34. What Is a Dry Run?Backup->Transfer->RestoreTest And Resolve Issues 35. the REALMIGRATION 36. MAINTENANCEMODE 37. SOME .htaccessTRICKS 38. THE CODERewriteEngine OnRewriteCond %{REMOTE_ADDR} !^123.56.89.12RewriteCond %{DOCUMENT_ROOT}/maintenance.html -fRewriteCond %{DOCUMENT_ROOT}/maintenance.enable -fRewriteCond %{SCRIPT_FILENAME} !maintenance.htmlRewriteRule ^.*$ /maintenance.html [R=503,L]ErrorDocument 503 /maintenance.htmlHeader Set Retry-After 14400"Header Set Cache-Control "max-age=0, no-store" 39. FINAL DATA SYNC 40. FINAL DATA SYNCrsync -e "ssh -p 22" -aHp --delete /home/SITE/server.com:/home/SITE/ 41. DNS PROPAGATION 42. DNS PROPAGATIONOLD SERVER NEW SERVER 43. SOLUTION 1REMOTE MYSQLOLD SERVER NEW SERVER 44. SOLUTION 2IPTABLES REDIRECTOLD SERVER NEW SERVER 45. IPTABLES TRAFFICREDIRECTsysctl -w net.ipv4.ip_forward=1iptables -P FORWARD ACCEPTiptables -F FORWARDiptables -t nat -F PREROUTINGiptables -t nat -F POSTROUTINGiptables -t nat -I PREROUTING -j DNAT -d $OLD_IP --to $NEW_IPiptables -t nat -I POSTROUTING -j SNAT -d $NEW_IP --to $OLD_IP 46. FINAL CHECKS ANDMODIFICATIONS 47. the REALRecapMIGRATION 48. Maintenance ModeFinal Data SyncDNS and Data Loss 49. FAQ 50. QUESTIONS ? 51. THANK [email protected]@siteground.com