SlideShare a Scribd company logo
Deploying Your Apps 
(With Capistrano) 
David Underwood @davefp
What is 'Deployment'? 
David Underwood @davefp
Deployment is the 
process of 
distributing and 
starting your app in 
an environment 
David Underwood @davefp
What Steps do we Need? 
David Underwood @davefp
What do you do in 
development? 
David Underwood @davefp
One-Time Operations 
—Provision server. 
—Set up database and other supporting 
services. 
—Create credentials for external 
services. 
David Underwood @davefp
Per-Deploy Operations 
—Fetch new code. 
—Run migrations. 
—Update configuration. 
—Restart (or stop/start) app. 
David Underwood @davefp
Capistrano 
David Underwood @davefp
The Basics 
Add it to your gemfile: 
gem 'capistrano' 
Get it installed: 
bundle install 
bundle exec cap install 
David Underwood @davefp
Anatomy of a Command 
Specify a stage, and a task to run on it: 
cap production deploy 
cap staging deploy:migrate 
cap custom_stage custom_namespace:custom_task 
David Underwood @davefp
Configuration 
Your Capfile contains any includes you 
might need. 
require 'capistrano/setup' 
require 'capistrano/deploy' 
require 'capistrano/rbenv' 
require 'capistrano/rails' 
require 'capistrano3/unicorn' 
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r } 
David Underwood @davefp
Configuration common to all states is 
found in config/deploy.rb. 
lock '3.2.1' 
set :application, 'arenagym' 
set :repo_url, 'git@bitbucket.org:davefp/arenagym.git' 
set :linked_files, %w{config/database.yml .env} 
set :linked_dirs, %w{tmp/pids} 
set :unicorn_config_path, "config/unicorn.rb" 
set :unicorn_rails, true 
set :rbenv_type, :user 
set :rbenv_ruby, '2.1.1' 
set :rbenv_map_bins, %w{rake gem bundle ruby rails} 
set :rbenv_roles, :all # default value 
David Underwood @davefp
Environment/stage specific config in 
named files, e.g. config/deploy/ 
production.rb 
set :stage, :production 
set :deploy_to, '~/apps/arenagym' 
set :branch, 'master' 
set :rails_env, 'production' 
# Simple Role Syntax 
# ================== 
# Supports bulk-adding hosts to roles, the primary 
# server in each group is considered to be the first 
# unless any hosts have the primary property set. 
role :app, %w{deploy@arenagym.net:2222} 
role :web, %w{deploy@arenagym.net:2222} 
role :db, %w{deploy@arenagym.net:2222} 
David Underwood @davefp
Take a look at the 
deploy task: 
Handy Link 
David Underwood @davefp
Linked Files 
Linked files are any files that are not part 
of your codebase that you need to run 
your app. 
They persist from deploy to deploy. 
—database.yml 
—.env, config.yml, or secrets.yml 
—pid files (e.g. for unicorn restarts) 
David Underwood @davefp
Deploys 
Each time you deploy, your code is put in 
a new folder alongside the old stuff. 
When everything is ready, this folder is 
symlinked to the 'current' folder to 
minimise downtime. 
A certain number of previous releases 
are kept around so that you can roll 
back. 
David Underwood @davefp
Tailoring Capistrano to your needs 
—capistrano/rails provides migration and 
asset tasks. 
—capistrano3/unicorn provides app 
server start, stop, restart tasks. 
—Etc.. 
David Underwood @davefp
Questions? 
David Underwood @davefp
Thanks! 
Capistrano site: capistranorb.com 
This presentation: On my GitHub 
My blog: theflyingdeveloper.com 
David Underwood @davefp

More Related Content

PPTX
SAP TechEd 2013 session Tec118 managing your-environment
PPTX
Chef Tutorial | Chef Tutorial For Beginners | DevOps Chef Tutorial | DevOps T...
PPTX
Chef vs Puppet vs Ansible vs Saltstack | Configuration Management Tools | Dev...
PPTX
Understand Chef
ZIP
Drupal Deployment
PPTX
Automating Software Development Life Cycle - A DevOps Approach
PDF
Nike popup compliance workshop
PPT
Building and Deployment of Drupal sites with Features and Context
SAP TechEd 2013 session Tec118 managing your-environment
Chef Tutorial | Chef Tutorial For Beginners | DevOps Chef Tutorial | DevOps T...
Chef vs Puppet vs Ansible vs Saltstack | Configuration Management Tools | Dev...
Understand Chef
Drupal Deployment
Automating Software Development Life Cycle - A DevOps Approach
Nike popup compliance workshop
Building and Deployment of Drupal sites with Features and Context

