SlideShare ist ein Scribd-Unternehmen logo
1 von 19
Downloaden Sie, um offline zu lesen
ВЫКЛАДКА 
БЕЗ БОЛИ С 
CAPISTRANO 
PAINLESS DEPLOYMENT WITH CAPISTRANO 
НоĐșĐŸĐ»Đ°Đč ĐšŃƒĐłĐ°Đ”ĐČсĐșĐžĐč / @kugaevsky
TRUE OLD SCHOOL 
Rsync 
SCP 
FTP
NOT SO OLD 
ssh → git pull 
Fabric
MONSTAZ! 
Puppet 
Chef 
Salt 
Ansible
CAPISTRANO TO THE RESCUE
CAPISTRANO 
Capistrano is a remote server automation and deployment tool 
written in Ruby. 
It supports the scripting and execution of arbitrary tasks, and 
includes a set of sane-default deployment workflows.
CAPISTRANO 
Ruby 
Open source 
Expressive DSL 
Simity 
0-time deploy/rollback 
Multistaging 
Roles
INSTALL AND INIT 
$ cd my_perfect_app 
$ gem install capistrano 
$ cap install
CONFIG 
# config/deploy.rb 
set :application, 'slides' 
set :repo_url, 'git@github.com:kugaevsky/slides.git' 
# config/deploy/staging.rb 
role :app, %w{nick@kugaevsky.ru} 
set :deploy_to, '/home/kugaevsky/www/slides.kugaevsky.ru' 
set :user, 'nick'
ANATOMY LOCAL 
my_perfect_app 
├── Capfile 
├── config 
│ ├── deploy 
│ │ ├── production.rb 
│ │ ├── staging.rb 
│ │ └── ... 
│ └── deploy.rb 
└── lib 
└── capistrano 
└── tasks
ANATOMY HOST 
my_perfect_app 
├── current → ../releases/20141209222103 
├── releases 
│ ├── 20141209220703 
│ ├── 20141209222103 
│ └── ... 
├── repo 
│ ├── branches 
│ ├── config 
│ ├── description 
│ └── ... 
└── shared 
├── node_modules 
├── uploads 
├── vendor 
└── ...
DEPLOY FLOW 
deploy:starting # start a deployment, make sure everything is ready 
deploy:started # started hook (for custom tasks) 
deploy:updating # update server(s) with a new release 
deploy:updated # updated hook 
deploy:publishing # publish the new release 
deploy:published # published hook 
deploy:finishing # finish the deployment, clean up everything 
deploy:finished # finished hook
ROLLBACK FLOW 
deploy:starting 
deploy:started 
deploy:reverting # revert server(s) to previous release 
deploy:reverted # reverted hook 
deploy:publishing 
deploy:published 
deploy:finishing_rollback # finish the rollback, clean up everything 
deploy:finished
PLUGINS! 
# Capfile 
require 'capistrano/rvm' 
require 'capistrano/rbenv' 
require 'capistrano/chruby' 
require 'capistrano/bundler' 
require 'capistrano/rails/assets' 
require 'capistrano/rails/migrations'
REAL WORLD EXAMPLE 
# config/deploy.rb 
desc 'Create symlinks for npm modules' 
task :npm do 
on roles(:app) do 
execute "ln -nfs #{shared_path}/node_modules #{release_path}/node_modules" 
end 
end 
desc 'Install npm modules' 
task :npm do 
on roles(:app) do 
execute "cd #{release_path} && npm install" 
end 
end 
desc 'Compile assets' 
task :compile_assets do 
on roles(:app) do 
execute "cd #{release_path} && #{shared_path}/node_modules/.bin/gulp compile:production" 
end 
end
ALTERNATIVES 
Vlad the Deployer 
Mina
READING 
Capistrano official site 
Repository on GitHub 
How To Use Capistrano to Automate Deployments
СПАСИБО 
ВЫКЛАДКА БЕЗ БОЛИ ĐĄ CAPISTRANO 
PAINLESS DEPLOYMENT WITH CAPISTRANO 
http://slides.kugaevsky.ru/ 
ĐŽĐ»Ń 
НоĐșĐŸĐ»Đ°Đč ĐšŃƒĐłĐ°Đ”ĐČсĐșĐžĐč rannts#3

Weitere Àhnliche Inhalte

Was ist angesagt?

Ruby 1.9 And Rails 3.0
Ruby 1.9 And Rails 3.0Ruby 1.9 And Rails 3.0
Ruby 1.9 And Rails 3.0
ArrrrCamp
 
Avoiding surprises with Chef and Vagrant
Avoiding surprises with Chef and VagrantAvoiding surprises with Chef and Vagrant
Avoiding surprises with Chef and Vagrant
andygale
 

