SlideShare a Scribd company logo
Revealing Hour Creations 
Sagar P Junnarkar 
sj@revealinghour.in 
@sagarjunnarkar
Deployment with capistrano
How do we deploy? 
FTP,SFTP,SCP? 
SSH+GIT? 
Debian packages? 
Don’t know? Other team does it for you.
What are the issues 
●Lot of manual processes 
-backup db, update code, update db etc. 
●Room for error. steps could be missed. 
●Small organisation : loose server access and 
permissions 
●Large organisation : too restrictive 
permissions. locked down server env
What do we need?
What do we need? 
●Give limited power to developers 
●Automate entire deployment process
System admins don’t want you to 
touching their stuff
System admins don’t want you to 
touching their stuff 
Standard server env: 
●Convention 
●Consistency 
●Security 
●Monitoring
working together to get the job done
working together to get the job done 
●Developers are able to deploy rapidly 
●Sys admins have tight control of environments 
●All manual process are automated
Capistrano www.capistranorb.com 
●Introduced around 2006 
by Jamis Buck of 37 signals 
●Written in ruby, initially for rails project 
●It is a developer tool for deploying web 
applications. It is typically installed on your 
workstation and used to deploy your SCM to 
one or more servers.
Simplest explanation 
●Lets you write scripts that say “ssh onto 
remote machine and do things.” 
●Program your deployment actions
Setup and configuration 
gem install capistrano 
cap -T # List all commands 
capify . #capistrano v2 
cap install #capistrano v3
Local Directory Structure 
├── Capfile 
├── config 
│ ├── deploy 
│ │ ├── production.rb 
│ │ └── staging.rb 
│ └── deploy.rb 
└── lib 
└── capistrano 
└── tasks 
├── Capfile 
├── config 
│ ├── deploy.rb
Server Directory Structure 
myapp/releases 
myapp/current -> releases/20141001001122 
myapp/shared
Symlink for shared files 
Symlinks are made back to the shared folder, 
so they are not lost between deployments. 
e.g. myapp/current/uploads -> myapp/shared/uploads
How does it works 
●No software installed on server, just locally 
●Capistrano builds commands to be executed 
remotely 
●executed on the server over ssh
Local Server 
Lookup current revision in source 
control 
ssh into server using ssh public key 
checkout specified revision from 
source control 
copy a new timestamped site 
directory 
Add symlinks to shared directories 
update current symlink to new site 
directory 
Simple 
Deployment 
Workflow
Hooks 
Before and after hooks at each stage of the 
deployment lifecycle 
Extend or customise default capistrano 
behavior 
Examples: deploy, 
deploy:setup,deploy:symlink, 
deploy:update_code, deploy:rollback
Some common recipes 
cap deploy # Deploys your project. 
cap deploy:check # Check required files and directories exist 
cap deploy:cleanup # Clean up old releases. 
cap deploy:migrate # Run the migrate rake task.
Deploy configuration 
In deploy.rb 
set :application, ‘site.com’’ 
set :scm, :git 
set :repository, “git@github.com/sagarjunnarkar/site.git” 
set :branch, “master” 
set :port, 22 
set :user, 'ubuntu' 
set :deploy_to, “/home/#{user}/#{application}” #/home/ubuntu/site.com 
role :app, ‘www.example.com’ 
#server "54.169.95.188", :web
Made mistake 
Oops. 
We’re sorry but something went wrong
Rollback deployment 
cap deploy:rollback 
Set current symlink to previous release 
directory
Questions
Thank you

More Related Content

PPT
Capistrano - Deployment Tool
PPTX
Control your deployments with Capistrano
PPTX
Capistrano 3 Deployment
PPT
Capistrano
PPTX
Getting Started with Capistrano
PPTX
Capistrano - automate all the things
PDF
Painless Deployment with Capistrano
PPTX
Vagrant introduction for Developers
Capistrano - Deployment Tool
Control your deployments with Capistrano
Capistrano 3 Deployment
Capistrano
Getting Started with Capistrano
Capistrano - automate all the things
Painless Deployment with Capistrano
Vagrant introduction for Developers

What's hot (20)

