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

What's hot

Testing in Infrastructure
Testing in InfrastructureTesting in Infrastructure
Testing in Infrastructure
Muhammet Arslan
 
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Edureka!
 
Heroku + Jeweler & Gemcutter
Heroku + Jeweler & GemcutterHeroku + Jeweler & Gemcutter
Heroku + Jeweler & Gemcutter
Ariejan de Vroom
 
Compliance Automation with Inspec Part 2
Compliance Automation with Inspec Part 2Compliance Automation with Inspec Part 2
Compliance Automation with Inspec Part 2
Chef
 
Configuration Management and Salt
Configuration Management and SaltConfiguration Management and Salt
Configuration Management and Salt
55020
 
Learn How Selenium And Jenkins Fit In DevOps | Edureka Live
Learn How Selenium And Jenkins Fit In DevOps | Edureka LiveLearn How Selenium And Jenkins Fit In DevOps | Edureka Live
Learn How Selenium And Jenkins Fit In DevOps | Edureka Live
Edureka!
 
London Community Summit 2016 - Fresh New Chef Stuff
London Community Summit 2016 - Fresh New Chef StuffLondon Community Summit 2016 - Fresh New Chef Stuff
London Community Summit 2016 - Fresh New Chef Stuff
Chef
 
Continuously Integrating Distributed Code at Netflix
Continuously Integrating Distributed Code at NetflixContinuously Integrating Distributed Code at Netflix
Continuously Integrating Distributed Code at Netflix
Atlassian
 
Puppet overview
Puppet overviewPuppet overview
Puppet overview
joshbeard
 
Infrastructure as Code with Chef
Infrastructure as Code with ChefInfrastructure as Code with Chef
Infrastructure as Code with Chef
Sarah Hynes Cheney
 
Azure handsonlab
Azure handsonlabAzure handsonlab
Azure handsonlab
Chef
 
Code Reviews vs. Pull Requests
Code Reviews vs. Pull RequestsCode Reviews vs. Pull Requests
Code Reviews vs. Pull Requests
Atlassian
 
Habitat Managed Chef
Habitat Managed ChefHabitat Managed Chef
Habitat Managed Chef
Chef
 
Advanced WordPress Tooling
Advanced WordPress ToolingAdvanced WordPress Tooling
Advanced WordPress Tooling
Keanan Koppenhaver
 
Compliance Automation with InSpec
Compliance Automation with InSpecCompliance Automation with InSpec
Compliance Automation with InSpec
Nathen Harvey
 
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
Chef Software, Inc.
 
Zenith Arca Business Introduction
Zenith Arca Business IntroductionZenith Arca Business Introduction
Zenith Arca Business Introduction
sgo4th
 
Automating secure server baselines with Chef
Automating secure server baselines with ChefAutomating secure server baselines with Chef
Automating secure server baselines with Chef
Chef Software, Inc.
 
Chef Delivery
Chef DeliveryChef Delivery
Chef Delivery
Chef
 
Introduction to Chef
Introduction to ChefIntroduction to Chef
Introduction to Chef
Knoldus Inc.
 

What's hot (20)

Testing in Infrastructure
Testing in InfrastructureTesting in Infrastructure
Testing in Infrastructure
 
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
 
Heroku + Jeweler & Gemcutter
Heroku + Jeweler & GemcutterHeroku + Jeweler & Gemcutter
Heroku + Jeweler & Gemcutter
 
Compliance Automation with Inspec Part 2
Compliance Automation with Inspec Part 2Compliance Automation with Inspec Part 2
Compliance Automation with Inspec Part 2
 
Configuration Management and Salt
Configuration Management and SaltConfiguration Management and Salt
Configuration Management and Salt
 
Learn How Selenium And Jenkins Fit In DevOps | Edureka Live
Learn How Selenium And Jenkins Fit In DevOps | Edureka LiveLearn How Selenium And Jenkins Fit In DevOps | Edureka Live
Learn How Selenium And Jenkins Fit In DevOps | Edureka Live
 