Was ist angesagt? (20)

Deploy node.js app with capistrano
Deploy node.js app with capistranoDeploy node.js app with capistrano
Deploy node.js app with capistrano
 
Capistrano, Puppet, and Chef
Capistrano, Puppet, and ChefCapistrano, Puppet, and Chef
Capistrano, Puppet, and Chef
 
Ruby 1.9 And Rails 3.0
Ruby 1.9 And Rails 3.0Ruby 1.9 And Rails 3.0
Ruby 1.9 And Rails 3.0
 
Java Day Kharkiv - Next-gen engineering with Docker and Kubernetes
Java Day Kharkiv - Next-gen engineering with Docker and KubernetesJava Day Kharkiv - Next-gen engineering with Docker and Kubernetes
Java Day Kharkiv - Next-gen engineering with Docker and Kubernetes
 
Puppet Camp DĂŒsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...
Puppet Camp DĂŒsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...Puppet Camp DĂŒsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...
Puppet Camp DĂŒsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...
 
Bamboo Hands on training 2016
Bamboo Hands on training 2016Bamboo Hands on training 2016
Bamboo Hands on training 2016
 
Modern Perl Toolchain
Modern Perl ToolchainModern Perl Toolchain
Modern Perl Toolchain
 
Deploying Rails applications with Moonshine
Deploying Rails applications with MoonshineDeploying Rails applications with Moonshine
Deploying Rails applications with Moonshine
 
Where is my scalable API?
Where is my scalable API?Where is my scalable API?
Where is my scalable API?
 
A quick intro to Ansible
A quick intro to AnsibleA quick intro to Ansible
A quick intro to Ansible
 
Integration testing for salt states using aws ec2 container service
Integration testing for salt states using aws ec2 container serviceIntegration testing for salt states using aws ec2 container service
Integration testing for salt states using aws ec2 container service
 
Plone deployment made easy
Plone deployment made easyPlone deployment made easy
Plone deployment made easy
 
Where is my scalable api?
Where is my scalable api?Where is my scalable api?
Where is my scalable api?
 
Capistrano Deployment By Nyros Developer
Capistrano Deployment By Nyros DeveloperCapistrano Deployment By Nyros Developer
Capistrano Deployment By Nyros Developer
 
No Hugging, No Learning
No Hugging, No LearningNo Hugging, No Learning
No Hugging, No Learning
 
Minimum Viable Docker: our journey towards orchestration
Minimum Viable Docker: our journey towards orchestrationMinimum Viable Docker: our journey towards orchestration
Minimum Viable Docker: our journey towards orchestration
 
Docker puppetcamp london 2013
Docker puppetcamp london 2013Docker puppetcamp london 2013
Docker puppetcamp london 2013
 
Puppet in the Pipeline
Puppet in the PipelinePuppet in the Pipeline
Puppet in the Pipeline
 
Avoiding surprises with Chef and Vagrant
Avoiding surprises with Chef and VagrantAvoiding surprises with Chef and Vagrant
Avoiding surprises with Chef and Vagrant
 
Tdc 2013 - Ecossistema Ruby
Tdc 2013 - Ecossistema RubyTdc 2013 - Ecossistema Ruby
Tdc 2013 - Ecossistema Ruby
 

Ähnlich wie Painless Deployment with Capistrano

Deploy made easy (even on Friday)
Deploy made easy (even on Friday)Deploy made easy (even on Friday)
Deploy made easy (even on Friday)
Riccardo Bini
 
ZFConf 2012: Capistrano ĐŽĐ»Ń ĐŽĐ”ĐżĐ»ĐŸĐčĐŒĐ”ĐœŃ‚Đ° PHP-ĐżŃ€ĐžĐ»ĐŸĐ¶Đ”ĐœĐžĐč (Đ ĐŸĐŒĐ°Đœ Đ›Đ°ĐżĐžĐœ)
ZFConf 2012: Capistrano ĐŽĐ»Ń ĐŽĐ”ĐżĐ»ĐŸĐčĐŒĐ”ĐœŃ‚Đ° PHP-ĐżŃ€ĐžĐ»ĐŸĐ¶Đ”ĐœĐžĐč (Đ ĐŸĐŒĐ°Đœ Đ›Đ°ĐżĐžĐœ)ZFConf 2012: Capistrano ĐŽĐ»Ń ĐŽĐ”ĐżĐ»ĐŸĐčĐŒĐ”ĐœŃ‚Đ° PHP-ĐżŃ€ĐžĐ»ĐŸĐ¶Đ”ĐœĐžĐč (Đ ĐŸĐŒĐ°Đœ Đ›Đ°ĐżĐžĐœ)
ZFConf 2012: Capistrano ĐŽĐ»Ń ĐŽĐ”ĐżĐ»ĐŸĐčĐŒĐ”ĐœŃ‚Đ° PHP-ĐżŃ€ĐžĐ»ĐŸĐ¶Đ”ĐœĐžĐč (Đ ĐŸĐŒĐ°Đœ Đ›Đ°ĐżĐžĐœ)
ZFConf Conference
 