PDF
A quick intro to Ansible
PDF
Ansible introduction - XX Betabeers Galicia
PPTX
Ansible intro
PDF
How to contribute Apache CloudStack
PDF
Chef Provisioning a Chef Server Cluster - ChefConf 2015
PDF
Performance Tuning Your Puppet Infrastructure - PuppetConf 2014
PDF
Making Spinnaker Go @ Stitch Fix
PDF
Salt conf 2014 - Using SaltStack in high availability environments
PDF
SaltConf14 - Forrest Alvarez, Choice Hotels - Salt Formulas and States
PDF
Ansible Introduction
PDF
Infrastructure = code - 1 year later
PDF
Puppet in the Pipeline
PDF
Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...
PPTX
Integration testing for salt states using aws ec2 container service
PPTX
London Community Summit - Habitat 2016
PPTX
Where is my scalable API?
PPTX
Monitoring and tuning your chef server - chef conf talk
PPTX
Where is my scalable api?
PPTX
SaltConf 2014: Safety with powertools
PDF
The Puppet Master on the JVM - PuppetConf 2014
A quick intro to Ansible
Ansible introduction - XX Betabeers Galicia
Ansible intro
How to contribute Apache CloudStack
Chef Provisioning a Chef Server Cluster - ChefConf 2015
Performance Tuning Your Puppet Infrastructure - PuppetConf 2014
Making Spinnaker Go @ Stitch Fix
Salt conf 2014 - Using SaltStack in high availability environments
SaltConf14 - Forrest Alvarez, Choice Hotels - Salt Formulas and States
Ansible Introduction
Infrastructure = code - 1 year later
Puppet in the Pipeline
Arnold Bechtoldt, Inovex GmbH Linux systems engineer - Configuration Manageme...
Integration testing for salt states using aws ec2 container service
London Community Summit - Habitat 2016
Where is my scalable API?
Monitoring and tuning your chef server - chef conf talk
Where is my scalable api?
SaltConf 2014: Safety with powertools
The Puppet Master on the JVM - PuppetConf 2014
Ad

Viewers also liked (20)

PDF
Release note 1.2
PPTX
Κεφ.3α H Aμερικανική Eπανάσταση
PPTX
Д. Суслов Интернет-магазин на 100%: выжимаем из сайта максимум
PPTX
Social Media Training
PPTX
Κεφ.8ο Ωκεανοί και θάλασσες
PPTX
Presentation mepet
PDF
“Oportunidades y desafíos en el uso de Recursos Renovables en Argentina”
PDF
Un plato decorado de Tammapul, Tula, Tamaulipas. Carlos Pérez Silva
PDF
3الصف الثالث المتوسط
PPTX
Ancillary task data
PPTX
Dr. RAHUL VC TIWARI, SIBAR INSTITUTE OF DENTAL SCIENCES, GUNTUR, ANDHRA PRADE...
PPT
Disco Sopa Argentina junio 2016
PPT
Hotel sales manager
PPTX
Disaggregating routine monitoring data by disability – an example from eye he...
PPTX
Questionnaire media 1
PPTX
Promoter profile - KED Technology
PDF
Bakhtawar Hussain's Portfolio
PPT
Sales specialist
PPTX
волшебный квиллинг
PDF
iBeacon Technology Use Cases
Release note 1.2
Κεφ.3α H Aμερικανική Eπανάσταση
Д. Суслов Интернет-магазин на 100%: выжимаем из сайта максимум
Social Media Training
Κεφ.8ο Ωκεανοί και θάλασσες
Presentation mepet
“Oportunidades y desafíos en el uso de Recursos Renovables en Argentina”
Un plato decorado de Tammapul, Tula, Tamaulipas. Carlos Pérez Silva
3الصف الثالث المتوسط
Ancillary task data
Dr. RAHUL VC TIWARI, SIBAR INSTITUTE OF DENTAL SCIENCES, GUNTUR, ANDHRA PRADE...
Disco Sopa Argentina junio 2016
Hotel sales manager
Disaggregating routine monitoring data by disability – an example from eye he...
Questionnaire media 1
Promoter profile - KED Technology
Bakhtawar Hussain's Portfolio
Sales specialist
волшебный квиллинг
iBeacon Technology Use Cases
Ad

Similar to Deployment with capistrano (20)

PDF
Deploying software at Scale
PDF
A3Sec Advanced Deployment System
PPTX
drupal ci cd concept cornel univercity.pptx
ODP
Malware analysis
PDF
My "Perfect" Toolchain Setup for Grails Projects
PDF
Linux Server Deep Dives (DrupalCon Amsterdam)
PDF
Devops with Python by Yaniv Cohen DevopShift
PDF
Capistrano deploy Magento project in an efficient way
PDF
Capistrano
PDF
Pluggable Infrastructure with CI/CD and Docker
PPTX
A Fabric/Puppet Build/Deploy System
ODP
DevOps and Chef improve your life
PDF
Prescriptive System Security with InSpec
PPTX
Prescriptive Security with InSpec - All Things Open 2019
PDF
Common Challenges in DevOps Change Management
ODP
Nagios Conference 2014 - Spenser Reinhardt - Detecting Security Breaches With...
PDF
Towards Continuous Deployment with Django
PPTX
Your Inner Sysadmin - Tutorial (SunshinePHP 2015)
PDF
Django dev-env-my-way
PPT
Professional deployment
Deploying software at Scale
A3Sec Advanced Deployment System
drupal ci cd concept cornel univercity.pptx
Malware analysis
My "Perfect" Toolchain Setup for Grails Projects
Linux Server Deep Dives (DrupalCon Amsterdam)
Devops with Python by Yaniv Cohen DevopShift
Capistrano deploy Magento project in an efficient way
Capistrano
Pluggable Infrastructure with CI/CD and Docker
A Fabric/Puppet Build/Deploy System
DevOps and Chef improve your life
Prescriptive System Security with InSpec
Prescriptive Security with InSpec - All Things Open 2019
Common Challenges in DevOps Change Management
Nagios Conference 2014 - Spenser Reinhardt - Detecting Security Breaches With...
Towards Continuous Deployment with Django
Your Inner Sysadmin - Tutorial (SunshinePHP 2015)
Django dev-env-my-way
Professional deployment

