SlideShare una empresa de Scribd logo
1 de 33
Descargar para leer sin conexión
Automated Drupal
deployment with
Git & Capistrano
Farez Rahman
Freelance Drupal developer
Co-founder: OnSavvy.com
About this session
Git+Capistrano for deployment
Mainly Capistrano
Overview - not too detailed
Input/feedback/questions from you guys
Lots of info online - links at the end
Show of hands please...
Some sort of automated deployment process
Git and Capistrano
Git only + SSH
FTP/SFTP
Aegir?
Drush?
Pantheon?
No idea!
Goal
Automated deployment:
reduce manual human error
Anyone can deploy:
startup = speed is important
Wins...
Reduced multiple steps turned into one step
ssh, git pull, update db, revert features, clear
cache...
“cap deploy”
Wins...
Less steps missed out due to human error
Wins...
No manual SSH into server
great for non-geeks
Wins...
Doing more for each deploy
just add to deploy script
Wins...
Quick to rollback
“cap deploy:rollback”
Wins
Less boring
Costs...
Setup costs...
capistrano, ruby
training for other team members
Costs
Security
potential to run malicious commands on server
from developer’s machine
Why capistrano
Looked at a few options (git hooks, Jenkins,
capistrano)
capistrano - simple, does the job for us
Drupal deploy scripts available (capdrupal,
capistrano-drupal)
Capistrano
Ruby Gem
Remote control for server commands
No server-side installations
Runs over SSH
Our setup
CapDrupal (Ruby Gem)
Drupal-specific Capistrano tasks
We use modified version of CapDrupal
There are others (cap-drupal, capistrano-
drupal...)
CapDrupal (Ruby Gem)...
Drush
CapDrupal needs Drush on your server
Capistrano itself doesn’t..
but no Drush = limited options
How to deploy
1. Make local changes
2. git commit and push
3. $ “cap deploy”
That’s it
What “cap deploy” does
SSH into server
Takes site offline
Backup of db (using drush & backup_migrate)
Clones latest revision from dev branch
Points site root to that latest clone
Runs update db
Reverts features
Clears cache
Puts site back online
Directory structure on server
current -> releases/20130805211651 (symlink)
releases/
20130801135258
20130805211547
20130805211651
shared/
cached-copy/
files/
settings.php
NB: running “cap deploy:setup” creates the dir structure
Before “cap deploy”
current -> releases/20130805211651
releases/
20130801135258
20130805211547
20130805211651
shared/
cached-copy/
files/
settings.php
After “cap deploy”
current -> releases/20130805212640 (points to new clone)
releases/
20130801135258
20130805211547
20130805211651
20130805212640 <- new git clone
shared/
cached-copy/
files/
settings.php
Local directory structure
app/ <- drupal root
config/
deploy.rb <- project specific settings
dev.rb <- site specific settings
live.rb
Capfile
deploy.rb
Local directory structure
app/ <- drupal root
config/
deploy.rb <- project specific settings
dev.rb <- site specific settings
live.rb
Capfile
dev.rb
Rolling back
“cap deploy:rollback”
Doesn't rollback database
But can create custom cap tasks to do that
Customisations to Capdrupal
“backup db”, “update db”, “revert features”
= not relevant when only updating CSS
so we removed them from deploy task
can be run by themselves when needed
All Capistrano tasks “cap -T”
Potential improvements
Create backups of db, that can be rolled back
(e.g new copy of db and settings.php for each
new deploy)
Fully automated deployment, continuous
integration
References
YouTube:
- Simple and powerful site deployment with capistrano - by
Kim Pepper - http://youtu.be/ulK-lhv8eI0
- DrupalCon Munich 2012: Deploy with Capistrano - by
Michael Priest - http://youtu.be/fvkiWfjmKQ4
Github:
https://github.com/antistatique/capdrupal
https://github.com/previousnext/capistrano-drupal
https://github.com/capistrano
Google capistrano drupal
Feel free to get in touch
Farez Rahman
slideshare.net/onsavvy
onsavvy.com/profile/farez-rahman
d.o: user/261497
Twitter: farez
farez @ redkeydigital.com

