SlideShare a Scribd company logo
1 of 23
Download to read offline
DEPLOY MADE EASY
(even on Friday)
Riccardo Bini
@odracci
In the beginning
F
A
I
L
DEPLOYTOOLS
• Idephix
• puppet
• fabric
CAPISTRANO
Capistrano is an open source tool for running scripts on
multiple servers; its main use is deploying web applications. It
automates the process of making a new version of an
application available on one or more web servers, including
supporting tasks such as changing databases.
http://en.wikipedia.org/wiki/Capistrano
WHY?
One-click deploy
Deploy in transaction
Rollback
Automated tasks (minifing CSS/JS, DB migrations)
RECIPES
Capifony http://capifony.org
Railsless-deploy https://github.com/leehambley/railsless-deploy
Multistage https://github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension
`-- /var/www/my-app.com
|-- current ! /var/www/my-app.com/releases/20131004131539
|-- releases
| `-- 20131004131539
| `-- 20131004150741
| `-- 20131004145325
`-- shared
|-- web
| `-- uploads
`-- config
`-- config.php
HOW IT WORKS
HOW IT WORKS
ssh to the server (my-app.com)
• create a new release path (/var/www/my-app.com/releases/...)
• pull the latest project version from the remote git repo
• copy the source code, pulled from git, into the release path
http://capifony.org
HOW IT WORKS
$ capify .
[add] writing './Capfile'
[add] making directory './config'
[add] writing './config/deploy.rb'
[done] capified!
SETUP
$ cap deploy:setup
# to deploy: cap -S branch=<branchname> deploy
set :application, "set your application name here"
set :repository, "git@github.com:odracci/#{application}.git"
set :scm, :git
server "my-app.com", :app, :web, :db, :primary => true
set :deploy_to, "/var/www/my-app.com"
set :branch, fetch(:branch, "master")
set :shared_children, ["web/uploads", "config"]
set :user, "vagrant"
set :group_writable, true
set :use_sudo, false
set :copy_exclude, [".git"]
set :deploy_via, :remote_cache
set :keep_releases, 5
ssh_options[:forward_agent] = true
default_run_options[:pty] = true
logger.level = Logger::MAX_LEVEL
# if you want to clean up old releases on each deploy uncomment this:
after "deploy:restart", "deploy:cleanup"
config/deploy.rb
$ cap <env> deploy
server "www.my-app.com", :app, :web, :db, :primary => true
set :deploy_to, "/var/www/my-app.com"
set :branch, fetch(:branch, "master")
MULTISTAGE
server "s.my-app.com", :app, :web, :db, :primary => true
set :deploy_to, "/var/www/my-app.com"
set :branch, fetch(:branch, "develop")
config/deploy/production.rb
config/deploy/staging.rb
command line
cap deploy # Deploys your project.
cap deploy:check # Test deployment dependencies.
cap deploy:cleanup # Clean up old releases.
cap deploy:cold # Deploys and starts a `cold' application.
cap deploy:create_symlink # Updates the symlink to the most recently deployed...
cap deploy:migrate # Run the migrate rake task.
cap deploy:migrations # Deploy and run pending migrations.
cap deploy:pending # Displays the commits since your last deploy.
cap deploy:pending:diff # Displays the `diff' since your last deploy.
cap deploy:restart # Blank task exists as a hook into which to install...
cap deploy:rollback # Rolls back to a previous version and restarts.
cap deploy:rollback:code # Rolls back to the previously deployed version.
cap deploy:setup # Prepares one or more servers for deployment.
cap deploy:start # Blank task exists as a hook into which to install...
cap deploy:stop # Blank task exists as a hook into which to install...
cap deploy:symlink # Deprecated API.
cap deploy:update # Copies your project and updates the symlink.
cap deploy:update_code # Copies your project to the remote servers.
cap deploy:upload # Copy files to the currently deployed version.
cap invoke # Invoke a single command on the remote servers.
cap shell # Begin an interactive Capistrano session.
cap -T
namespace :deploy do
task :start do
end
task :stop do
end
task :restart, :roles => :app, :except => { :no_release => true } do
run "sudo /etc/init.d/httpd restart"
end
end
OverrideTasks
namespace :config do
desc "Upload config/config.php to remote server"
task :to_remote do
upload("config/config.php", "#{shared_path}/config/config.php", :via => :scp)
end
end
$ cap config:to_remote
CustomTasks
WTF
[my-app.com] executing command
** [my-app.com :: out] Permission denied (publickey).
** [my-app.com :: out]
** [my-app.com :: out] fatal: The remote end hung up unexpectedly
** [my-app.com :: out]
command finished in 2769ms
*** [deploy:update_code] rolling back
WTF
$ ssh-add
namespace :deploy do
	 desc 'Show deployed revision'
	 task :revision, :roles => :app do
	 	 run "#{try_sudo} cat #{current_path}/REVISION"
	 end