Recently uploaded (20)

PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
Understanding Forklifts - TECH EHS Solution
PPT
Introduction Database Management System for Course Database
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
System and Network Administration Chapter 2
PDF
top salesforce developer skills in 2025.pdf
PDF
medical staffing services at VALiNTRY
PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
Online Work Permit System for Fast Permit Processing
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
System and Network Administraation Chapter 3
PDF
Design an Analysis of Algorithms I-SECS-1021-03
ManageIQ - Sprint 268 Review - Slide Deck
Understanding Forklifts - TECH EHS Solution
Introduction Database Management System for Course Database
Operating system designcfffgfgggggggvggggggggg
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Odoo POS Development Services by CandidRoot Solutions
System and Network Administration Chapter 2
top salesforce developer skills in 2025.pdf
medical staffing services at VALiNTRY
ISO 45001 Occupational Health and Safety Management System
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
Upgrade and Innovation Strategies for SAP ERP Customers
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Online Work Permit System for Fast Permit Processing
PTS Company Brochure 2025 (1).pdf.......
System and Network Administraation Chapter 3
Design an Analysis of Algorithms I-SECS-1021-03

Deployment with capistrano

  • 1. Revealing Hour Creations Sagar P Junnarkar sj@revealinghour.in @sagarjunnarkar
  • 3. How do we deploy? FTP,SFTP,SCP? SSH+GIT? Debian packages? Don’t know? Other team does it for you.
  • 4. What are the issues ●Lot of manual processes -backup db, update code, update db etc. ●Room for error. steps could be missed. ●Small organisation : loose server access and permissions ●Large organisation : too restrictive permissions. locked down server env
  • 5. What do we need?
  • 6. What do we need? ●Give limited power to developers ●Automate entire deployment process
  • 7. System admins don’t want you to touching their stuff
  • 8. System admins don’t want you to touching their stuff Standard server env: ●Convention ●Consistency ●Security ●Monitoring
  • 9. working together to get the job done
  • 10. working together to get the job done ●Developers are able to deploy rapidly ●Sys admins have tight control of environments ●All manual process are automated
  • 11. Capistrano www.capistranorb.com ●Introduced around 2006 by Jamis Buck of 37 signals ●Written in ruby, initially for rails project ●It is a developer tool for deploying web applications. It is typically installed on your workstation and used to deploy your SCM to one or more servers.
  • 12. Simplest explanation ●Lets you write scripts that say “ssh onto remote machine and do things.” ●Program your deployment actions
  • 13. Setup and configuration gem install capistrano cap -T # List all commands capify . #capistrano v2 cap install #capistrano v3
  • 14. Local Directory Structure ├── Capfile ├── config │ ├── deploy │ │ ├── production.rb │ │ └── staging.rb │ └── deploy.rb └── lib └── capistrano └── tasks ├── Capfile ├── config │ ├── deploy.rb
  • 15. Server Directory Structure myapp/releases myapp/current -> releases/20141001001122 myapp/shared
  • 16. Symlink for shared files Symlinks are made back to the shared folder, so they are not lost between deployments. e.g. myapp/current/uploads -> myapp/shared/uploads
  • 17. How does it works ●No software installed on server, just locally ●Capistrano builds commands to be executed remotely ●executed on the server over ssh
  • 18. Local Server Lookup current revision in source control ssh into server using ssh public key checkout specified revision from source control copy a new timestamped site directory Add symlinks to shared directories update current symlink to new site directory Simple Deployment Workflow
  • 19. Hooks Before and after hooks at each stage of the deployment lifecycle Extend or customise default capistrano behavior Examples: deploy, deploy:setup,deploy:symlink, deploy:update_code, deploy:rollback
  • 20. Some common recipes cap deploy # Deploys your project. cap deploy:check # Check required files and directories exist cap deploy:cleanup # Clean up old releases. cap deploy:migrate # Run the migrate rake task.
  • 21. Deploy configuration In deploy.rb set :application, ‘site.com’’ set :scm, :git set :repository, “git@github.com/sagarjunnarkar/site.git” set :branch, “master” set :port, 22 set :user, 'ubuntu' set :deploy_to, “/home/#{user}/#{application}” #/home/ubuntu/site.com role :app, ‘www.example.com’ #server "54.169.95.188", :web
  • 22. Made mistake Oops. We’re sorry but something went wrong
  • 23. Rollback deployment cap deploy:rollback Set current symlink to previous release directory