SlideShare une entreprise Scribd logo
1  sur  31
Télécharger pour lire hors ligne
Capistrano 2
Beyond Hassle-Free Deployment
          Luca Mearelli
       Pisa - Oct. 27, 2007
Capistrano2
Rails is fun
Rails is fun
Rails is TOO MUCH fun
Deployment
System Administration
Rails : Web development
              =
Capistrano : Sys.administration
Capistrano basics

•SSH to the remote machines
•Posix compatible shell
•Same password or public key
•a bit of ruby knowledge
•works from a command line
Capistrano basics

•Capfile (makefile, rakefile, ...)
•It’s ruby
 task :dump_db, :hosts => quot;database.spazidigitali.comquot; do
   run quot;mysqldump -u deploy sd_production > /home/luca/dumps/db.sqlquot;
 end



  cap dump_db
role :sd_db, quot;database.spazidigitali.comquot;

task :dump_db do
  run quot;mysqldump -u deploy sd_production > /home/luca/dumps/db.sqlquot;
end

task :free_space do
  run quot;df -hquot;
end




       cap dump_db
set :gateway, quot;firewall.spazidigitali.comquot;
role :sd_db, quot;database.spazidigitali.comquot;

task :dump_db do
  run quot;mysqldump -u deploy sd_production > /home/luca/dumps/db.sqlquot;
end

task :free_space do
  run quot;df -hquot;
end




       cap dump_db
set :gateway, quot;firewall.spazidigitali.comquot;
role :sd_db, quot;database.spazidigitali.comquot;, quot;replica.spazidigitali.comquot;

task :dump_db do
  run quot;mysqldump -u deploy sd_production > /home/luca/dumps/db.sqlquot;
end

task :free_space do
  run quot;df -hquot;
end




       cap dump_db
set :gateway, quot;firewall.spazidigitali.comquot;
role :sd_db, quot;database.spazidigitali.comquot;, quot;replica.spazidigitali.comquot;
role :sd_app, quot;mongrels.spazidigitali.comquot;

task :dump_db, :roles=>:sd_db do
  run quot;mysqldump -u deploy sd_production > /home/luca/dumps/db.sqlquot;
end

task :free_space, :roles=>[:sd_db, :sd_app ] do
  run quot;df -hquot;
end




       cap dump_db
set :gateway, quot;firewall.spazidigitali.comquot;
role :sd_db, quot;database.spazidigitali.comquot;, quot;replica.spazidigitali.comquot;
role :sd_app, quot;mongrels.spazidigitali.comquot;

namespace :spazidig do
  desc quot;Dumping our DBsquot;
  task :dump_db, :roles=>:sd_db do
    run quot;mysqldump -u deploy sd_production > /home/luca/dumps/db.sqlquot;
  end

  desc quot;Checking free spacequot;
  task :free_space, :roles=>[:sd_db, :sd_app ]do
    run quot;df -hquot;
  end
end




       cap spazidig:dump_db
set :gateway, quot;firewall.spazidigitali.comquot;
role :sd_db, quot;database.spazidigitali.comquot;, quot;replica.spazidigitali.comquot;
role :sd_app, quot;mongrels.spazidigitali.comquot;

namespace :spazidig do
  desc quot;What??quot;
  task :default do
    run quot;uname -aquot;
  end

 desc quot;Dumping our DBsquot;
 task :dump_db, :roles=>:sd_db do
   run quot;mysqldump -u deploy sd_production > /home/luca/dumps/db.sqlquot;
 end

  desc quot;Checking free spacequot;
  task :free_space, :roles=>[:sd_db, :sd_app ]do
    run quot;df -hquot;
  end
end


       cap spazidig
           spazidig:dump_db
       cap dump_db
       cap spazidig:free_space
set :gateway, quot;firewall.spazidigitali.comquot;
role :sd_db, quot;database.spazidigitali.comquot;, quot;replica.spazidigitali.comquot;
role :sd_app, quot;mongrels.spazidigitali.comquot;