London Community Summit 2016 - Fresh New Chef Stuff
London Community Summit 2016 - Fresh New Chef StuffLondon Community Summit 2016 - Fresh New Chef Stuff
London Community Summit 2016 - Fresh New Chef Stuff
 
Continuously Integrating Distributed Code at Netflix
Continuously Integrating Distributed Code at NetflixContinuously Integrating Distributed Code at Netflix
Continuously Integrating Distributed Code at Netflix
 
Puppet overview
Puppet overviewPuppet overview
Puppet overview
 
Infrastructure as Code with Chef
Infrastructure as Code with ChefInfrastructure as Code with Chef
Infrastructure as Code with Chef
 
Azure handsonlab
Azure handsonlabAzure handsonlab
Azure handsonlab
 
Code Reviews vs. Pull Requests
Code Reviews vs. Pull RequestsCode Reviews vs. Pull Requests
Code Reviews vs. Pull Requests
 
Habitat Managed Chef
Habitat Managed ChefHabitat Managed Chef
Habitat Managed Chef
 
Advanced WordPress Tooling
Advanced WordPress ToolingAdvanced WordPress Tooling
Advanced WordPress Tooling
 
Compliance Automation with InSpec
Compliance Automation with InSpecCompliance Automation with InSpec
Compliance Automation with InSpec
 
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
Chef Fundamentals Training Series Module 3: Setting up Nodes and Cookbook Aut...
 
Zenith Arca Business Introduction
Zenith Arca Business IntroductionZenith Arca Business Introduction
Zenith Arca Business Introduction
 
Automating secure server baselines with Chef
Automating secure server baselines with ChefAutomating secure server baselines with Chef
Automating secure server baselines with Chef
 
Chef Delivery
Chef DeliveryChef Delivery
Chef Delivery
 
Introduction to Chef
Introduction to ChefIntroduction to Chef
Introduction to Chef
 

Viewers also liked

Software Livre, que história é essa?
Software Livre, que história é essa?Software Livre, que história é essa?
Software Livre, que história é essa?
Almir Mendes
 
Cucumber @ VilniusPHP
Cucumber @ VilniusPHPCucumber @ VilniusPHP
Cucumber @ VilniusPHP
Vidmantas Kabošis
 
Deploying Rails Applications with Capistrano
Deploying Rails Applications with CapistranoDeploying Rails Applications with Capistrano
Deploying Rails Applications with Capistrano
Almir Mendes
 
Podcast 39 – Games As Oases For Journalists
Podcast 39 – Games As Oases For JournalistsPodcast 39 – Games As Oases For Journalists
Podcast 39 – Games As Oases For Journalists
Blog NewsGames
 
Swede
SwedeSwede
Swede
Avatar581
 
Capistrano for non-rubyist
Capistrano for non-rubyistCapistrano for non-rubyist
Capistrano for non-rubyist
Dimitris Tsironis
 
Ruby.new @ VilniusRB
Ruby.new @ VilniusRBRuby.new @ VilniusRB
Ruby.new @ VilniusRB
Vidmantas Kabošis
 
E co p presentation final
E co p presentation finalE co p presentation final
E co p presentation final
aletom78
 
test
testtest
NewsGames - Demarcando um novo modelo de Jornalismo Online - Novembro de 2008a
NewsGames - Demarcando um novo modelo de Jornalismo Online - Novembro de 2008aNewsGames - Demarcando um novo modelo de Jornalismo Online - Novembro de 2008a
NewsGames - Demarcando um novo modelo de Jornalismo Online - Novembro de 2008a
Blog NewsGames
 
NewTwitter como motor textual dos NewsGames - substituição de feeds RSS por m...
NewTwitter como motor textual dos NewsGames - substituição de feeds RSS por m...NewTwitter como motor textual dos NewsGames - substituição de feeds RSS por m...
NewTwitter como motor textual dos NewsGames - substituição de feeds RSS por m...
Blog NewsGames
 