What's hot (20)

PPTX
Testing in Infrastructure
PDF
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
KEY
Heroku + Jeweler & Gemcutter
PPTX
Compliance Automation with Inspec Part 2
ODP
Configuration Management and Salt
PDF
Learn How Selenium And Jenkins Fit In DevOps | Edureka Live
PPTX
London Community Summit 2016 - Fresh New Chef Stuff
PDF
Continuously Integrating Distributed Code at Netflix
PDF
Puppet overview
PDF
Infrastructure as Code with Chef
PPTX
Azure handsonlab
PDF
Code Reviews vs. Pull Requests
PPTX
Habitat Managed Chef
PDF
Advanced WordPress Tooling
PPTX
Compliance Automation with InSpec
PDF
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
PDF
Zenith Arca Business Introduction
PDF
Automating secure server baselines with Chef
PPT
Chef Delivery
ODP
Introduction to Chef
Testing in Infrastructure
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Heroku + Jeweler & Gemcutter
Compliance Automation with Inspec Part 2
Configuration Management and Salt
Learn How Selenium And Jenkins Fit In DevOps | Edureka Live
London Community Summit 2016 - Fresh New Chef Stuff
Continuously Integrating Distributed Code at Netflix
Puppet overview
Infrastructure as Code with Chef
Azure handsonlab
Code Reviews vs. Pull Requests
Habitat Managed Chef
Advanced WordPress Tooling
Compliance Automation with InSpec
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
Zenith Arca Business Introduction
Automating secure server baselines with Chef
Chef Delivery
Introduction to Chef
Ad

Viewers also liked (12)

PDF
Software Livre, que história é essa?
PDF
Cucumber @ VilniusPHP
PDF
Deploying Rails Applications with Capistrano
PDF
Podcast 39 – Games As Oases For Journalists
PPTX
Swede
PDF
Capistrano for non-rubyist
PDF
Ruby.new @ VilniusRB
PPTX
E co p presentation final
PDF
PDF
NewsGames - Demarcando um novo modelo de Jornalismo Online - Novembro de 2008a
PDF
NewTwitter como motor textual dos NewsGames - substituição de feeds RSS por m...
PDF
Les Barbares Attaquent l'Education ! Par Oussama Ammar, co-fondateur de TheFa...
Software Livre, que história é essa?
Cucumber @ VilniusPHP
Deploying Rails Applications with Capistrano
Podcast 39 – Games As Oases For Journalists
Swede
Capistrano for non-rubyist
Ruby.new @ VilniusRB
E co p presentation final
NewsGames - Demarcando um novo modelo de Jornalismo Online - Novembro de 2008a
NewTwitter como motor textual dos NewsGames - substituição de feeds RSS por m...
Les Barbares Attaquent l'Education ! Par Oussama Ammar, co-fondateur de TheFa...
Ad

Similar to Deploying Your Webapps (with Capistrano) (20)

PPT
Capistrano Deployment By Nyros Developer
PPTX
Capistrano 3 Deployment
PPTX
Getting Started with Capistrano
PDF
Deploy like a pro!
PDF
Capistrano deploy Magento project in an efficient way
PDF
Deploy made easy (even on Friday)
PPT
Capistrano - Deployment Tool
PDF
Hosting Ruby Web Apps
PPTX
Deployment with capistrano
PDF
Two-Step Deployment with Rails
ODP
Deployments with rails
KEY
Railsconf2011 deployment tips_for_slideshare
PDF
Deployment Via Capistrano
PDF
Capistrano
PPT
Deploying Rails Apps with Capistrano
PDF
Kuby, ActiveDeployment for Rails Apps
PPTX
Continuous deployment of Rails apps on AWS OpsWorks
PPTX
Toolbox of a Ruby Team
PDF
Rock Solid Deployment of Web Applications
ODP
Deploying Rails App On Ec2
Capistrano Deployment By Nyros Developer
Capistrano 3 Deployment
Getting Started with Capistrano
Deploy like a pro!
Capistrano deploy Magento project in an efficient way
Deploy made easy (even on Friday)
Capistrano - Deployment Tool
Hosting Ruby Web Apps
Deployment with capistrano
Two-Step Deployment with Rails
Deployments with rails
Railsconf2011 deployment tips_for_slideshare
Deployment Via Capistrano
Capistrano
Deploying Rails Apps with Capistrano
Kuby, ActiveDeployment for Rails Apps
Continuous deployment of Rails apps on AWS OpsWorks
Toolbox of a Ruby Team
Rock Solid Deployment of Web Applications
Deploying Rails App On Ec2