Deploying Rails Applications with Capistrano
Deploying Rails Applications with CapistranoDeploying Rails Applications with Capistrano
Deploying Rails Applications with Capistrano
Almir Mendes
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
tomcopeland
 
Quest for the Perfect Workflow for McrFRED
Quest for the Perfect Workflow for McrFREDQuest for the Perfect Workflow for McrFRED
Quest for the Perfect Workflow for McrFRED
Andi Smith
 
NLIT 2011: Chef & Capistrano
NLIT 2011: Chef & CapistranoNLIT 2011: Chef & Capistrano
NLIT 2011: Chef & Capistrano
nickblah
 
Kubernetes+-CKA-+0400+-+Application+Lifecycle+Management.pdf
Kubernetes+-CKA-+0400+-+Application+Lifecycle+Management.pdfKubernetes+-CKA-+0400+-+Application+Lifecycle+Management.pdf
Kubernetes+-CKA-+0400+-+Application+Lifecycle+Management.pdf
Srinivasa Rao
 
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Carlos Sanchez
 

Ähnlich wie Painless Deployment with Capistrano (20)

Deploy made easy (even on Friday)
Deploy made easy (even on Friday)Deploy made easy (even on Friday)
Deploy made easy (even on Friday)
 
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
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with Capistrano
 
Things I Heart
Things I HeartThings I Heart
Things I Heart
 
ZFConf 2012: Capistrano ĐŽĐ»Ń ĐŽĐ”ĐżĐ»ĐŸĐčĐŒĐ”ĐœŃ‚Đ° PHP-ĐżŃ€ĐžĐ»ĐŸĐ¶Đ”ĐœĐžĐč (Đ ĐŸĐŒĐ°Đœ Đ›Đ°ĐżĐžĐœ)
ZFConf 2012: Capistrano ĐŽĐ»Ń ĐŽĐ”ĐżĐ»ĐŸĐčĐŒĐ”ĐœŃ‚Đ° PHP-ĐżŃ€ĐžĐ»ĐŸĐ¶Đ”ĐœĐžĐč (Đ ĐŸĐŒĐ°Đœ Đ›Đ°ĐżĐžĐœ)ZFConf 2012: Capistrano ĐŽĐ»Ń ĐŽĐ”ĐżĐ»ĐŸĐčĐŒĐ”ĐœŃ‚Đ° PHP-ĐżŃ€ĐžĐ»ĐŸĐ¶Đ”ĐœĐžĐč (Đ ĐŸĐŒĐ°Đœ Đ›Đ°ĐżĐžĐœ)
ZFConf 2012: Capistrano ĐŽĐ»Ń ĐŽĐ”ĐżĐ»ĐŸĐčĐŒĐ”ĐœŃ‚Đ° PHP-ĐżŃ€ĐžĐ»ĐŸĐ¶Đ”ĐœĐžĐč (Đ ĐŸĐŒĐ°Đœ Đ›Đ°ĐżĐžĐœ)
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
Deploying Rails Apps with Capistrano
Deploying Rails Apps with CapistranoDeploying Rails Apps with Capistrano
Deploying Rails Apps with Capistrano
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next Frontier
 
Deploying Rails Applications with Capistrano
Deploying Rails Applications with CapistranoDeploying Rails Applications with Capistrano
Deploying Rails Applications with Capistrano
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby Team
 
Forget Grunt and Gulp! Webpack and NPM rule them all!
Forget Grunt and Gulp! Webpack and NPM rule them all!Forget Grunt and Gulp! Webpack and NPM rule them all!
Forget Grunt and Gulp! Webpack and NPM rule them all!
 
Practical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails AppPractical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails App
 
Deploying Drupal using Capistrano
Deploying Drupal using CapistranoDeploying Drupal using Capistrano
Deploying Drupal using Capistrano
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
 
infra-as-code
infra-as-codeinfra-as-code
infra-as-code
 
Quest for the Perfect Workflow for McrFRED
Quest for the Perfect Workflow for McrFREDQuest for the Perfect Workflow for McrFRED
Quest for the Perfect Workflow for McrFRED
 
NLIT 2011: Chef & Capistrano
NLIT 2011: Chef & CapistranoNLIT 2011: Chef & Capistrano
NLIT 2011: Chef & Capistrano
 