end
WTF
$ cap deploy:revision
#server "server1, :app, :web, :db, :primary => true
role :app, "server1", "server2"
role :web, "server1", "server2"
role :db, "dbserver", :primary => true
SCALING WEB APPS
$ cap deploy:setup
THANKS
Riccardo Bini
@odracci
github.com/odracci
QUESTIONS?

More Related Content

What's hot

Dockercon EU 2014
Dockercon EU 2014Dockercon EU 2014
Dockercon EU 2014Rafe Colton
 
Ci For The Web 2.0 Guy Or Gal
Ci For The Web 2.0 Guy Or GalCi For The Web 2.0 Guy Or Gal
Ci For The Web 2.0 Guy Or GalChad Woolley
 
Devops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As Code
Devops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As CodeDevops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As Code
Devops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As CodeIsrael Shirk
 
Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3kognate
 
Install Concourse CI with BOSH
Install Concourse CI with BOSHInstall Concourse CI with BOSH
Install Concourse CI with BOSHToshiaki Maki
 
2016 05-cloudsoft-amp-and-brooklyn-new
2016 05-cloudsoft-amp-and-brooklyn-new2016 05-cloudsoft-amp-and-brooklyn-new
2016 05-cloudsoft-amp-and-brooklyn-newBradDesAulniers2
 
Deploying an application with Chef and Docker
Deploying an application with Chef and DockerDeploying an application with Chef and Docker
Deploying an application with Chef and DockerDaniel Ku
 
Codecoon - A technical Case Study
Codecoon - A technical Case StudyCodecoon - A technical Case Study
Codecoon - A technical Case StudyMichael Lihs
 
Continuous Delivery Pipeline with Docker and Jenkins
Continuous Delivery Pipeline with Docker and JenkinsContinuous Delivery Pipeline with Docker and Jenkins
Continuous Delivery Pipeline with Docker and JenkinsCamilo Ribeiro
 
Developing Microservices with Apache Camel, by Claus Ibsen
Developing Microservices with Apache Camel, by Claus IbsenDeveloping Microservices with Apache Camel, by Claus Ibsen
Developing Microservices with Apache Camel, by Claus IbsenJudy Breedlove
 
Concourse CI Meetup Demo
Concourse CI Meetup DemoConcourse CI Meetup Demo
Concourse CI Meetup DemoToshiaki Maki
 
Auto-scaled Concourse CI on AWS w/o BOSH
Auto-scaled Concourse CI on AWS w/o BOSHAuto-scaled Concourse CI on AWS w/o BOSH
Auto-scaled Concourse CI on AWS w/o BOSH佑介 九岡
 

What's hot (20)

Dockercon EU 2014
Dockercon EU 2014Dockercon EU 2014
Dockercon EU 2014
 
Ci For The Web 2.0 Guy Or Gal
Ci For The Web 2.0 Guy Or GalCi For The Web 2.0 Guy Or Gal
Ci For The Web 2.0 Guy Or Gal
 
Vagrant to-aws-flow
Vagrant to-aws-flowVagrant to-aws-flow
Vagrant to-aws-flow
 
Devops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As Code
Devops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As CodeDevops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As Code
Devops Boise - Israel Shirk - Pragmatic Migration to Infrastructure As Code
 
CI-CD WITH GITLAB WORKFLOW
CI-CD WITH GITLAB WORKFLOWCI-CD WITH GITLAB WORKFLOW
CI-CD WITH GITLAB WORKFLOW
 