set :destination, quot;db.sqlquot;

namespace :spazidig do
  desc quot;Dumping our DBsquot;
  task :dump_db, :roles=>:sd_db do
    run quot;mysqldump -u deploy sd_production > /home/luca/dumps/#{destination}.sqlquot;
  end
end




        cap spazidig:dump_db
set :gateway, quot;firewall.spazidigitali.comquot;
role :sd_db, quot;database.spazidigitali.comquot;, quot;replica.spazidigitali.comquot;
role :sd_app, quot;mongrels.spazidigitali.comquot;

set :destination, quot;db.sqlquot;

set(:database) do
  Capistrano::CLI.ui.ask quot;Which database?: quot;
end

namespace :spazidig do
  desc quot;Dumping our DBsquot;
  task :dump_db, :roles=>:sd_db do
    run quot;mysqldump -u deploy #{database} > /home/luca/dumps/#{destination}.sqlquot;
  end
end




        cap spazidig:dump_db
task :deploy do
  transaction do
    try_this
    then_do_that

  end
end

task :try_this do
  on_rollback { run quot;do_cleanupquot; }
  #...
end

task :then_do_that do
  on_rollback { run quot;do_super_cleanupquot; }
  #...
end
on :event, :callback, :only => %w(tasks_to_do)
# :load, :exit, :start, :finish, :begin, :after


trigger :notify, current_task

on :notify, :callback
load_paths << quot;config/deployquot;
case ENV['STAGE']
when quot;productionquot; then
  load quot;productionquot;
when quot;stagingquot; then
  load quot;stagingquot;
else
  abort quot;unknown stage: #{ENV['STAGE']}quot;
end
before :deploy, :run_tests
after quot;deploy:update_codequot;, :link_database_yml
task :run_tests do
  system quot;rakequot; or abort quot;tests failedquot;
end
task :link_database_yml do
  run quot;ln -s #{release_path}/config/database.yml #{shared_path}/database.ymlquot;
end
Cap
•cap -T	
•cap <some task>
•cap invoke COMMAND=quot;df -hquot;
•cap invoke COMMAND=quot;df -hquot; ROLES=sd_db
•cap invoke COMMAND=quot;df -hquot; HOSTS=www.spazidigitali.com
•cap shell
Capify
  capify .




•Creates a Capfile
•Creates a deploy “configuration” file
Cap
•cap deploy:setup       •cap deploy
•cap deploy:check       •cap deploy:rollback
•cap deploy:cold        •cap deploy:migrations
•cap deploy:update      •cap deploy:web:disable
•cap deploy:migrate     •cap deploy:web:enable
•cap deploy:start       •cap deploy:cleanup
deploy:setup
•<deploy_to>
 •current
 •releases
  •200706060120
  •200702020815
 •shared
  •log
  •pids
  •system
deploy:check


depend   :remote, :gem, 'rpdf', '>=1.1.4'
depend   :remote, :directory, quot;/tmp/railsquot;
depend   :remote, :writable, quot;/dir/file.logquot;
depend   :local, :command, quot;gemquot;
depend   :remote, :command, quot;mysqldumpquot;
deploy:cold

•copies the code - cap deploy:update
•migrates the database - cap deploy:migrate
•starts the service - cap deploy:start
Variables
•:ssh_options         •:use_sudo
•:application         •:group_writable
•:repository          •:rake
•:scm                 •:current_path
•:deploy_via          •:release_path
•:deploy_to           •:shared_path
•:revision
Deployment strategies

•Checkout (classic capistrano)
•Remote cache (svn up)
•Export
•Copy (via checkout or export, with compression)
Example*
 *sorta real
That’s all folks


•Luca Mearelli
•http://spazidigitali.com
•lucamea@gmail.com

Contenu connexe

Tendances

Hacking ansible
Hacking ansibleHacking ansible
Hacking ansiblebcoca
 