Más contenido relacionado

La actualidad más candente

La actualidad más candente (19)

Jenkins to Gitlab - Intelligent Build-Pipelines
Jenkins to Gitlab - Intelligent Build-PipelinesJenkins to Gitlab - Intelligent Build-Pipelines
Jenkins to Gitlab - Intelligent Build-Pipelines
 
Jenkins days workshop pipelines - Eric Long
Jenkins days workshop  pipelines - Eric LongJenkins days workshop  pipelines - Eric Long
Jenkins days workshop pipelines - Eric Long
 
Getting Started With Jenkins And Drupal
Getting Started With Jenkins And DrupalGetting Started With Jenkins And Drupal
Getting Started With Jenkins And Drupal
 
Getting started with Octopus Deploy
Getting started with Octopus DeployGetting started with Octopus Deploy
Getting started with Octopus Deploy
 
"13 ways to run web applications on the Internet" Andrii Shumada
"13 ways to run web applications on the Internet" Andrii Shumada"13 ways to run web applications on the Internet" Andrii Shumada
"13 ways to run web applications on the Internet" Andrii Shumada
 
Improve your Java Environment with Docker
Improve your Java Environment with DockerImprove your Java Environment with Docker
Improve your Java Environment with Docker
 
Intro to Git for Drupal 7
Intro to Git for Drupal 7Intro to Git for Drupal 7
Intro to Git for Drupal 7
 
Madison PHP 2015 - DevOps For Small Teams
Madison PHP 2015 - DevOps For Small TeamsMadison PHP 2015 - DevOps For Small Teams
Madison PHP 2015 - DevOps For Small Teams
 
Learn jobDSL for Jenkins
Learn jobDSL for JenkinsLearn jobDSL for Jenkins
Learn jobDSL for Jenkins
 
Test-Driven Infrastructure with Chef
Test-Driven Infrastructure with ChefTest-Driven Infrastructure with Chef
Test-Driven Infrastructure with Chef
 
Automated Infrastructure and Application Management
Automated Infrastructure and Application ManagementAutomated Infrastructure and Application Management
Automated Infrastructure and Application Management
 
Brujug Jenkins pipeline scalability
Brujug Jenkins pipeline scalabilityBrujug Jenkins pipeline scalability
Brujug Jenkins pipeline scalability
 
CI : the first_step: Auto Testing with CircleCI - (MOSG)
CI : the first_step: Auto Testing with CircleCI - (MOSG)CI : the first_step: Auto Testing with CircleCI - (MOSG)
CI : the first_step: Auto Testing with CircleCI - (MOSG)
 
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
 
Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners
 
Learning chef
Learning chefLearning chef
Learning chef
 
7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users
 
1. react - native: setup
1. react - native: setup1. react - native: setup
1. react - native: setup
 
Drupal Continuous Integration with Jenkins - Deploy
Drupal Continuous Integration with Jenkins - DeployDrupal Continuous Integration with Jenkins - Deploy
Drupal Continuous Integration with Jenkins - Deploy
 

Destacado

169 Ch 26_lecture_presentation
 169 Ch 26_lecture_presentation 169 Ch 26_lecture_presentation
169 Ch 26_lecture_presentation
gwrandall
 
169 Ch 27_lecture_presentation
 169 Ch 27_lecture_presentation 169 Ch 27_lecture_presentation
169 Ch 27_lecture_presentation
gwrandall
 
163 ch 17_lecture_presentation
163 ch 17_lecture_presentation163 ch 17_lecture_presentation
163 ch 17_lecture_presentation
gwrandall
 
163 ch 15_lecture_presentation
163 ch 15_lecture_presentation163 ch 15_lecture_presentation
163 ch 15_lecture_presentation
gwrandall
 