ConcourseCi overview
ConcourseCi  overviewConcourseCi  overview
ConcourseCi overview
 
Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3Server(less) Swift at SwiftCloudWorkshop 3
Server(less) Swift at SwiftCloudWorkshop 3
 
Sprint 17
Sprint 17Sprint 17
Sprint 17
 
Install Concourse CI with BOSH
Install Concourse CI with BOSHInstall Concourse CI with BOSH
Install Concourse CI with BOSH
 
Concourse updates
Concourse updatesConcourse updates
Concourse updates
 
2016 05-cloudsoft-amp-and-brooklyn-new
2016 05-cloudsoft-amp-and-brooklyn-new2016 05-cloudsoft-amp-and-brooklyn-new
2016 05-cloudsoft-amp-and-brooklyn-new
 
Gitlab ci-cd
Gitlab ci-cdGitlab ci-cd
Gitlab ci-cd
 
Deploying an application with Chef and Docker
Deploying an application with Chef and DockerDeploying an application with Chef and Docker
Deploying an application with Chef and Docker
 
創科 從零開始認識 Docker
創科 從零開始認識 Docker創科 從零開始認識 Docker
創科 從零開始認識 Docker
 
OpenWhisk
OpenWhiskOpenWhisk
OpenWhisk
 
Codecoon - A technical Case Study
Codecoon - A technical Case StudyCodecoon - A technical Case Study
Codecoon - A technical Case Study
 
Continuous Delivery Pipeline with Docker and Jenkins
Continuous Delivery Pipeline with Docker and JenkinsContinuous Delivery Pipeline with Docker and Jenkins
Continuous Delivery Pipeline with Docker and Jenkins
 
Developing Microservices with Apache Camel, by Claus Ibsen
Developing Microservices with Apache Camel, by Claus IbsenDeveloping Microservices with Apache Camel, by Claus Ibsen
Developing Microservices with Apache Camel, by Claus Ibsen
 
Concourse CI Meetup Demo
Concourse CI Meetup DemoConcourse CI Meetup Demo
Concourse CI Meetup Demo
 
Auto-scaled Concourse CI on AWS w/o BOSH
Auto-scaled Concourse CI on AWS w/o BOSHAuto-scaled Concourse CI on AWS w/o BOSH
Auto-scaled Concourse CI on AWS w/o BOSH
 

Viewers also liked

5 Tips for Team Management
5 Tips for Team Management5 Tips for Team Management
5 Tips for Team ManagementInterQuest Group
 
IQ Assurance & Testing: Did you know...?
IQ Assurance & Testing: Did you know...?IQ Assurance & Testing: Did you know...?
IQ Assurance & Testing: Did you know...?InterQuest Group
 
IQ Assurance & Testing Brochure
IQ Assurance & Testing BrochureIQ Assurance & Testing Brochure
IQ Assurance & Testing BrochureInterQuest Group
 
Spotlight on Jet2.com - Interview with Stuart Bass, B.I. Applications Manager
Spotlight on Jet2.com - Interview with Stuart Bass, B.I. Applications ManagerSpotlight on Jet2.com - Interview with Stuart Bass, B.I. Applications Manager
Spotlight on Jet2.com - Interview with Stuart Bass, B.I. Applications ManagerInterQuest Group
 
A Task Scheduling Algorithm in Cloud Computing
A Task Scheduling Algorithm in Cloud ComputingA Task Scheduling Algorithm in Cloud Computing
A Task Scheduling Algorithm in Cloud Computingpaperpublications3
 
coma Study Room Arduino Workshop
coma Study Room Arduino Workshopcoma Study Room Arduino Workshop
coma Study Room Arduino WorkshopEto Haruhiko
 
Job Searching: 5 Top Tips for Effective Job Searching
Job Searching: 5 Top Tips for Effective Job SearchingJob Searching: 5 Top Tips for Effective Job Searching
Job Searching: 5 Top Tips for Effective Job SearchingInterQuest Group
 
IQ Survival Guide - Personal Twitter
IQ Survival Guide - Personal TwitterIQ Survival Guide - Personal Twitter
IQ Survival Guide - Personal TwitterInterQuest Group
 