Kubernetes+-CKA-+0400+-+Application+Lifecycle+Management.pdf
Kubernetes+-CKA-+0400+-+Application+Lifecycle+Management.pdfKubernetes+-CKA-+0400+-+Application+Lifecycle+Management.pdf
Kubernetes+-CKA-+0400+-+Application+Lifecycle+Management.pdf
 
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
 
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
 

KĂŒrzlich hochgeladen

Abortion Pills In Pretoria ](+27832195400*)[ đŸ„ Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ đŸ„ Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ đŸ„ Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ đŸ„ Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 

KĂŒrzlich hochgeladen (20)

%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
Abortion Pills In Pretoria ](+27832195400*)[ đŸ„ Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ đŸ„ Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ đŸ„ Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ đŸ„ Women's Abortion Clinic In Pre...
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 

Painless Deployment with Capistrano

  • 1. ВЫКЛАДКА БЕЗ БОЛИ ĐĄ CAPISTRANO PAINLESS DEPLOYMENT WITH CAPISTRANO НоĐșĐŸĐ»Đ°Đč ĐšŃƒĐłĐ°Đ”ĐČсĐșĐžĐč / @kugaevsky
  • 2. TRUE OLD SCHOOL Rsync SCP FTP
  • 3. NOT SO OLD ssh → git pull Fabric
  • 4. MONSTAZ! Puppet Chef Salt Ansible
  • 6. CAPISTRANO Capistrano is a remote server automation and deployment tool written in Ruby. It supports the scripting and execution of arbitrary tasks, and includes a set of sane-default deployment workflows.
  • 7. CAPISTRANO Ruby Open source Expressive DSL Simity 0-time deploy/rollback Multistaging Roles
  • 8. INSTALL AND INIT $ cd my_perfect_app $ gem install capistrano $ cap install
  • 9. CONFIG # config/deploy.rb set :application, 'slides' set :repo_url, 'git@github.com:kugaevsky/slides.git' # config/deploy/staging.rb role :app, %w{nick@kugaevsky.ru} set :deploy_to, '/home/kugaevsky/www/slides.kugaevsky.ru' set :user, 'nick'
  • 10. ANATOMY LOCAL my_perfect_app ├── Capfile ├── config │ ├── deploy │ │ ├── production.rb │ │ ├── staging.rb │ │ └── ... │ └── deploy.rb └── lib └── capistrano └── tasks
  • 11. ANATOMY HOST my_perfect_app ├── current → ../releases/20141209222103 ├── releases │ ├── 20141209220703 │ ├── 20141209222103 │ └── ... ├── repo │ ├── branches │ ├── config │ ├── description │ └── ... └── shared ├── node_modules ├── uploads ├── vendor └── ...
  • 12. DEPLOY FLOW deploy:starting # start a deployment, make sure everything is ready deploy:started # started hook (for custom tasks) deploy:updating # update server(s) with a new release deploy:updated # updated hook deploy:publishing # publish the new release deploy:published # published hook deploy:finishing # finish the deployment, clean up everything deploy:finished # finished hook
  • 13. ROLLBACK FLOW deploy:starting deploy:started deploy:reverting # revert server(s) to previous release deploy:reverted # reverted hook deploy:publishing deploy:published deploy:finishing_rollback # finish the rollback, clean up everything deploy:finished
  • 14. PLUGINS! # Capfile require 'capistrano/rvm' require 'capistrano/rbenv' require 'capistrano/chruby' require 'capistrano/bundler' require 'capistrano/rails/assets' require 'capistrano/rails/migrations'
  • 15. REAL WORLD EXAMPLE # config/deploy.rb desc 'Create symlinks for npm modules' task :npm do on roles(:app) do execute "ln -nfs #{shared_path}/node_modules #{release_path}/node_modules" end end desc 'Install npm modules' task :npm do on roles(:app) do execute "cd #{release_path} && npm install" end end desc 'Compile assets' task :compile_assets do on roles(:app) do execute "cd #{release_path} && #{shared_path}/node_modules/.bin/gulp compile:production" end end
  • 16.
  • 17. ALTERNATIVES Vlad the Deployer Mina
  • 18. READING Capistrano official site Repository on GitHub How To Use Capistrano to Automate Deployments
  • 19. СПАСИБО ВЫКЛАДКА БЕЗ БОЛИ ĐĄ CAPISTRANO PAINLESS DEPLOYMENT WITH CAPISTRANO http://slides.kugaevsky.ru/ ĐŽĐ»Ń НоĐșĐŸĐ»Đ°Đč ĐšŃƒĐłĐ°Đ”ĐČсĐșĐžĐč rannts#3