Recently uploaded (20)

PDF
Designing Intelligence for the Shop Floor.pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Introduction to Artificial Intelligence
PDF
Nekopoi APK 2025 free lastest update
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Digital Strategies for Manufacturing Companies
PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
assetexplorer- product-overview - presentation
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Cost to Outsource Software Development in 2025
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
System and Network Administraation Chapter 3
PPTX
history of c programming in notes for students .pptx
Designing Intelligence for the Shop Floor.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Odoo POS Development Services by CandidRoot Solutions
Upgrade and Innovation Strategies for SAP ERP Customers
Introduction to Artificial Intelligence
Nekopoi APK 2025 free lastest update
Understanding Forklifts - TECH EHS Solution
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Digital Strategies for Manufacturing Companies
CHAPTER 2 - PM Management and IT Context
assetexplorer- product-overview - presentation
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Cost to Outsource Software Development in 2025
How to Choose the Right IT Partner for Your Business in Malaysia
Design an Analysis of Algorithms I-SECS-1021-03
Navsoft: AI-Powered Business Solutions & Custom Software Development
System and Network Administraation Chapter 3
history of c programming in notes for students .pptx

Deploying Your Webapps (with Capistrano)

  • 1. Deploying Your Apps (With Capistrano) David Underwood @davefp
  • 2. What is 'Deployment'? David Underwood @davefp
  • 3. Deployment is the process of distributing and starting your app in an environment David Underwood @davefp
  • 4. What Steps do we Need? David Underwood @davefp
  • 5. What do you do in development? David Underwood @davefp
  • 6. One-Time Operations —Provision server. —Set up database and other supporting services. —Create credentials for external services. David Underwood @davefp
  • 7. Per-Deploy Operations —Fetch new code. —Run migrations. —Update configuration. —Restart (or stop/start) app. David Underwood @davefp
  • 9. The Basics Add it to your gemfile: gem 'capistrano' Get it installed: bundle install bundle exec cap install David Underwood @davefp
  • 10. Anatomy of a Command Specify a stage, and a task to run on it: cap production deploy cap staging deploy:migrate cap custom_stage custom_namespace:custom_task David Underwood @davefp
  • 11. Configuration Your Capfile contains any includes you might need. require 'capistrano/setup' require 'capistrano/deploy' require 'capistrano/rbenv' require 'capistrano/rails' require 'capistrano3/unicorn' Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r } David Underwood @davefp
  • 12. Configuration common to all states is found in config/deploy.rb. lock '3.2.1' set :application, 'arenagym' set :repo_url, 'git@bitbucket.org:davefp/arenagym.git' set :linked_files, %w{config/database.yml .env} set :linked_dirs, %w{tmp/pids} set :unicorn_config_path, "config/unicorn.rb" set :unicorn_rails, true set :rbenv_type, :user set :rbenv_ruby, '2.1.1' set :rbenv_map_bins, %w{rake gem bundle ruby rails} set :rbenv_roles, :all # default value David Underwood @davefp
  • 13. Environment/stage specific config in named files, e.g. config/deploy/ production.rb set :stage, :production set :deploy_to, '~/apps/arenagym' set :branch, 'master' set :rails_env, 'production' # Simple Role Syntax # ================== # Supports bulk-adding hosts to roles, the primary # server in each group is considered to be the first # unless any hosts have the primary property set. role :app, %w{deploy@arenagym.net:2222} role :web, %w{deploy@arenagym.net:2222} role :db, %w{deploy@arenagym.net:2222} David Underwood @davefp
  • 14. Take a look at the deploy task: Handy Link David Underwood @davefp
  • 15. Linked Files Linked files are any files that are not part of your codebase that you need to run your app. They persist from deploy to deploy. —database.yml —.env, config.yml, or secrets.yml —pid files (e.g. for unicorn restarts) David Underwood @davefp
  • 16. Deploys Each time you deploy, your code is put in a new folder alongside the old stuff. When everything is ready, this folder is symlinked to the 'current' folder to minimise downtime. A certain number of previous releases are kept around so that you can roll back. David Underwood @davefp
  • 17. Tailoring Capistrano to your needs —capistrano/rails provides migration and asset tasks. —capistrano3/unicorn provides app server start, stop, restart tasks. —Etc.. David Underwood @davefp
  • 19. Thanks! Capistrano site: capistranorb.com This presentation: On my GitHub My blog: theflyingdeveloper.com David Underwood @davefp