淺談 Live patching technology
淺談 Live patching technology淺談 Live patching technology
淺談 Live patching technologySZ Lin
 
I'm A STEM Graduate, I'm Struggling To get An Interview - Help!
I'm A STEM Graduate, I'm Struggling To get An Interview - Help!I'm A STEM Graduate, I'm Struggling To get An Interview - Help!
I'm A STEM Graduate, I'm Struggling To get An Interview - Help!InterQuest Group
 

Viewers also liked (12)

Onnichannel Experience - 'Caso Mi Canal IKEA Ibérica'
Onnichannel Experience - 'Caso Mi Canal IKEA Ibérica' Onnichannel Experience - 'Caso Mi Canal IKEA Ibérica'
Onnichannel Experience - 'Caso Mi Canal IKEA Ibérica'
 
5 Tips for Team Management
5 Tips for Team Management5 Tips for Team Management
5 Tips for Team Management
 
IQ Assurance & Testing: Did you know...?
IQ Assurance & Testing: Did you know...?IQ Assurance & Testing: Did you know...?
IQ Assurance & Testing: Did you know...?
 
IQ Assurance & Testing Brochure
IQ Assurance & Testing BrochureIQ Assurance & Testing Brochure
IQ Assurance & Testing Brochure
 
Spotlight on Jet2.com - Interview with Stuart Bass, B.I. Applications Manager
Spotlight on Jet2.com - Interview with Stuart Bass, B.I. Applications ManagerSpotlight on Jet2.com - Interview with Stuart Bass, B.I. Applications Manager
Spotlight on Jet2.com - Interview with Stuart Bass, B.I. Applications Manager
 
A Task Scheduling Algorithm in Cloud Computing
A Task Scheduling Algorithm in Cloud ComputingA Task Scheduling Algorithm in Cloud Computing
A Task Scheduling Algorithm in Cloud Computing
 
coma Study Room Arduino Workshop
coma Study Room Arduino Workshopcoma Study Room Arduino Workshop
coma Study Room Arduino Workshop
 
Job Searching: 5 Top Tips for Effective Job Searching
Job Searching: 5 Top Tips for Effective Job SearchingJob Searching: 5 Top Tips for Effective Job Searching
Job Searching: 5 Top Tips for Effective Job Searching
 
Iq work hacks round up
Iq work hacks round upIq work hacks round up
Iq work hacks round up
 
IQ Survival Guide - Personal Twitter
IQ Survival Guide - Personal TwitterIQ Survival Guide - Personal Twitter
IQ Survival Guide - Personal Twitter
 
淺談 Live patching technology
淺談 Live patching technology淺談 Live patching technology
淺談 Live patching technology
 
I'm A STEM Graduate, I'm Struggling To get An Interview - Help!
I'm A STEM Graduate, I'm Struggling To get An Interview - Help!I'm A STEM Graduate, I'm Struggling To get An Interview - Help!
I'm A STEM Graduate, I'm Struggling To get An Interview - Help!
 

Similar to 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 waySylvain Rayé
 
Deploying Rails Apps with Capistrano
Deploying Rails Apps with CapistranoDeploying Rails Apps with Capistrano
Deploying Rails Apps with CapistranoNyros Technologies
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with CapistranoRamazan K
 
Painless Deployment with Capistrano
Painless Deployment with CapistranoPainless Deployment with Capistrano
Painless Deployment with CapistranoNick Kugaevsky
 
DCEU 18: App-in-a-Box with Docker Application Packages
DCEU 18: App-in-a-Box with Docker Application PackagesDCEU 18: App-in-a-Box with Docker Application Packages
DCEU 18: App-in-a-Box with Docker Application PackagesDocker, Inc.
 
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...Docker, Inc.
 
Docker module 1
Docker module 1Docker module 1
Docker module 1Liang Bo
 
Enabling Hybrid Workflows with Docker/Mesos @Orbitz
Enabling Hybrid Workflows with Docker/Mesos @OrbitzEnabling Hybrid Workflows with Docker/Mesos @Orbitz
Enabling Hybrid Workflows with Docker/Mesos @OrbitzSteve Hoffman
 
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)ZFConf Conference
 
