Drupal devdays barcelona 2012 – Staging with git and drush

1,057 views
1,006 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,057
On SlideShare
0
From Embeds
0
Number of Embeds
561
Actions
Shares
0
Downloads
6
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Drupal devdays barcelona 2012 – Staging with git and drush

  1. 1. Staging with git & drushDienstag, 7. Mai 13
  2. 2. freistil ITMarkus Heurung – @muhhmarkus@freistil.itDienstag, 7. Mai 13
  3. 3. „Deploying“ the old wayindex.phpupdate.phpmodules/includes/sites/…Dienstag, 7. Mai 13
  4. 4. „Deploying“ the old wayindex.phpupdate.phpmodules/includes/sites/…FTPDienstag, 7. Mai 13
  5. 5. „Deploying“ the old wayindex.phpupdate.phpmodules/includes/sites/…FTPworkDienstag, 7. Mai 13
  6. 6. „Deploying“ the old wayindex.phpupdate.phpmodules/includes/sites/…FTPworkDienstag, 7. Mai 13
  7. 7. „Deploying“ the old wayindex.phpupdate.phpmodules/includes/sites/…FTPworkDienstag, 7. Mai 13
  8. 8. „Deploying“ the old wayindex.phpupdate.phpmodules/includes/sites/…FTPworkfixDienstag, 7. Mai 13
  9. 9. „Deploying“ the old wayindex.phpupdate.phpmodules/includes/sites/…FTPworkfixDienstag, 7. Mai 13
  10. 10. „Deploying“ the old wayindex.phpupdate.phpmodules/includes/sites/…FTPworkfixDienstag, 7. Mai 13
  11. 11. multiple developersindex.phpupdate.phpmodules/includes/sites/…index.phpupdate.phpmodules/includes/sites/…Dienstag, 7. Mai 13
  12. 12. multiple developersindex.phpupdate.phpmodules/includes/sites/…index.phpupdate.phpmodules/includes/sites/…Dienstag, 7. Mai 13
  13. 13. multiple developersindex.phpupdate.phpmodules/includes/sites/…index.phpupdate.phpmodules/includes/sites/…Dienstag, 7. Mai 13
  14. 14. write-write conflictmultiple developersindex.phpupdate.phpmodules/includes/sites/…index.phpupdate.phpmodules/includes/sites/…Dienstag, 7. Mai 13
  15. 15. SUCKS!Dienstag, 7. Mai 13
  16. 16. develop locally!Dienstag, 7. Mai 13
  17. 17. XAMPP/MAMPAcquia Dev DesktopLinuxMac OS XDienstag, 7. Mai 13
  18. 18. index.phpupdate.phpmodules/includes/sites/…Dienstag, 7. Mai 13
  19. 19. index.phpupdate.phpmodules/includes/sites/…index.phpupdate.phpmodules/includes/sites/…Dienstag, 7. Mai 13
  20. 20. Version ControlDienstag, 7. Mai 13
  21. 21. GitDienstag, 7. Mai 13
  22. 22. Repositoryindex.phpupdate.phpmodules/includes/sites/…put your code into gitDienstag, 7. Mai 13
  23. 23. Repositoryindex.phpupdate.phpmodules/includes/sites/…put your code into gitDienstag, 7. Mai 13
  24. 24. Some git basics$ git add $FILE(S)$ git commit $FILE(S)Dienstag, 7. Mai 13
  25. 25. some git basics$ git add docroot/$ git commit docroot/Dienstag, 7. Mai 13
  26. 26. the typical local git workflow$ [work …]$ git commit -am "meaningful message"$ [work …]$ git add sites/all/modules/custom/stuff/$ git commit -am "added stuff module"Dienstag, 7. Mai 13
  27. 27. Repositoryindex.phpupdate.phpmodules/includes/sites/…put your code into gitDienstag, 7. Mai 13
  28. 28. index.phpupdate.phpmodules/includes/sites/…transfer commitslocal integrationDienstag, 7. Mai 13
  29. 29. git remote repositoriesDienstag, 7. Mai 13
  30. 30. working with remotes$ git remote add integration git@integration.server:test.gitDienstag, 7. Mai 13
  31. 31. transfer commits$ git push integration$ git pull integrationDienstag, 7. Mai 13
  32. 32. index.phpupdate.phpmodules/includes/sites/…transfer commitslocal integrationpullpushDienstag, 7. Mai 13
  33. 33. index.phpupdate.phpmodules/includes/sites/…transfer commitslocal integrationindex.phpupdate.phpmodules/includes/sites/…pullpushDienstag, 7. Mai 13
  34. 34. let the serverdeploy the codeto its docrootDienstag, 7. Mai 13
  35. 35. git knows hooks!Dienstag, 7. Mai 13
  36. 36. .git/hooks/post-receive→ go to docroot and do a git pullDienstag, 7. Mai 13
  37. 37. What about sites/*/files?Dienstag, 7. Mai 13
  38. 38. not in git!Dienstag, 7. Mai 13
  39. 39. $ echo "sites/*/files" >> .gitignorelet git ignore itDienstag, 7. Mai 13
  40. 40. drushDienstag, 7. Mai 13
  41. 41. some drush basics$ drush pm-downlaod views$ drush pm-enable views$ drush pm-disable devel_themer$ drush pm-update$ drush updatedb$ drush variable_set site_offline 1Dienstag, 7. Mai 13
  42. 42. and most used$ drush cache-clear allDienstag, 7. Mai 13
  43. 43. drush knows remotes, too!Dienstag, 7. Mai 13
  44. 44. drush knows remotes, too!called site-aliasesDienstag, 7. Mai 13
  45. 45. drush site-aliasesaliases.drushrc.phpDienstag, 7. Mai 13
  46. 46. drush site-aliasesaliases.drushrc.php$aliases[integration] = array( uri => integration.server, root => /var/www/integration.server/docroot, remote-host => integration.server, remote-user => integration-user);Dienstag, 7. Mai 13
  47. 47. $ drush @integration statusdrush site-aliasesDienstag, 7. Mai 13
  48. 48. syncing files directoryDienstag, 7. Mai 13
  49. 49. use drush to sync files$ drush rsync default:%files @integration:%filesDienstag, 7. Mai 13
  50. 50. syncing the databaseDienstag, 7. Mai 13
  51. 51. in $aliases[integration]databases => array( default => array( default => array( driver => mysql, database => integration, username => integration, password => supersecret, host => localhost, prefix => , collation => utf8_general_ci, ), ),),Dienstag, 7. Mai 13
  52. 52. in $aliases[integration]path-aliases => array( %dump-dir => /home/integration-user/db-dumps,),command-specific => array( sql-sync => array ( no-cache => TRUE, sanitize => TRUE, structure-tables => array( common => array(cache, cache_menu, …, sessions, watchdog),),Dienstag, 7. Mai 13
  53. 53. sync your database$ drush sql-sync default @integrationDienstag, 7. Mai 13
  54. 54. next problem:Dienstag, 7. Mai 13
  55. 55. multiple developersnext problem:Dienstag, 7. Mai 13
  56. 56. no problemDienstag, 7. Mai 13
  57. 57. dev Adev Bintegrationindex.phpupdate.phpmodules/includes/sites/…Dienstag, 7. Mai 13
  58. 58. dev Adev Bintegrationindex.phpupdate.phpmodules/includes/sites/…Git is a distributed VCSDienstag, 7. Mai 13
  59. 59. summaryDienstag, 7. Mai 13
  60. 60. • no forgotten filessummaryDienstag, 7. Mai 13
  61. 61. • no forgotten files• much faster uploadssummaryDienstag, 7. Mai 13
  62. 62. • no forgotten files• much faster uploads• version historysummaryDienstag, 7. Mai 13
  63. 63. • no forgotten files• much faster uploads• version history• teamworksummaryDienstag, 7. Mai 13
  64. 64. • no forgotten files• much faster uploads• version history• teamwork• deployment to docroot on the serversummaryDienstag, 7. Mai 13
  65. 65. • no forgotten files• much faster uploads• version history• teamwork• deployment to docroot on the server• put as much in code as possiblesummaryDienstag, 7. Mai 13
  66. 66. • no forgotten files• much faster uploads• version history• teamwork• deployment to docroot on the server• put as much in code as possible• features, strongarm, install profiles, …summaryDienstag, 7. Mai 13
  67. 67. • no forgotten files• much faster uploads• version history• teamwork• deployment to docroot on the server• put as much in code as possible• features, strongarm, install profiles, …• hook_update_NsummaryDienstag, 7. Mai 13
  68. 68. code staginga possible workflowDienstag, 7. Mai 13
  69. 69. Dienstag, 7. Mai 13
  70. 70. bossdevdevdevdevDienstag, 7. Mai 13
  71. 71. bossintegrationdevdevdevdevDienstag, 7. Mai 13
  72. 72. bossintegrationdevdevdevdevDienstag, 7. Mai 13
  73. 73. bossintegrationstagedevdevdevdevDienstag, 7. Mai 13
  74. 74. bossintegrationstagedevdevdevdevDienstag, 7. Mai 13
  75. 75. bossintegrationstagelivedevdevdevdevDienstag, 7. Mai 13
  76. 76. bossintegrationstagelivedevdevdevdevDienstag, 7. Mai 13
  77. 77. bossintegrationstagelivedevdevdevdevDienstag, 7. Mai 13
  78. 78. bossintegrationstagelivedevdevdevdevDienstag, 7. Mai 13
  79. 79. LinksGithttp://git-scm.comhttp://gitref.org/index.htmlhttp://rogerdudler.github.com/git-guide/http://sitaramc.github.com/gitolite/Drushhttp://drush.orghttp://drupal.org/documentation/modules/drushDienstag, 7. Mai 13
  80. 80. Questions!Dienstag, 7. Mai 13
  81. 81. Thank you!Dienstag, 7. Mai 13

×