163 ch 01_lecture_presentation
163 ch 01_lecture_presentation163 ch 01_lecture_presentation
163 ch 01_lecture_presentation
gwrandall
 
163 ch 11_lecture_presentation
163 ch 11_lecture_presentation163 ch 11_lecture_presentation
163 ch 11_lecture_presentation
gwrandall
 
163 ch 07_lecture_presentation
163 ch 07_lecture_presentation163 ch 07_lecture_presentation
163 ch 07_lecture_presentation
gwrandall
 
169 Ch 28_lecture_presentation
 169 Ch 28_lecture_presentation 169 Ch 28_lecture_presentation
169 Ch 28_lecture_presentation
gwrandall
 
163 ch 14_lecture_presentation
163 ch 14_lecture_presentation163 ch 14_lecture_presentation
163 ch 14_lecture_presentation
gwrandall
 
169 Ch 21_lecture_presentation
 169 Ch 21_lecture_presentation 169 Ch 21_lecture_presentation
169 Ch 21_lecture_presentation
gwrandall
 
169 Ch 19_lecture_presentation
 169 Ch 19_lecture_presentation 169 Ch 19_lecture_presentation
169 Ch 19_lecture_presentation
gwrandall
 
169 Ch 23_lecture_presentation
 169 Ch 23_lecture_presentation 169 Ch 23_lecture_presentation
169 Ch 23_lecture_presentation
gwrandall
 
169 Ch 22_lecture_presentation
 169 Ch 22_lecture_presentation 169 Ch 22_lecture_presentation
169 Ch 22_lecture_presentation
gwrandall
 
169 Ch 20_lecture_presentation
 169 Ch 20_lecture_presentation 169 Ch 20_lecture_presentation
169 Ch 20_lecture_presentation
gwrandall
 
169 Ch 29_lecture_presentation
 169 Ch 29_lecture_presentation 169 Ch 29_lecture_presentation
169 Ch 29_lecture_presentation
gwrandall
 
163 ch 19_lecture_presentation
163 ch 19_lecture_presentation163 ch 19_lecture_presentation
163 ch 19_lecture_presentation
gwrandall
 

Destacado (20)

TirtheshPrajapatiBday
TirtheshPrajapatiBdayTirtheshPrajapatiBday
TirtheshPrajapatiBday
 
Prueba gbi
Prueba gbiPrueba gbi
Prueba gbi
 
Flp web app presentation
Flp web app presentationFlp web app presentation
Flp web app presentation
 
169 Ch 26_lecture_presentation
 169 Ch 26_lecture_presentation 169 Ch 26_lecture_presentation
169 Ch 26_lecture_presentation
 
169 Ch 27_lecture_presentation
 169 Ch 27_lecture_presentation 169 Ch 27_lecture_presentation
169 Ch 27_lecture_presentation
 
163 ch 17_lecture_presentation
163 ch 17_lecture_presentation163 ch 17_lecture_presentation
163 ch 17_lecture_presentation
 
163 ch 15_lecture_presentation
163 ch 15_lecture_presentation163 ch 15_lecture_presentation
163 ch 15_lecture_presentation
 
Propiedades de los materiales
Propiedades de los materialesPropiedades de los materiales
Propiedades de los materiales
 
163 ch 01_lecture_presentation
163 ch 01_lecture_presentation163 ch 01_lecture_presentation
163 ch 01_lecture_presentation
 
163 ch 11_lecture_presentation
163 ch 11_lecture_presentation163 ch 11_lecture_presentation
163 ch 11_lecture_presentation
 
163 ch 07_lecture_presentation
163 ch 07_lecture_presentation163 ch 07_lecture_presentation
163 ch 07_lecture_presentation
 
169 Ch 28_lecture_presentation
 169 Ch 28_lecture_presentation 169 Ch 28_lecture_presentation
169 Ch 28_lecture_presentation
 
