Your SlideShare is downloading. ×
DevOps: Cooking Drupal Deployment
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

DevOps: Cooking Drupal Deployment

2,928
views

Published on

This presentation is aimed on how to automated the Drupal deployment using tools like Git, Drush, Features, and hook_update API.

This presentation is aimed on how to automated the Drupal deployment using tools like Git, Drush, Features, and hook_update API.

Published in: Technology

0 Comments
8 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,928
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
39
Comments
0
Likes
8
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Drupal Developers Day 2013 Microsoft PH 6750 Ayala Avenue, Makati City
  • 2. Our Goal?
  • 3. Zero Touch Deployment
  • 4. Zero Downtime During Deployment
  • 5. Deployment Syndrome Fear of Change (before and after delivery)
  • 6. Deployment Syndrome It works on my machine*
  • 7. Deployment Syndrome Silo-isolation (different software stack)
  • 8. DevOps { 'Drupal': cooking => deployment, } Gerald Villorente Senior DevOps Engineer | Open-Source Enthusiast
  • 9. FTP used to transfer files from one host to another host over a TCP-based network
  • 10. Prehistoric
  • 11. Slow
  • 12. Not Secure
  • 13. No version control
  • 14. Manual Configuration
  • 15. Risky
  • 16. Repetitive
  • 17. Solution?
  • 18. Automate not applicable in shared-hosting
  • 19. Tools
  • 20. Git Git /ɡɪt/ is a distributed revision control and source code management (SCM) system with an emphasis on speed. - Wikipedia
  • 21. Git Hooks: Post  Post-code-deploy (post-merge, post-checkout, etc)  Post-db-copy  Post-files-copy
  • 22. Git Hooks: Post-code-deploy drush -vdy @domain.prod updb drush -vdy @domain.prod fra drush -vdy @domain.prod cc all
  • 23. Git Hooks: Post-code-deploy drush drush drush drush -vdy -vdy -vdy -vdy @domain.uat @domain.uat @domain.uat @domain.uat cc all updb fra cc all
  • 24. Git Hooks: Post-code-deploy drush drush drush drush -vdy -vdy -vdy -vdy @domain.stage @domain.stage @domain.stage @domain.stage cc all updb fra cc all
  • 25. Git Hooks: Post-code-deploy drush drush drush drush -vdy -vdy -vdy -vdy @domain.dev @domain.dev @domain.dev @domain.dev cc all updb fra cc all
  • 26. Git Hooks: Post-db-copy drush drush drush drush @domain.uat @domain.uat @domain.uat @domain.uat cc all updb -y fra -y cc all
  • 27. Git Hooks: Post-db-copy drush @domain.stage cc all drush @domain.stage updb -y drush @domain.stage en views_ui -y drush @domain.stage en context_ui -y drush @domain.stage fra -y drush @domain.stage dis chartbeat -y drush @domain.stage vset cdn_status 0 -y drush @domain.stage solr-vset conf[apachesolr_read_only] 1 -y drush @domain.stage vset preprocess_js 0 -y drush @domain.stage vset preprocess_css 0 -y drush @domain.stage vset purge_proxy_urls 'http://stage.domain.com/?purge_method=ah' -y drush @domain.stage cc all
  • 28. Git Hooks: Post-db-copy drush @domain.dev cc all drush @domain.dev updb -y drush @domain.dev en views_ui -y drush @domain.dev en context_ui -y drush @domain.dev fra -y drush @domain.dev dis chartbeat -y drush @domain.dev vset cdn_status 0 -y drush @domain.dev vset conf[apachesolr_read_only] 1 -y drush @domain.dev vset preprocess_js 0 -y drush @domain.dev vset preprocess_css 0 -y drush @domain.dev vset purge_proxy_urls 'http://stage.domain.com/?purge_method=ah' -y drush @domain.dev cc all
  • 29. Git Hooks: Post-files-copy  Will run after finished copying files - from prod to uat, stage, and or dev - from uat to stage or dev - from stage to uat or dev - from dev to uat or stage
  • 30. Managing Files  Don't put in version control  Use rsync
  • 31. Git Hooks: Pre  Pre-commit  Prepare-commit-msg  Pre-applypatch  Pre-rebase
  • 32. Drush is a command-line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those who spend their working hours hacking away at the command prompt
  • 33. Drush: Clear Cache Command: $ drush cc all
  • 34. Drush: Run hook_update Command: $ drush updb -y $ drush @domain.prod updb -y
  • 35. Drush Make
  • 36. Drush: Make Capabilities  Downloading Drupal core, as well as contrib modules from drupal.org.  Checking code out from SVN, git, and bzr repositories.    Getting plain `.tar.gz` and `.zip` files (particularly useful for libraries that can not be distributed directly with drupal core or modules). Fetching and applying patches. Fetching modules, themes, and installation profiles, but also external libraries.
  • 37. Useful Drush Commands not really important in deployment
  • 38. Drush: SQL Login Command: $ drush sql-cli
  • 39. Drush: SQL Query Command: $ drush sqlq “UPDATE users SET pass=$S$DHaDeIifGS5qiS7ghhEolZ9lbaRTkZh/UcU.dh ZY0Rpp1gUooEpQ WHERE uid=1”
  • 40. Drush: SQL Sync Command: $ drush sql-sync @prod @dev
  • 41. Drush: SQL Create Command: $ drush sql-create $ drush @domain.dev sql-create
  • 42. Drush: SQL Drop Command: $ drush sql-drop $ drush @domain.dev sql-drop
  • 43. Drush: SQL Dump Command: $ drush sql-dump --result-file=../bck.sql Options: --gzip --result-file
  • 44. Drush: Variable Set Command: $ drush vset preprocess_js 1 -y
  • 45. Drush: Module Enable Command: $ drush en views -y $ drush en features views_ui -y
  • 46. Drush: Module Disable Command: $ drush dis views -y $ drush dis features views_ui -y
  • 47. Drush: Module Uninstall Command: $ drush pm-uninstall views -y $ drush pm-uninstall ctools views -y
  • 48. Drush: One-time Login Command: $ drush uli gerald $ drush uli –browser=firefox --mail=drush@example.org
  • 49. Drush: Update Password Command: $ drush upwd gerald --password=foo
  • 50. Use Site Alias Allows you to execute Drush commands in target remote server via ssh Command: $ drush @domain.prod updb -y
  • 51. Features Enables the capture and management of features in Drupal. A feature is a collection of Drupal entities which taken together satisfy a certain use-case.
  • 52. Features: Create
  • 53. Features: Manage
  • 54. Features: Module
  • 55. Features: Drush Integration features-revert-all (fra) Revert all enabled feature module on your site. Command: drush fra -y Options: --force
  • 56. Bash A command processor, typically run in a text window, allowing the user to type commands which cause actions. Bash can also read commands from a file, called a script. Like all Unix shells, it supports filename wildcarding, piping, here documents, command substitution, variables and control structures for condition-testing and iteration. - Wikipedia
  • 57. Bash Scripting: Sample #!/usr/bin/env bash path=”sites/all/default/files” if [ ! -d “$path”]; then mkdir $path chown www-data:www-data $path fi
  • 58. Bash Scripting: Drush #!/usr/bin/env bash drush cc all drush updb -y drush fra -y drush cc all echo “Delployment done!”
  • 59. I don't know Bash! You can also use Python, Shell, or Perl. Use the one that you're comfortable with. Just remember, DRY and KISS.
  • 60. Drupal API
  • 61. hook_update_N
  • 62. hook_update_N: Sample /** * Enable Test module. */ function test_update_7001() { $module = array('test'); module_enable($module); }
  • 63. Demo
  • 64. What we achieved?
  • 65. We used Git to managed the entire deployment.
  • 66. We used Features to capture database changes.
  • 67. We used Drush to run the hook_update_N, revert the features, and clear the cache.
  • 68. We created a Bash script that contains deployment process run by Git.
  • 69. Related DevOps Tools
  • 70. Puppet Open-souce automation software that helps system administrators manage infrastructure throughout its lifecycle, from provisioning and configuration to orchestration and reporting.
  • 71. Chef A systems and cloud infrastructure automation framework that makes it easy to deploy servers and applications to any physical, virtual, or cloud location, no matter the size of the infrastructure.
  • 72. Ansible Ansible configures operating systems, deploys applications, runs parallel commands, and orchestrates IT processes like zero-downtime rolling updates. It uses SSH by default, so no special software has to be installed to start managing remote machines. Modules can be written in any language.
  • 73. Juju Juju is a powerful service orchestration tool from Ubuntu that helps you define, configure and deploy services to any cloud quickly and easily.
  • 74. Capistrano Capistrano was originally designed to simplify and automate deployment of web applications to distributed environments.
  • 75. Docker Docker is an open-source project to easily create lightweight, portable, self-sufficient containers from any application. The same container that a developer builds and tests on a laptop can run at scale, in production, on VMs, bare metal, OpenStack clusters, public clouds and more.
  • 76. Foreman for managing physical and virtual server
  • 77. Travis CI distributed continuous integration service used to build and test projects
  • 78. Jenkins An extendable open source continuous integration server. Built with Java, it provides 829 plugins to support building and testing virtually any project.
  • 79. Maven Maven allows a project to build using its project object model (POM) and a set of plugins that are shared by all projects using Maven, providing a uniform build system.
  • 80. rsync Is a file transfer program for Unix systems. rsync uses the "rsync algorithm" which provides a very fast method for bringing remote files into sync. It does this by sending just the differences in the files across the link, without requiring that both sets of files are present at one of the ends of the link beforehand.
  • 81. Questions?
  • 82. Resoures  http://devops.com  http://devo.ps  http://dev2ops.org  http://devopsweekly.com  http://devopsdays.org  http://drush.ws  http://try.github.io  http://tldp.org/LDP/abs/html
  • 83. Contact Details http://about.me/gerald.villorente
  • 84. 10-26-13