Les Barbares Attaquent l'Education ! Par Oussama Ammar, co-fondateur de TheFa...
Les Barbares Attaquent l'Education ! Par Oussama Ammar, co-fondateur de TheFa...Les Barbares Attaquent l'Education ! Par Oussama Ammar, co-fondateur de TheFa...
Les Barbares Attaquent l'Education ! Par Oussama Ammar, co-fondateur de TheFa...
TheFamily
 

Viewers also liked (12)

Software Livre, que história é essa?
Software Livre, que história é essa?Software Livre, que história é essa?
Software Livre, que história é essa?
 
Cucumber @ VilniusPHP
Cucumber @ VilniusPHPCucumber @ VilniusPHP
Cucumber @ VilniusPHP
 
Deploying Rails Applications with Capistrano
Deploying Rails Applications with CapistranoDeploying Rails Applications with Capistrano
Deploying Rails Applications with Capistrano
 
Podcast 39 – Games As Oases For Journalists
Podcast 39 – Games As Oases For JournalistsPodcast 39 – Games As Oases For Journalists
Podcast 39 – Games As Oases For Journalists
 
Swede
SwedeSwede
Swede
 
Capistrano for non-rubyist
Capistrano for non-rubyistCapistrano for non-rubyist
Capistrano for non-rubyist
 
Ruby.new @ VilniusRB
Ruby.new @ VilniusRBRuby.new @ VilniusRB
Ruby.new @ VilniusRB
 
E co p presentation final
E co p presentation finalE co p presentation final
E co p presentation final
 
test
testtest
test
 
NewsGames - Demarcando um novo modelo de Jornalismo Online - Novembro de 2008a
NewsGames - Demarcando um novo modelo de Jornalismo Online - Novembro de 2008aNewsGames - Demarcando um novo modelo de Jornalismo Online - Novembro de 2008a
NewsGames - Demarcando um novo modelo de Jornalismo Online - Novembro de 2008a
 
NewTwitter como motor textual dos NewsGames - substituição de feeds RSS por m...
NewTwitter como motor textual dos NewsGames - substituição de feeds RSS por m...NewTwitter como motor textual dos NewsGames - substituição de feeds RSS por m...
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...
Les Barbares Attaquent l'Education ! Par Oussama Ammar, co-fondateur de TheFa...Les Barbares Attaquent l'Education ! Par Oussama Ammar, co-fondateur de TheFa...
Les Barbares Attaquent l'Education ! Par Oussama Ammar, co-fondateur de TheFa...
 

Similar to Deploying Your Webapps (with Capistrano)

Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
Ryan Cuprak
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
Ryan Cuprak
 
What makes me "Grunt"?
What makes me "Grunt"? What makes me "Grunt"?
What makes me "Grunt"?
Fabien Doiron
 
Hosting Your Own OTA Update Service
Hosting Your Own OTA Update ServiceHosting Your Own OTA Update Service
Hosting Your Own OTA Update Service
Quinlan Jung
 
Head First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & ApplicationHead First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & Application
Jace Ju
 
iOSDevCamp Firebase Overview
iOSDevCamp Firebase OverviewiOSDevCamp Firebase Overview
iOSDevCamp Firebase Overview
James Daniels
 
Building and Maintaining a Distribution in Drupal 7 with Features
Building and Maintaining a  Distribution in Drupal 7 with FeaturesBuilding and Maintaining a  Distribution in Drupal 7 with Features
Building and Maintaining a Distribution in Drupal 7 with Features
Nuvole
 
Node.js Build, Deploy and Scale Webinar
Node.js Build, Deploy and Scale WebinarNode.js Build, Deploy and Scale Webinar
Node.js Build, Deploy and Scale Webinar
jguerrero999
 
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Simon Boulet
 
Zend framework
Zend frameworkZend framework
Zend framework
Prem Shankar
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with Ansible
Stein Inge Morisbak
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy System
adrian_nye
 