163 ch 14_lecture_presentation
163 ch 14_lecture_presentation163 ch 14_lecture_presentation
163 ch 14_lecture_presentation
 
169 Ch 21_lecture_presentation
 169 Ch 21_lecture_presentation 169 Ch 21_lecture_presentation
169 Ch 21_lecture_presentation
 
169 Ch 19_lecture_presentation
 169 Ch 19_lecture_presentation 169 Ch 19_lecture_presentation
169 Ch 19_lecture_presentation
 
169 Ch 23_lecture_presentation
 169 Ch 23_lecture_presentation 169 Ch 23_lecture_presentation
169 Ch 23_lecture_presentation
 
169 Ch 22_lecture_presentation
 169 Ch 22_lecture_presentation 169 Ch 22_lecture_presentation
169 Ch 22_lecture_presentation
 
169 Ch 20_lecture_presentation
 169 Ch 20_lecture_presentation 169 Ch 20_lecture_presentation
169 Ch 20_lecture_presentation
 
169 Ch 29_lecture_presentation
 169 Ch 29_lecture_presentation 169 Ch 29_lecture_presentation
169 Ch 29_lecture_presentation
 
163 ch 19_lecture_presentation
163 ch 19_lecture_presentation163 ch 19_lecture_presentation
163 ch 19_lecture_presentation
 

Similar a Automated Drupal deployment with Git and Capistrano

Embracing Distributed Version Control
Embracing Distributed Version ControlEmbracing Distributed Version Control
Embracing Distributed Version Control
Nowell Strite
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
tomcopeland
 
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison DowdneySetting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
Weaveworks
 

Similar a Automated Drupal deployment with Git and Capistrano (20)

Embracing Distributed Version Control
Embracing Distributed Version ControlEmbracing Distributed Version Control
Embracing Distributed Version Control
 
Development Setup of B-Translator
Development Setup of B-TranslatorDevelopment Setup of B-Translator
Development Setup of B-Translator
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient way
 
Git
GitGit
Git
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with Capistrano
 
Git workflows presentation
Git workflows presentationGit workflows presentation
Git workflows presentation
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
Adopt DevOps philosophy on your Symfony projects (Symfony Live 2011)
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
 
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
 
Instrumentación de entrega continua con Gitlab
Instrumentación de entrega continua con GitlabInstrumentación de entrega continua con Gitlab
Instrumentación de entrega continua con Gitlab
 
Deploying TYPO3 Neos websites using Surf
Deploying TYPO3 Neos websites using SurfDeploying TYPO3 Neos websites using Surf
Deploying TYPO3 Neos websites using Surf
 
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison DowdneySetting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
Setting up Notifications, Alerts & Webhooks with Flux v2 by Alison Dowdney
 
Introduction to FreeNAS development by John Hixson
Introduction to FreeNAS development by John HixsonIntroduction to FreeNAS development by John Hixson
Introduction to FreeNAS development by John Hixson
 
Professional deployment
Professional deploymentProfessional deployment
Professional deployment
 
Acquia BLT for the Win, or How to speed up the project setup, development an...
Acquia BLT for the Win, or  How to speed up the project setup, development an...Acquia BLT for the Win, or  How to speed up the project setup, development an...
Acquia BLT for the Win, or How to speed up the project setup, development an...
 
Использование Docker в CI / Александр Акбашев (HERE Technologies)
Использование Docker в CI / Александр Акбашев (HERE Technologies)Использование Docker в CI / Александр Акбашев (HERE Technologies)
Использование Docker в CI / Александр Акбашев (HERE Technologies)
 
Version Control ThinkVitamin
Version Control ThinkVitaminVersion Control ThinkVitamin
Version Control ThinkVitamin
 
Magento Performance Optimization 101
Magento Performance Optimization 101Magento Performance Optimization 101
Magento Performance Optimization 101
 
Capistrano
CapistranoCapistrano
Capistrano
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Último (20)

Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 

Automated Drupal deployment with Git and Capistrano