(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines(Declarative) Jenkins Pipelines
(Declarative) Jenkins PipelinesSteffen Gebert
 
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHPHands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHPDana Luther
 
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...Amazon Web Services
 
Docker for Dummies
Docker for DummiesDocker for Dummies
Docker for DummiesRoel Hartman
 
Capistrano Deployment By Nyros Developer
Capistrano Deployment By Nyros DeveloperCapistrano Deployment By Nyros Developer
Capistrano Deployment By Nyros DeveloperNyros Technologies
 
Docker for developers on mac and windows
Docker for developers on mac and windowsDocker for developers on mac and windows
Docker for developers on mac and windowsDocker, Inc.
 
DevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux ContainersDevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux Containersinside-BigData.com
 
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
2016 - Easing Your Way Into Docker: Lessons From a Journey to Productiondevopsdaysaustin
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.catPablo Godel
 
Deploying TYPO3 Neos websites using Surf
Deploying TYPO3 Neos websites using SurfDeploying TYPO3 Neos websites using Surf
Deploying TYPO3 Neos websites using SurfKarsten Dambekalns
 

Similar to Deploy made easy (even on Friday) (20)

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
 
Deploying Rails Apps with Capistrano
Deploying Rails Apps with CapistranoDeploying Rails Apps with Capistrano
Deploying Rails Apps with Capistrano
 
Capistrano - Deployment Tool
Capistrano - Deployment ToolCapistrano - Deployment Tool
Capistrano - Deployment Tool
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with Capistrano
 
Painless Deployment with Capistrano
Painless Deployment with CapistranoPainless Deployment with Capistrano
Painless Deployment with Capistrano
 
DCEU 18: App-in-a-Box with Docker Application Packages
DCEU 18: App-in-a-Box with Docker Application PackagesDCEU 18: App-in-a-Box with Docker Application Packages
DCEU 18: App-in-a-Box with Docker Application Packages
 
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
 
Docker module 1
Docker module 1Docker module 1
Docker module 1
 
Enabling Hybrid Workflows with Docker/Mesos @Orbitz
Enabling Hybrid Workflows with Docker/Mesos @OrbitzEnabling Hybrid Workflows with Docker/Mesos @Orbitz
Enabling Hybrid Workflows with Docker/Mesos @Orbitz
 
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
 
(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines
 
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHPHands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
 
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
 
Docker for Dummies
Docker for DummiesDocker for Dummies
Docker for Dummies
 
Capistrano Deployment By Nyros Developer
Capistrano Deployment By Nyros DeveloperCapistrano Deployment By Nyros Developer
Capistrano Deployment By Nyros Developer
 
Docker for developers on mac and windows
Docker for developers on mac and windowsDocker for developers on mac and windows
Docker for developers on mac and windows
 
DevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux ContainersDevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux Containers
 
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
Deploying TYPO3 Neos websites using Surf
Deploying TYPO3 Neos websites using SurfDeploying TYPO3 Neos websites using Surf
Deploying TYPO3 Neos websites using Surf
 

Recently uploaded

Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
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...apidays
 
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 TerraformAndrey Devyatkin
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
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 2024Victor Rentea
 
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.pdfsudhanshuwaghmare1
 
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 businesspanagenda
 
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 educationjfdjdjcjdnsjd
 
"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 ...Zilliz
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
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 Pakistandanishmna97
 

Recently uploaded (20)

Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
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
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
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
 
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
 
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
 
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
 
"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 ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
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
 

Deploy made easy (even on Friday)

  • 1. DEPLOY MADE EASY (even on Friday) Riccardo Bini @odracci
  • 3.
  • 6. CAPISTRANO Capistrano is an open source tool for running scripts on multiple servers; its main use is deploying web applications. It automates the process of making a new version of an application available on one or more web servers, including supporting tasks such as changing databases. http://en.wikipedia.org/wiki/Capistrano
  • 7. WHY? One-click deploy Deploy in transaction Rollback Automated tasks (minifing CSS/JS, DB migrations)
  • 9. `-- /var/www/my-app.com |-- current ! /var/www/my-app.com/releases/20131004131539 |-- releases | `-- 20131004131539 | `-- 20131004150741 | `-- 20131004145325 `-- shared |-- web | `-- uploads `-- config `-- config.php HOW IT WORKS
  • 10. HOW IT WORKS ssh to the server (my-app.com) • create a new release path (/var/www/my-app.com/releases/...) • pull the latest project version from the remote git repo • copy the source code, pulled from git, into the release path http://capifony.org
  • 12. $ capify . [add] writing './Capfile' [add] making directory './config' [add] writing './config/deploy.rb' [done] capified! SETUP $ cap deploy:setup
  • 13. # to deploy: cap -S branch=<branchname> deploy set :application, "set your application name here" set :repository, "git@github.com:odracci/#{application}.git" set :scm, :git server "my-app.com", :app, :web, :db, :primary => true set :deploy_to, "/var/www/my-app.com" set :branch, fetch(:branch, "master") set :shared_children, ["web/uploads", "config"] set :user, "vagrant" set :group_writable, true set :use_sudo, false set :copy_exclude, [".git"] set :deploy_via, :remote_cache set :keep_releases, 5 ssh_options[:forward_agent] = true default_run_options[:pty] = true logger.level = Logger::MAX_LEVEL # if you want to clean up old releases on each deploy uncomment this: after "deploy:restart", "deploy:cleanup" config/deploy.rb
  • 14. $ cap <env> deploy server "www.my-app.com", :app, :web, :db, :primary => true set :deploy_to, "/var/www/my-app.com" set :branch, fetch(:branch, "master") MULTISTAGE server "s.my-app.com", :app, :web, :db, :primary => true set :deploy_to, "/var/www/my-app.com" set :branch, fetch(:branch, "develop") config/deploy/production.rb config/deploy/staging.rb command line
  • 15. cap deploy # Deploys your project. cap deploy:check # Test deployment dependencies. cap deploy:cleanup # Clean up old releases. cap deploy:cold # Deploys and starts a `cold' application. cap deploy:create_symlink # Updates the symlink to the most recently deployed... cap deploy:migrate # Run the migrate rake task. cap deploy:migrations # Deploy and run pending migrations. cap deploy:pending # Displays the commits since your last deploy. cap deploy:pending:diff # Displays the `diff' since your last deploy. cap deploy:restart # Blank task exists as a hook into which to install... cap deploy:rollback # Rolls back to a previous version and restarts. cap deploy:rollback:code # Rolls back to the previously deployed version. cap deploy:setup # Prepares one or more servers for deployment. cap deploy:start # Blank task exists as a hook into which to install... cap deploy:stop # Blank task exists as a hook into which to install... cap deploy:symlink # Deprecated API. cap deploy:update # Copies your project and updates the symlink. cap deploy:update_code # Copies your project to the remote servers. cap deploy:upload # Copy files to the currently deployed version. cap invoke # Invoke a single command on the remote servers. cap shell # Begin an interactive Capistrano session. cap -T
  • 16. namespace :deploy do task :start do end task :stop do end task :restart, :roles => :app, :except => { :no_release => true } do run "sudo /etc/init.d/httpd restart" end end OverrideTasks
  • 17. namespace :config do desc "Upload config/config.php to remote server" task :to_remote do upload("config/config.php", "#{shared_path}/config/config.php", :via => :scp) end end $ cap config:to_remote CustomTasks
  • 18. WTF
  • 19. [my-app.com] executing command ** [my-app.com :: out] Permission denied (publickey). ** [my-app.com :: out] ** [my-app.com :: out] fatal: The remote end hung up unexpectedly ** [my-app.com :: out] command finished in 2769ms *** [deploy:update_code] rolling back WTF $ ssh-add
  • 20. namespace :deploy do desc 'Show deployed revision' task :revision, :roles => :app do run "#{try_sudo} cat #{current_path}/REVISION" end end WTF $ cap deploy:revision
  • 21. #server "server1, :app, :web, :db, :primary => true role :app, "server1", "server2" role :web, "server1", "server2" role :db, "dbserver", :primary => true SCALING WEB APPS $ cap deploy:setup