WordCamp Atlanta - April 15 2018 - dev team workflow and processes with word...
WordCamp Atlanta -  April 15 2018 - dev team workflow and processes with word...WordCamp Atlanta -  April 15 2018 - dev team workflow and processes with word...
WordCamp Atlanta - April 15 2018 - dev team workflow and processes with word...
Evan Mullins
 
WP-CLI - A Good Friend of Developer
WP-CLI - A Good Friend of DeveloperWP-CLI - A Good Friend of Developer
WP-CLI - A Good Friend of Developer
Chandra Patel
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with Capistrano
Ramazan K
 
Commcon 2018
Commcon 2018Commcon 2018
Commcon 2018
Jöran Vinzens
 
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
Sylvain Rayé
 
Ranger admin dev overview
Ranger admin dev overviewRanger admin dev overview
Ranger admin dev overview
Tushar Dudhatra
 
Deploy like a pro!
Deploy like a pro!Deploy like a pro!
Deploy like a pro!
Damian Serrano Thode
 
Bangpypers april-meetup-2012
Bangpypers april-meetup-2012Bangpypers april-meetup-2012
Bangpypers april-meetup-2012
Deepak Garg
 

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

Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
 
What makes me "Grunt"?
What makes me "Grunt"? What makes me "Grunt"?
What makes me "Grunt"?
 
Hosting Your Own OTA Update Service
Hosting Your Own OTA Update ServiceHosting Your Own OTA Update Service
Hosting Your Own OTA Update Service
 
Head First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & ApplicationHead First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & Application
 
iOSDevCamp Firebase Overview
iOSDevCamp Firebase OverviewiOSDevCamp Firebase Overview
iOSDevCamp Firebase Overview
 
Building and Maintaining a Distribution in Drupal 7 with Features
Building and Maintaining a  Distribution in Drupal 7 with FeaturesBuilding and Maintaining a  Distribution in Drupal 7 with Features
Building and Maintaining a Distribution in Drupal 7 with Features
 
Node.js Build, Deploy and Scale Webinar
Node.js Build, Deploy and Scale WebinarNode.js Build, Deploy and Scale Webinar
Node.js Build, Deploy and Scale Webinar
 
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
 
Zend framework
Zend frameworkZend framework
Zend framework
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with Ansible
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy System
 
WordCamp Atlanta - April 15 2018 - dev team workflow and processes with word...
WordCamp Atlanta -  April 15 2018 - dev team workflow and processes with word...WordCamp Atlanta -  April 15 2018 - dev team workflow and processes with word...
WordCamp Atlanta - April 15 2018 - dev team workflow and processes with word...
 
WP-CLI - A Good Friend of Developer
WP-CLI - A Good Friend of DeveloperWP-CLI - A Good Friend of Developer
WP-CLI - A Good Friend of Developer
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with Capistrano
 
Commcon 2018
Commcon 2018Commcon 2018
Commcon 2018
 
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
 
Ranger admin dev overview
Ranger admin dev overviewRanger admin dev overview
Ranger admin dev overview
 
Deploy like a pro!
Deploy like a pro!Deploy like a pro!
Deploy like a pro!
 
Bangpypers april-meetup-2012
Bangpypers april-meetup-2012Bangpypers april-meetup-2012
Bangpypers april-meetup-2012
 

Recently uploaded

如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
gapen1
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
ToXSL Technologies
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
sjcobrien
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
ShulagnaSarkar2
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
Green Software Development
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
Alina Yurenko
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
Peter Muessig
 
fiscal year variant fiscal year variant.
fiscal year variant fiscal year variant.fiscal year variant fiscal year variant.
fiscal year variant fiscal year variant.
AnkitaPandya11
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
Patrick Weigel
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
safelyiotech
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
XfilesPro
 

Recently uploaded (20)

如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
 
fiscal year variant fiscal year variant.
fiscal year variant fiscal year variant.fiscal year variant fiscal year variant.
fiscal year variant fiscal year variant.
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
 

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