How Danga::Socket handles asynchronous processing and how to write asynchrono...
How Danga::Socket handles asynchronous processing and how to write asynchrono...How Danga::Socket handles asynchronous processing and how to write asynchrono...
How Danga::Socket handles asynchronous processing and how to write asynchrono...Gosuke Miyashita
 
SDPHP - Percona Toolkit (It's Basically Magic)
SDPHP - Percona Toolkit (It's Basically Magic)SDPHP - Percona Toolkit (It's Basically Magic)
SDPHP - Percona Toolkit (It's Basically Magic)Robert Swisher
 
Inside Bokete: Web Application with Mojolicious and others
Inside Bokete:  Web Application with Mojolicious and othersInside Bokete:  Web Application with Mojolicious and others
Inside Bokete: Web Application with Mojolicious and othersYusuke Wada
 
Umleitung: a tiny mochiweb/CouchDB app
Umleitung: a tiny mochiweb/CouchDB appUmleitung: a tiny mochiweb/CouchDB app
Umleitung: a tiny mochiweb/CouchDB appLenz Gschwendtner
 
Ansible loves Python, Python Philadelphia meetup
Ansible loves Python, Python Philadelphia meetupAnsible loves Python, Python Philadelphia meetup
Ansible loves Python, Python Philadelphia meetupGreg DeKoenigsberg
 
Ruby off Rails (japanese)
Ruby off Rails (japanese)Ruby off Rails (japanese)
Ruby off Rails (japanese)Stoyan Zhekov
 
Merb Slices
Merb SlicesMerb Slices
Merb Sliceshassox
 
"Ops Tools with Perl" 2012/05/12 Hokkaido.pm
"Ops Tools with Perl" 2012/05/12 Hokkaido.pm"Ops Tools with Perl" 2012/05/12 Hokkaido.pm
"Ops Tools with Perl" 2012/05/12 Hokkaido.pmRyosuke IWANAGA
 
Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!Anatoly Sharifulin
 
Modern Perl Web Development with Dancer
Modern Perl Web Development with DancerModern Perl Web Development with Dancer
Modern Perl Web Development with DancerDave Cross
 
Asynchronous programming patterns in Perl
Asynchronous programming patterns in PerlAsynchronous programming patterns in Perl
Asynchronous programming patterns in Perldeepfountainconsulting
 
HTML5 tutorial: canvas, offfline & sockets
HTML5 tutorial: canvas, offfline & socketsHTML5 tutorial: canvas, offfline & sockets
HTML5 tutorial: canvas, offfline & socketsRemy Sharp
 
Automation and Ansible
Automation and AnsibleAutomation and Ansible
Automation and Ansiblejtyr
 
More tips n tricks
More tips n tricksMore tips n tricks
More tips n tricksbcoca
 
Deploy Rails Application by Capistrano
Deploy Rails Application by CapistranoDeploy Rails Application by Capistrano
Deploy Rails Application by CapistranoTasawr Interactive
 
Devsumi2012 攻めの運用の極意
Devsumi2012 攻めの運用の極意Devsumi2012 攻めの運用の極意
Devsumi2012 攻めの運用の極意Ryosuke IWANAGA
 
Lights, Camera, Docker: Streaming Video at DramaFever
Lights, Camera, Docker: Streaming Video at DramaFeverLights, Camera, Docker: Streaming Video at DramaFever
Lights, Camera, Docker: Streaming Video at DramaFeverbridgetkromhout
 

Tendances (20)

Hacking ansible
Hacking ansibleHacking ansible
Hacking ansible
 
How Danga::Socket handles asynchronous processing and how to write asynchrono...
How Danga::Socket handles asynchronous processing and how to write asynchrono...How Danga::Socket handles asynchronous processing and how to write asynchrono...
How Danga::Socket handles asynchronous processing and how to write asynchrono...
 
SDPHP - Percona Toolkit (It's Basically Magic)
SDPHP - Percona Toolkit (It's Basically Magic)SDPHP - Percona Toolkit (It's Basically Magic)
SDPHP - Percona Toolkit (It's Basically Magic)
 
Inside Bokete: Web Application with Mojolicious and others
Inside Bokete:  Web Application with Mojolicious and othersInside Bokete:  Web Application with Mojolicious and others
Inside Bokete: Web Application with Mojolicious and others
 
Umleitung: a tiny mochiweb/CouchDB app
Umleitung: a tiny mochiweb/CouchDB appUmleitung: a tiny mochiweb/CouchDB app
Umleitung: a tiny mochiweb/CouchDB app
 
Ansible loves Python, Python Philadelphia meetup
Ansible loves Python, Python Philadelphia meetupAnsible loves Python, Python Philadelphia meetup
Ansible loves Python, Python Philadelphia meetup
 
Ruby off Rails (japanese)
Ruby off Rails (japanese)Ruby off Rails (japanese)
Ruby off Rails (japanese)
 
Merb Slices
Merb SlicesMerb Slices
Merb Slices
 
"Ops Tools with Perl" 2012/05/12 Hokkaido.pm
"Ops Tools with Perl" 2012/05/12 Hokkaido.pm"Ops Tools with Perl" 2012/05/12 Hokkaido.pm
"Ops Tools with Perl" 2012/05/12 Hokkaido.pm
 
Cooking with Chef
Cooking with ChefCooking with Chef
Cooking with Chef
 
Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!
 
Modern Perl Web Development with Dancer
Modern Perl Web Development with DancerModern Perl Web Development with Dancer
Modern Perl Web Development with Dancer
 
Asynchronous programming patterns in Perl
Asynchronous programming patterns in PerlAsynchronous programming patterns in Perl
Asynchronous programming patterns in Perl
 
HTML5 tutorial: canvas, offfline & sockets
HTML5 tutorial: canvas, offfline & socketsHTML5 tutorial: canvas, offfline & sockets
HTML5 tutorial: canvas, offfline & sockets
 
Automation and Ansible
Automation and AnsibleAutomation and Ansible
Automation and Ansible
 
A Gentle Introduction to Event Loops
A Gentle Introduction to Event LoopsA Gentle Introduction to Event Loops
A Gentle Introduction to Event Loops
 
More tips n tricks
More tips n tricksMore tips n tricks
More tips n tricks
 
Deploy Rails Application by Capistrano
Deploy Rails Application by CapistranoDeploy Rails Application by Capistrano
Deploy Rails Application by Capistrano
 
Devsumi2012 攻めの運用の極意
Devsumi2012 攻めの運用の極意Devsumi2012 攻めの運用の極意
Devsumi2012 攻めの運用の極意
 
Lights, Camera, Docker: Streaming Video at DramaFever
Lights, Camera, Docker: Streaming Video at DramaFeverLights, Camera, Docker: Streaming Video at DramaFever
Lights, Camera, Docker: Streaming Video at DramaFever
 

En vedette (20)

Acabats
AcabatsAcabats
Acabats
 
Dossier textil 1011
Dossier textil 1011Dossier textil 1011
Dossier textil 1011
 
El TèXtil
El TèXtilEl TèXtil
El TèXtil
 
Filatura
FilaturaFilatura
Filatura
 
Les Fibres I Els Teixits
Les Fibres I  Els TeixitsLes Fibres I  Els Teixits
Les Fibres I Els Teixits
 
El tèxtil 2n ESO
El tèxtil 2n ESOEl tèxtil 2n ESO
El tèxtil 2n ESO
 
Produccion del zapato 10 3
Produccion del zapato 10 3Produccion del zapato 10 3
Produccion del zapato 10 3
 
And Now You Have Two Problems
And Now You Have Two ProblemsAnd Now You Have Two Problems
And Now You Have Two Problems
 
Presentacion teler
Presentacion telerPresentacion teler
Presentacion teler
 
El Teler
El TelerEl Teler
El Teler
 
El TèXtil
El TèXtilEl TèXtil
El TèXtil
 
Estudi de processos industrials
Estudi de processos industrialsEstudi de processos industrials
Estudi de processos industrials
 
El tissatge
El tissatgeEl tissatge
El tissatge
 
Les fibres tèxtils
Les fibres tèxtilsLes fibres tèxtils
Les fibres tèxtils
 
Tissatge
TissatgeTissatge
Tissatge
 
Presentación tratamiento plasma
Presentación tratamiento plasmaPresentación tratamiento plasma
Presentación tratamiento plasma
 
Plàstics i materials petris
Plàstics i materials petrisPlàstics i materials petris
Plàstics i materials petris
 
La revolució industrial
La revolució industrialLa revolució industrial
La revolució industrial
 
Ppt cal jepó
Ppt cal jepóPpt cal jepó
Ppt cal jepó
 
Etiquetado de prendas de vestir
Etiquetado de prendas de vestirEtiquetado de prendas de vestir
Etiquetado de prendas de vestir
 

Similaire à Capistrano2

Deploying Rails Applications with Capistrano
Deploying Rails Applications with CapistranoDeploying Rails Applications with Capistrano
Deploying Rails Applications with CapistranoAlmir Mendes
 
More Secrets of JavaScript Libraries
More Secrets of JavaScript LibrariesMore Secrets of JavaScript Libraries
More Secrets of JavaScript Librariesjeresig
 
Wide Open Spaces Using My Sql As A Web Mapping Service Backend
Wide Open Spaces Using My Sql As A Web Mapping Service BackendWide Open Spaces Using My Sql As A Web Mapping Service Backend
Wide Open Spaces Using My Sql As A Web Mapping Service BackendMySQLConference
 
Hacking with ruby2ruby
Hacking with ruby2rubyHacking with ruby2ruby
Hacking with ruby2rubyMarc Chung
 
Systems Automation with Puppet
Systems Automation with PuppetSystems Automation with Puppet
Systems Automation with Puppetelliando dias
 
Beijing Perl Workshop 2008 Hiveminder Secret Sauce
Beijing Perl Workshop 2008 Hiveminder Secret SauceBeijing Perl Workshop 2008 Hiveminder Secret Sauce
Beijing Perl Workshop 2008 Hiveminder Secret SauceJesse Vincent
 
Source Code of Building Linux IPv6 DNS Server (Complete Sourcecode)
Source Code of Building Linux IPv6 DNS Server (Complete Sourcecode)Source Code of Building Linux IPv6 DNS Server (Complete Sourcecode)
Source Code of Building Linux IPv6 DNS Server (Complete Sourcecode)Hari
 
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 AppSmartLogic
 
Ruby Isn't Just About Rails
Ruby Isn't Just About RailsRuby Isn't Just About Rails
Ruby Isn't Just About RailsAdam Wiggins
 
Make Your Life Easier With Maatkit
Make Your Life Easier With MaatkitMake Your Life Easier With Maatkit
Make Your Life Easier With MaatkitMySQLConference
 
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)ZFConf Conference
 
Delivering Go.CD with Terraform and Docker
Delivering Go.CD with Terraform and DockerDelivering Go.CD with Terraform and Docker
Delivering Go.CD with Terraform and DockerJorrit Salverda
 

Similaire à Capistrano2 (20)

Capistrano
CapistranoCapistrano
Capistrano
 
Capistrano Overview
Capistrano OverviewCapistrano Overview
Capistrano Overview
 
Sinatra
SinatraSinatra
Sinatra
 
Os Furlong
Os FurlongOs Furlong
Os Furlong
 
Deploying Rails Applications with Capistrano
Deploying Rails Applications with CapistranoDeploying Rails Applications with Capistrano
Deploying Rails Applications with Capistrano
 
More Secrets of JavaScript Libraries
More Secrets of JavaScript LibrariesMore Secrets of JavaScript Libraries
More Secrets of JavaScript Libraries
 
Capistrano
CapistranoCapistrano
Capistrano
 
Os Wilhelm
Os WilhelmOs Wilhelm
Os Wilhelm
 
Wide Open Spaces Using My Sql As A Web Mapping Service Backend
Wide Open Spaces Using My Sql As A Web Mapping Service BackendWide Open Spaces Using My Sql As A Web Mapping Service Backend
Wide Open Spaces Using My Sql As A Web Mapping Service Backend
 
Hacking with ruby2ruby
Hacking with ruby2rubyHacking with ruby2ruby
Hacking with ruby2ruby
 
Memcached Study
Memcached StudyMemcached Study
Memcached Study
 
Systems Automation with Puppet
Systems Automation with PuppetSystems Automation with Puppet
Systems Automation with Puppet
 
Beijing Perl Workshop 2008 Hiveminder Secret Sauce
Beijing Perl Workshop 2008 Hiveminder Secret SauceBeijing Perl Workshop 2008 Hiveminder Secret Sauce
Beijing Perl Workshop 2008 Hiveminder Secret Sauce
 
Source Code of Building Linux IPv6 DNS Server (Complete Sourcecode)
Source Code of Building Linux IPv6 DNS Server (Complete Sourcecode)Source Code of Building Linux IPv6 DNS Server (Complete Sourcecode)
Source Code of Building Linux IPv6 DNS Server (Complete Sourcecode)
 
EC2
EC2EC2
EC2
 
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
 
Ruby Isn't Just About Rails
Ruby Isn't Just About RailsRuby Isn't Just About Rails
Ruby Isn't Just About Rails
 
Make Your Life Easier With Maatkit
Make Your Life Easier With MaatkitMake Your Life Easier With Maatkit
Make Your Life Easier With Maatkit
 
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
 
Delivering Go.CD with Terraform and Docker
Delivering Go.CD with Terraform and DockerDelivering Go.CD with Terraform and Docker
Delivering Go.CD with Terraform and Docker
 

Plus de Luca Mearelli

The anatomy of an infographic
The anatomy of an infographicThe anatomy of an infographic
The anatomy of an infographicLuca Mearelli
 
L'altra meta del web
L'altra meta del webL'altra meta del web
L'altra meta del webLuca Mearelli
 
To Batch Or Not To Batch
To Batch Or Not To BatchTo Batch Or Not To Batch
To Batch Or Not To BatchLuca Mearelli
 
A Little Backbone For Your App
A Little Backbone For Your AppA Little Backbone For Your App
A Little Backbone For Your AppLuca Mearelli
 
Controlling The Cloud With Python
Controlling The Cloud With PythonControlling The Cloud With Python
Controlling The Cloud With PythonLuca Mearelli
 
Introduzione a Ruby On Rails
Introduzione a Ruby On RailsIntroduzione a Ruby On Rails
Introduzione a Ruby On RailsLuca Mearelli
 
Integrating services with OAuth
Integrating services with OAuthIntegrating services with OAuth
Integrating services with OAuthLuca Mearelli
 

Plus de Luca Mearelli (10)

The anatomy of an infographic
The anatomy of an infographicThe anatomy of an infographic
The anatomy of an infographic
 
L'altra meta del web
L'altra meta del webL'altra meta del web
L'altra meta del web
 
To Batch Or Not To Batch
To Batch Or Not To BatchTo Batch Or Not To Batch
To Batch Or Not To Batch
 
A Little Backbone For Your App
A Little Backbone For Your AppA Little Backbone For Your App
A Little Backbone For Your App
 
WorseSoftware
WorseSoftwareWorseSoftware
WorseSoftware
 
Controlling The Cloud With Python
Controlling The Cloud With PythonControlling The Cloud With Python
Controlling The Cloud With Python
 
Open Web
Open WebOpen Web
Open Web
 
Wikierp
WikierpWikierp
Wikierp
 
Introduzione a Ruby On Rails
Introduzione a Ruby On RailsIntroduzione a Ruby On Rails
Introduzione a Ruby On Rails
 
Integrating services with OAuth
Integrating services with OAuthIntegrating services with OAuth
Integrating services with OAuth
 

Dernier

UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdfPedro Manuel
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Commit University
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Brian Pichman
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfDianaGray10
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxUdaiappa Ramachandran
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 

Dernier (20)

UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdf
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 

Capistrano2

  • 1. Capistrano 2 Beyond Hassle-Free Deployment Luca Mearelli Pisa - Oct. 27, 2007
  • 4. Rails is fun Rails is TOO MUCH fun
  • 7. Rails : Web development = Capistrano : Sys.administration
  • 8. Capistrano basics •SSH to the remote machines •Posix compatible shell •Same password or public key •a bit of ruby knowledge •works from a command line
  • 9. Capistrano basics •Capfile (makefile, rakefile, ...) •It’s ruby task :dump_db, :hosts => quot;database.spazidigitali.comquot; do run quot;mysqldump -u deploy sd_production > /home/luca/dumps/db.sqlquot; end cap dump_db
  • 10. role :sd_db, quot;database.spazidigitali.comquot; task :dump_db do run quot;mysqldump -u deploy sd_production > /home/luca/dumps/db.sqlquot; end task :free_space do run quot;df -hquot; end cap dump_db
  • 11. set :gateway, quot;firewall.spazidigitali.comquot; role :sd_db, quot;database.spazidigitali.comquot; task :dump_db do run quot;mysqldump -u deploy sd_production > /home/luca/dumps/db.sqlquot; end task :free_space do run quot;df -hquot; end cap dump_db
  • 12. set :gateway, quot;firewall.spazidigitali.comquot; role :sd_db, quot;database.spazidigitali.comquot;, quot;replica.spazidigitali.comquot; task :dump_db do run quot;mysqldump -u deploy sd_production > /home/luca/dumps/db.sqlquot; end task :free_space do run quot;df -hquot; end cap dump_db
  • 13. set :gateway, quot;firewall.spazidigitali.comquot; role :sd_db, quot;database.spazidigitali.comquot;, quot;replica.spazidigitali.comquot; role :sd_app, quot;mongrels.spazidigitali.comquot; task :dump_db, :roles=>:sd_db do run quot;mysqldump -u deploy sd_production > /home/luca/dumps/db.sqlquot; end task :free_space, :roles=>[:sd_db, :sd_app ] do run quot;df -hquot; end cap dump_db
  • 14. set :gateway, quot;firewall.spazidigitali.comquot; role :sd_db, quot;database.spazidigitali.comquot;, quot;replica.spazidigitali.comquot; role :sd_app, quot;mongrels.spazidigitali.comquot; namespace :spazidig do desc quot;Dumping our DBsquot; task :dump_db, :roles=>:sd_db do run quot;mysqldump -u deploy sd_production > /home/luca/dumps/db.sqlquot; end desc quot;Checking free spacequot; task :free_space, :roles=>[:sd_db, :sd_app ]do run quot;df -hquot; end end cap spazidig:dump_db
  • 15. set :gateway, quot;firewall.spazidigitali.comquot; role :sd_db, quot;database.spazidigitali.comquot;, quot;replica.spazidigitali.comquot; role :sd_app, quot;mongrels.spazidigitali.comquot; namespace :spazidig do desc quot;What??quot; task :default do run quot;uname -aquot; end desc quot;Dumping our DBsquot; task :dump_db, :roles=>:sd_db do run quot;mysqldump -u deploy sd_production > /home/luca/dumps/db.sqlquot; end desc quot;Checking free spacequot; task :free_space, :roles=>[:sd_db, :sd_app ]do run quot;df -hquot; end end cap spazidig spazidig:dump_db cap dump_db cap spazidig:free_space
  • 16. set :gateway, quot;firewall.spazidigitali.comquot; role :sd_db, quot;database.spazidigitali.comquot;, quot;replica.spazidigitali.comquot; role :sd_app, quot;mongrels.spazidigitali.comquot; set :destination, quot;db.sqlquot; namespace :spazidig do desc quot;Dumping our DBsquot; task :dump_db, :roles=>:sd_db do run quot;mysqldump -u deploy sd_production > /home/luca/dumps/#{destination}.sqlquot; end end cap spazidig:dump_db
  • 17. set :gateway, quot;firewall.spazidigitali.comquot; role :sd_db, quot;database.spazidigitali.comquot;, quot;replica.spazidigitali.comquot; role :sd_app, quot;mongrels.spazidigitali.comquot; set :destination, quot;db.sqlquot; set(:database) do Capistrano::CLI.ui.ask quot;Which database?: quot; end namespace :spazidig do desc quot;Dumping our DBsquot; task :dump_db, :roles=>:sd_db do run quot;mysqldump -u deploy #{database} > /home/luca/dumps/#{destination}.sqlquot; end end cap spazidig:dump_db
  • 18. task :deploy do transaction do try_this then_do_that end end task :try_this do on_rollback { run quot;do_cleanupquot; } #... end task :then_do_that do on_rollback { run quot;do_super_cleanupquot; } #... end
  • 19. on :event, :callback, :only => %w(tasks_to_do) # :load, :exit, :start, :finish, :begin, :after trigger :notify, current_task on :notify, :callback
  • 20. load_paths << quot;config/deployquot; case ENV['STAGE'] when quot;productionquot; then load quot;productionquot; when quot;stagingquot; then load quot;stagingquot; else abort quot;unknown stage: #{ENV['STAGE']}quot; end
  • 21. before :deploy, :run_tests after quot;deploy:update_codequot;, :link_database_yml task :run_tests do system quot;rakequot; or abort quot;tests failedquot; end task :link_database_yml do run quot;ln -s #{release_path}/config/database.yml #{shared_path}/database.ymlquot; end
  • 22. Cap •cap -T •cap <some task> •cap invoke COMMAND=quot;df -hquot; •cap invoke COMMAND=quot;df -hquot; ROLES=sd_db •cap invoke COMMAND=quot;df -hquot; HOSTS=www.spazidigitali.com •cap shell
  • 23. Capify capify . •Creates a Capfile •Creates a deploy “configuration” file
  • 24. Cap •cap deploy:setup •cap deploy •cap deploy:check •cap deploy:rollback •cap deploy:cold •cap deploy:migrations •cap deploy:update •cap deploy:web:disable •cap deploy:migrate •cap deploy:web:enable •cap deploy:start •cap deploy:cleanup
  • 25. deploy:setup •<deploy_to> •current •releases •200706060120 •200702020815 •shared •log •pids •system
  • 26. deploy:check depend :remote, :gem, 'rpdf', '>=1.1.4' depend :remote, :directory, quot;/tmp/railsquot; depend :remote, :writable, quot;/dir/file.logquot; depend :local, :command, quot;gemquot; depend :remote, :command, quot;mysqldumpquot;
  • 27. deploy:cold •copies the code - cap deploy:update •migrates the database - cap deploy:migrate •starts the service - cap deploy:start
  • 28. Variables •:ssh_options •:use_sudo •:application •:group_writable •:repository •:rake •:scm •:current_path •:deploy_via •:release_path •:deploy_to •:shared_path •:revision
  • 29. Deployment strategies •Checkout (classic capistrano) •Remote cache (svn up) •Export •Copy (via checkout or export, with compression)
  • 31. That’s all folks •Luca Mearelli •http://spazidigitali.com •lucamea@gmail.com