SlideShare a Scribd company logo
Capistrano Deployment  By Sharma
Application Deployment Application deployment is one of those things that becomes more and more complicated as the scale of our application increases. With just a single box running our database and our application, it’s very easy to handle.  But when we start putting our database on a different server, and then separating our web servers from our application servers, and eventually splitting our database into master and slave servers… It can get to where we almost don’t want to deploy our application any more.
When we need to Deploy Whenever we make any changes in any of the components/files which are part of the repository (like SVN, Git) then we need to publish it, otherwise changes might not be visible.
What is Capistrano Capistrano  is an open source tool for running scripts on multiple servers and its main use is deploying web applications. It is a standalone utility that can also integrate nicely with Rails. We simply provide Capistrano with a deployment “recipe” or “formula” that describes our various servers and their roles. It is a single-command deployment. It even allows us to roll a bad version out of production and it revert back to the previous release very easily.
Capistrano Deployment The main functionality of the Capistrano is to Deploy the rails application which we have already developed and we are using the "SVN" or “GIT” to manage the code.  It will transfer all the files of our rails application which we have developed in our local host to server directly by simply executing a simple command in our command prompt.
Capistrano Deployment Capistrano is originally called SwitchTower, the name was changed to Capistrano in March 2006 because of some trademark conflict. The original author, Jamis Buck, announced in the year 2009.
Steps to deploy a rails app >  gem install capistrano
Capistrano Deployment Now, we need to capistranize our rails application using the following command >capify . It will creates two files:   -- config/deploy.rb --  capfile
How to set the deploy.rb file require 'rubygems' require 'activesupport' set :application, “<application_name>&quot; set :scm_username, “<username>“ set :use_sudo, false set :repository,  &quot;http://#{scm_username}@www.example.com/svn/trunk&quot;
deploy.rb file :scm_username is your server user name. :application is an arbitrary name you create to identify your application on the server :use_sudo specifies to Capistrano that it does not need to append 'sudo' before all the commands it will run. :repository identifies where your Subversion repository is located.
deploy.rb file If we aren't deploying to /u/apps/#{application} on the target servers (which is the default path), we need to specify  the actual location by using deploy_to variable like this… set :deploy_to, &quot;/var/www/#{application}&quot; set :deploy_via, :checkout
deploy.rb file If we aren't using Subversion(SVN) to manage our source code, specify the SCM by using the “scm” variable… set :scm, :git set :user, &quot;root&quot; role :app, &quot;divvyhub.com&quot; role :web, &quot;divvyhub.com&quot; role :db,  &quot;divvyhub.com&quot;, :primary => true
deploy.rb file These are the default roles created by the capistrano, but we can add others if we want. The default roles are: role :app, “<domain_name>&quot; role :web, “<domain_name>&quot; role :db,  “<domain_name>&quot;, :primary => true Since most rails users will have the same domain name for their web, app, and database, we can simply use our domain variable we set earlier.
deploy.rb file namespace :migrations do desc &quot;Run the Migrations&quot; task :up, :roles => :app do   run &quot;cd #{current_path}; rake db:auto:migrate;&quot; end task :down, :roles => :app do run &quot;cd #{current_path}; rake db:drop; rake db:create&quot; end end
Capistrano Deployment After completion of our settings in the deploy.rb file, we need to commit the application by using “svn commit” command if we use SVN. Then we need to run the following command: > cap deploy:setup It is used to create the directory structure in server.
Capistrano Deployment > cap deploy:check It checks all the dependencies/things like directory permissions and necessary utilities to deploy the application by using Capistrano. If everything is successful, you should see a message like…  You  appear to have all necessary dependencies installed
Capistrano Deployment And finally deploy the application by using the following command: > cap deploy …………… . …………… .. Command finished successfully…..
Some Important commands To Install the gem > gem install capistrano Add our application to Capistrano > capify .  Execute the setup tasks  > cap deploy:setup
Capistrano Commands > cap deploy:setup it will create the directory structure in server like this…
Capistrano Commands Deploy our application > cap deploy  Runs the migrate task on the new release before updating the symlink > rake remote:deploy_with_migrations  Rollback a release from production  > rake rollback
Capistrano Commands Clean up the releases directory, leaving the five most recent releases > cap cleanup
Capistrano Commands Prints the difference between what was last deployed, and what is currently in your repository > cap diff_from_last_deploy
Advantages It can execute commands in parallel on multiple servers.  It can perform migrations during deployment. It can restart mongrels/fcgi.  It uses repository which allows us to easy upgradation of source code.
Disadvantages & Alternatives lack of scalability : when you're dealing with hundreds of servers, it starts showing its limits, unless it makes heavy use of threading or multi-processing. Altarnatives : inploy  ----  gem install inploy vlad -----  gem install vlad phd -----   Passenger-based Heroku-like Deployment
References http://www.capify.org http://ruby-toolbox.com/categories/deployment_automation.html
Thank   You
Ad

More Related Content

What's hot (20)

London Community Summit - Habitat 2016
London Community Summit - Habitat 2016London Community Summit - Habitat 2016
London Community Summit - Habitat 2016
Sarah Richards
 
PostgREST Design Philosophy
PostgREST Design PhilosophyPostgREST Design Philosophy
PostgREST Design Philosophy
begriffs
 
Migration Station at SAS - DevOps for Fusion with Version Control and Continu...
Migration Station at SAS - DevOps for Fusion with Version Control and Continu...Migration Station at SAS - DevOps for Fusion with Version Control and Continu...
Migration Station at SAS - DevOps for Fusion with Version Control and Continu...
Lucidworks
 
Ansible introduction - XX Betabeers Galicia
Ansible introduction - XX Betabeers GaliciaAnsible introduction - XX Betabeers Galicia
Ansible introduction - XX Betabeers Galicia
Juan Diego Pereiro Arean
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
Eric Berry
 
Using continuouspipe to speed up our workflows
Using continuouspipe to speed up our workflowsUsing continuouspipe to speed up our workflows
Using continuouspipe to speed up our workflows
Samuel ROZE
 
Where is my scalable API?
Where is my scalable API?Where is my scalable API?
Where is my scalable API?
Juan Pablo Genovese
 
ActionCableを触ってみた
ActionCableを触ってみたActionCableを触ってみた
ActionCableを触ってみた
Yoichi Toyota
 
Groovy Component With Mule ESB
Groovy Component With Mule ESBGroovy Component With Mule ESB
Groovy Component With Mule ESB
Jitendra Bafna
 
Breaking Up With Your Data Center Presentation
Breaking Up With Your Data Center PresentationBreaking Up With Your Data Center Presentation
Breaking Up With Your Data Center Presentation
Telescope_Inc
 
Spring Cloud Config
Spring Cloud ConfigSpring Cloud Config
Spring Cloud Config
Theerut Bunkhanphol
 
Gearman and Perl
Gearman and PerlGearman and Perl
Gearman and Perl
Andrew Shitov
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction
Robert Reiz
 
Server Side Rendering, caching and performance
Server Side Rendering, caching and performanceServer Side Rendering, caching and performance
Server Side Rendering, caching and performance
Ateev Chopra
 
Sftp component
Sftp componentSftp component
Sftp component
Neha Kanekar
 
Mule ESB - Consuming RESTful WS with RAML Definition
Mule ESB - Consuming RESTful WS with RAML DefinitionMule ESB - Consuming RESTful WS with RAML Definition
Mule ESB - Consuming RESTful WS with RAML Definition
Giuseppe De Michele
 
Heat and its resources
Heat and its resourcesHeat and its resources
Heat and its resources
Sangeeth Kumar
 
Self Created Load Balancer for MTA on AWS
Self Created Load Balancer for MTA on AWSSelf Created Load Balancer for MTA on AWS
Self Created Load Balancer for MTA on AWS
sharu1204
 
Composer intro
Composer introComposer intro
Composer intro
Timothy Hilliard
 
Gearman & PHP
Gearman & PHPGearman & PHP
Gearman & PHP
Nemanja Krivokapic
 
London Community Summit - Habitat 2016
London Community Summit - Habitat 2016London Community Summit - Habitat 2016
London Community Summit - Habitat 2016
Sarah Richards
 
PostgREST Design Philosophy
PostgREST Design PhilosophyPostgREST Design Philosophy
PostgREST Design Philosophy
begriffs
 
Migration Station at SAS - DevOps for Fusion with Version Control and Continu...
Migration Station at SAS - DevOps for Fusion with Version Control and Continu...Migration Station at SAS - DevOps for Fusion with Version Control and Continu...
Migration Station at SAS - DevOps for Fusion with Version Control and Continu...
Lucidworks
 
Ansible introduction - XX Betabeers Galicia
Ansible introduction - XX Betabeers GaliciaAnsible introduction - XX Betabeers Galicia
Ansible introduction - XX Betabeers Galicia
Juan Diego Pereiro Arean
 
Using continuouspipe to speed up our workflows
Using continuouspipe to speed up our workflowsUsing continuouspipe to speed up our workflows
Using continuouspipe to speed up our workflows
Samuel ROZE
 
ActionCableを触ってみた
ActionCableを触ってみたActionCableを触ってみた
ActionCableを触ってみた
Yoichi Toyota
 
Groovy Component With Mule ESB
Groovy Component With Mule ESBGroovy Component With Mule ESB
Groovy Component With Mule ESB
Jitendra Bafna
 
Breaking Up With Your Data Center Presentation
Breaking Up With Your Data Center PresentationBreaking Up With Your Data Center Presentation
Breaking Up With Your Data Center Presentation
Telescope_Inc
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction
Robert Reiz
 
Server Side Rendering, caching and performance
Server Side Rendering, caching and performanceServer Side Rendering, caching and performance
Server Side Rendering, caching and performance
Ateev Chopra
 
Mule ESB - Consuming RESTful WS with RAML Definition
Mule ESB - Consuming RESTful WS with RAML DefinitionMule ESB - Consuming RESTful WS with RAML Definition
Mule ESB - Consuming RESTful WS with RAML Definition
Giuseppe De Michele
 
Heat and its resources
Heat and its resourcesHeat and its resources
Heat and its resources
Sangeeth Kumar
 
Self Created Load Balancer for MTA on AWS
Self Created Load Balancer for MTA on AWSSelf Created Load Balancer for MTA on AWS
Self Created Load Balancer for MTA on AWS
sharu1204
 

Viewers also liked (20)

Web Designing Bugs - Fixes By Nyros Developer
Web Designing Bugs - Fixes By Nyros DeveloperWeb Designing Bugs - Fixes By Nyros Developer
Web Designing Bugs - Fixes By Nyros Developer
Nyros Technologies
 
MVC Architecture in ASP.Net By Nyros Developer
MVC Architecture in ASP.Net By Nyros DeveloperMVC Architecture in ASP.Net By Nyros Developer
MVC Architecture in ASP.Net By Nyros Developer
Nyros Technologies
 
Global Payment System- Reference Architecture
Global Payment System- Reference ArchitectureGlobal Payment System- Reference Architecture
Global Payment System- Reference Architecture
Ramadas MV
 
Peter Afanasiev - Architecture of online Payments
Peter Afanasiev - Architecture of online PaymentsPeter Afanasiev - Architecture of online Payments
Peter Afanasiev - Architecture of online Payments
Ciklum Ukraine
 
Payment Gateway
Payment GatewayPayment Gateway
Payment Gateway
Asif Hussain
 
Payment Gateway
Payment GatewayPayment Gateway
Payment Gateway
Ashraf Bashir
 
Payment Gateway
Payment GatewayPayment Gateway
Payment Gateway
Nyros Technologies
 
Online Payment Gateway System
Online Payment Gateway SystemOnline Payment Gateway System
Online Payment Gateway System
Mannu Khani
 
Hannah Wilde Article Contributions-GPS Edition 4
Hannah Wilde Article Contributions-GPS Edition 4Hannah Wilde Article Contributions-GPS Edition 4
Hannah Wilde Article Contributions-GPS Edition 4
Hannah Wilde
 
Transforming Xml Data Into Html
Transforming Xml Data Into HtmlTransforming Xml Data Into Html
Transforming Xml Data Into Html
Karthikeyan Mkr
 
Tahun 4 mobail buah-buahan
Tahun 4 mobail   buah-buahanTahun 4 mobail   buah-buahan
Tahun 4 mobail buah-buahan
ong2012
 
IPv6 deployment status
IPv6 deployment statusIPv6 deployment status
IPv6 deployment status
APNIC
 
Rubrik Parenting Jendela Keluarga Majalah Hidayatullah
Rubrik Parenting  Jendela Keluarga Majalah Hidayatullah Rubrik Parenting  Jendela Keluarga Majalah Hidayatullah
Rubrik Parenting Jendela Keluarga Majalah Hidayatullah
MAJALAH HIDAYATULLAH
 
Tayammum
TayammumTayammum
Tayammum
heavnzcharm
 
Alfresco Web Content Management Roadmap - 3.2 and Beyond
Alfresco Web Content Management Roadmap - 3.2 and BeyondAlfresco Web Content Management Roadmap - 3.2 and Beyond
Alfresco Web Content Management Roadmap - 3.2 and Beyond
Alfresco Software
 
Work1m33 25,9
Work1m33 25,9Work1m33 25,9
Work1m33 25,9
RewV6
 
emediaIT - Sharepoint 2010 and K2 Breakfast - 2010.04.22
emediaIT - Sharepoint 2010 and K2 Breakfast - 2010.04.22emediaIT - Sharepoint 2010 and K2 Breakfast - 2010.04.22
emediaIT - Sharepoint 2010 and K2 Breakfast - 2010.04.22
Venketash (Pat) Ramadass
 
신기술업무프로세스핵심용어(It비지니스용어집)
신기술업무프로세스핵심용어(It비지니스용어집)신기술업무프로세스핵심용어(It비지니스용어집)
신기술업무프로세스핵심용어(It비지니스용어집)
Jay W. Choi
 
Let's runaway with Valadoo
Let's runaway with ValadooLet's runaway with Valadoo
Let's runaway with Valadoo
Putri Ayu Lestari
 
paginas web en mexico
paginas web en mexicopaginas web en mexico
paginas web en mexico
cable9tin
 
Web Designing Bugs - Fixes By Nyros Developer
Web Designing Bugs - Fixes By Nyros DeveloperWeb Designing Bugs - Fixes By Nyros Developer
Web Designing Bugs - Fixes By Nyros Developer
Nyros Technologies
 
MVC Architecture in ASP.Net By Nyros Developer
MVC Architecture in ASP.Net By Nyros DeveloperMVC Architecture in ASP.Net By Nyros Developer
MVC Architecture in ASP.Net By Nyros Developer
Nyros Technologies
 
Global Payment System- Reference Architecture
Global Payment System- Reference ArchitectureGlobal Payment System- Reference Architecture
Global Payment System- Reference Architecture
Ramadas MV
 
Peter Afanasiev - Architecture of online Payments
Peter Afanasiev - Architecture of online PaymentsPeter Afanasiev - Architecture of online Payments
Peter Afanasiev - Architecture of online Payments
Ciklum Ukraine
 
Online Payment Gateway System
Online Payment Gateway SystemOnline Payment Gateway System
Online Payment Gateway System
Mannu Khani
 
Hannah Wilde Article Contributions-GPS Edition 4
Hannah Wilde Article Contributions-GPS Edition 4Hannah Wilde Article Contributions-GPS Edition 4
Hannah Wilde Article Contributions-GPS Edition 4
Hannah Wilde
 
Transforming Xml Data Into Html
Transforming Xml Data Into HtmlTransforming Xml Data Into Html
Transforming Xml Data Into Html
Karthikeyan Mkr
 
Tahun 4 mobail buah-buahan
Tahun 4 mobail   buah-buahanTahun 4 mobail   buah-buahan
Tahun 4 mobail buah-buahan
ong2012
 
IPv6 deployment status
IPv6 deployment statusIPv6 deployment status
IPv6 deployment status
APNIC
 
Rubrik Parenting Jendela Keluarga Majalah Hidayatullah
Rubrik Parenting  Jendela Keluarga Majalah Hidayatullah Rubrik Parenting  Jendela Keluarga Majalah Hidayatullah
Rubrik Parenting Jendela Keluarga Majalah Hidayatullah
MAJALAH HIDAYATULLAH
 
Alfresco Web Content Management Roadmap - 3.2 and Beyond
Alfresco Web Content Management Roadmap - 3.2 and BeyondAlfresco Web Content Management Roadmap - 3.2 and Beyond
Alfresco Web Content Management Roadmap - 3.2 and Beyond
Alfresco Software
 
Work1m33 25,9
Work1m33 25,9Work1m33 25,9
Work1m33 25,9
RewV6
 
emediaIT - Sharepoint 2010 and K2 Breakfast - 2010.04.22
emediaIT - Sharepoint 2010 and K2 Breakfast - 2010.04.22emediaIT - Sharepoint 2010 and K2 Breakfast - 2010.04.22
emediaIT - Sharepoint 2010 and K2 Breakfast - 2010.04.22
Venketash (Pat) Ramadass
 
신기술업무프로세스핵심용어(It비지니스용어집)
신기술업무프로세스핵심용어(It비지니스용어집)신기술업무프로세스핵심용어(It비지니스용어집)
신기술업무프로세스핵심용어(It비지니스용어집)
Jay W. Choi
 
paginas web en mexico
paginas web en mexicopaginas web en mexico
paginas web en mexico
cable9tin
 
Ad

Similar to Capistrano Deployment By Nyros Developer (20)

Capistrano
CapistranoCapistrano
Capistrano
Jason Noble
 
Capistrano - Deployment Tool
Capistrano - Deployment ToolCapistrano - Deployment Tool
Capistrano - Deployment Tool
Nyros Technologies
 
Capistrano
CapistranoCapistrano
Capistrano
Travis Roberts
 
Create a new project in ROR
Create a new project in RORCreate a new project in ROR
Create a new project in ROR
akankshita satapathy
 
Deploying Rails Applications with Capistrano
Deploying Rails Applications with CapistranoDeploying Rails Applications with Capistrano
Deploying Rails Applications with Capistrano
Almir Mendes
 
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
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with Capistrano
Ramazan K
 
Deploy Rails Application by Capistrano
Deploy Rails Application by CapistranoDeploy Rails Application by Capistrano
Deploy Rails Application by Capistrano
Tasawr Interactive
 
AWS Container Services – 유재석 (AWS 솔루션즈 아키텍트)
AWS Container Services – 유재석 (AWS 솔루션즈 아키텍트)AWS Container Services – 유재석 (AWS 솔루션즈 아키텍트)
AWS Container Services – 유재석 (AWS 솔루션즈 아키텍트)
Amazon Web Services Korea
 
Amazon Container Services – 유재석 (AWS 솔루션즈 아키텍트)
 Amazon Container Services – 유재석 (AWS 솔루션즈 아키텍트) Amazon Container Services – 유재석 (AWS 솔루션즈 아키텍트)
Amazon Container Services – 유재석 (AWS 솔루션즈 아키텍트)
Amazon Web Services Korea
 
Capybara and cucumber with DSL using ruby
Capybara and cucumber with DSL using rubyCapybara and cucumber with DSL using ruby
Capybara and cucumber with DSL using ruby
Deepak Chandella
 
Complex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBoxComplex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBox
bobmcwhirter
 
Useful Rails Plugins
Useful Rails PluginsUseful Rails Plugins
Useful Rails Plugins
navjeet
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient way
Sylvain Rayé
 
AWS 고객사를 위한 ‘AWS 컨테이너 교육’ - 유재석, AWS 솔루션즈 아키텍트
AWS 고객사를 위한 ‘AWS 컨테이너 교육’ - 유재석, AWS 솔루션즈 아키텍트AWS 고객사를 위한 ‘AWS 컨테이너 교육’ - 유재석, AWS 솔루션즈 아키텍트
AWS 고객사를 위한 ‘AWS 컨테이너 교육’ - 유재석, AWS 솔루션즈 아키텍트
Amazon Web Services Korea
 
CAPISTRANO
CAPISTRANOCAPISTRANO
CAPISTRANO
AnsviaLab
 
Rails Engine | Modular application
Rails Engine | Modular applicationRails Engine | Modular application
Rails Engine | Modular application
mirrec
 
Painless Deployment with Capistrano
Painless Deployment with CapistranoPainless Deployment with Capistrano
Painless Deployment with Capistrano
Nick Kugaevsky
 
Deploy like a pro!
Deploy like a pro!Deploy like a pro!
Deploy like a pro!
Damian Serrano Thode
 
Advanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutesAdvanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutes
Hiroshi SHIBATA
 
Deploying Rails Applications with Capistrano
Deploying Rails Applications with CapistranoDeploying Rails Applications with Capistrano
Deploying Rails Applications with Capistrano
Almir Mendes
 
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
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with Capistrano
Ramazan K
 
Deploy Rails Application by Capistrano
Deploy Rails Application by CapistranoDeploy Rails Application by Capistrano
Deploy Rails Application by Capistrano
Tasawr Interactive
 
AWS Container Services – 유재석 (AWS 솔루션즈 아키텍트)
AWS Container Services – 유재석 (AWS 솔루션즈 아키텍트)AWS Container Services – 유재석 (AWS 솔루션즈 아키텍트)
AWS Container Services – 유재석 (AWS 솔루션즈 아키텍트)
Amazon Web Services Korea
 
Amazon Container Services – 유재석 (AWS 솔루션즈 아키텍트)
 Amazon Container Services – 유재석 (AWS 솔루션즈 아키텍트) Amazon Container Services – 유재석 (AWS 솔루션즈 아키텍트)
Amazon Container Services – 유재석 (AWS 솔루션즈 아키텍트)
Amazon Web Services Korea
 
Capybara and cucumber with DSL using ruby
Capybara and cucumber with DSL using rubyCapybara and cucumber with DSL using ruby
Capybara and cucumber with DSL using ruby
Deepak Chandella
 
Complex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBoxComplex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBox
bobmcwhirter
 
Useful Rails Plugins
Useful Rails PluginsUseful Rails Plugins
Useful Rails Plugins
navjeet
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient way
Sylvain Rayé
 
AWS 고객사를 위한 ‘AWS 컨테이너 교육’ - 유재석, AWS 솔루션즈 아키텍트
AWS 고객사를 위한 ‘AWS 컨테이너 교육’ - 유재석, AWS 솔루션즈 아키텍트AWS 고객사를 위한 ‘AWS 컨테이너 교육’ - 유재석, AWS 솔루션즈 아키텍트
AWS 고객사를 위한 ‘AWS 컨테이너 교육’ - 유재석, AWS 솔루션즈 아키텍트
Amazon Web Services Korea
 
Rails Engine | Modular application
Rails Engine | Modular applicationRails Engine | Modular application
Rails Engine | Modular application
mirrec
 
Painless Deployment with Capistrano
Painless Deployment with CapistranoPainless Deployment with Capistrano
Painless Deployment with Capistrano
Nick Kugaevsky
 
Advanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutesAdvanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutes
Hiroshi SHIBATA
 
Ad

More from Nyros Technologies (19)

Silver Light By Nyros Developer
Silver Light By Nyros DeveloperSilver Light By Nyros Developer
Silver Light By Nyros Developer
Nyros Technologies
 
Web 2.0 Design Standards By Nyros Developer
Web 2.0 Design Standards By Nyros DeveloperWeb 2.0 Design Standards By Nyros Developer
Web 2.0 Design Standards By Nyros Developer
Nyros Technologies
 
Web 2.0 By Nyros Developer
Web 2.0 By Nyros DeveloperWeb 2.0 By Nyros Developer
Web 2.0 By Nyros Developer
Nyros Technologies
 
Caching By Nyros Developer
Caching By Nyros DeveloperCaching By Nyros Developer
Caching By Nyros Developer
Nyros Technologies
 
Language Integrated Query By Nyros Developer
Language Integrated Query By Nyros DeveloperLanguage Integrated Query By Nyros Developer
Language Integrated Query By Nyros Developer
Nyros Technologies
 
New Features in .Net Framework 4.0 By Nyros Developer
New Features in .Net Framework 4.0 By Nyros DeveloperNew Features in .Net Framework 4.0 By Nyros Developer
New Features in .Net Framework 4.0 By Nyros Developer
Nyros Technologies
 
Oops in PHP By Nyros Developer
Oops in PHP By Nyros DeveloperOops in PHP By Nyros Developer
Oops in PHP By Nyros Developer
Nyros Technologies
 
Connect with Facebook to Rails Application By Nyros Developer
Connect with Facebook to Rails Application By Nyros DeveloperConnect with Facebook to Rails Application By Nyros Developer
Connect with Facebook to Rails Application By Nyros Developer
Nyros Technologies
 
Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
Nyros Technologies
 
Research on Audio and Video Streaming
Research on Audio and Video StreamingResearch on Audio and Video Streaming
Research on Audio and Video Streaming
Nyros Technologies
 
User Interface
User InterfaceUser Interface
User Interface
Nyros Technologies
 
Audio and Video Streaming
Audio and Video StreamingAudio and Video Streaming
Audio and Video Streaming
Nyros Technologies
 
Social Networking
Social NetworkingSocial Networking
Social Networking
Nyros Technologies
 
Aws
AwsAws
Aws
Nyros Technologies
 
GIT By Sivakrishna
GIT By SivakrishnaGIT By Sivakrishna
GIT By Sivakrishna
Nyros Technologies
 
Test Drive Development in Ruby On Rails
Test Drive Development in Ruby On RailsTest Drive Development in Ruby On Rails
Test Drive Development in Ruby On Rails
Nyros Technologies
 
Rspec
RspecRspec
Rspec
Nyros Technologies
 
Biz Talk Server
Biz Talk ServerBiz Talk Server
Biz Talk Server
Nyros Technologies
 
Webservices
WebservicesWebservices
Webservices
Nyros Technologies
 

Capistrano Deployment By Nyros Developer

  • 2. Application Deployment Application deployment is one of those things that becomes more and more complicated as the scale of our application increases. With just a single box running our database and our application, it’s very easy to handle. But when we start putting our database on a different server, and then separating our web servers from our application servers, and eventually splitting our database into master and slave servers… It can get to where we almost don’t want to deploy our application any more.
  • 3. When we need to Deploy Whenever we make any changes in any of the components/files which are part of the repository (like SVN, Git) then we need to publish it, otherwise changes might not be visible.
  • 4. What is Capistrano Capistrano is an open source tool for running scripts on multiple servers and its main use is deploying web applications. It is a standalone utility that can also integrate nicely with Rails. We simply provide Capistrano with a deployment “recipe” or “formula” that describes our various servers and their roles. It is a single-command deployment. It even allows us to roll a bad version out of production and it revert back to the previous release very easily.
  • 5. Capistrano Deployment The main functionality of the Capistrano is to Deploy the rails application which we have already developed and we are using the &quot;SVN&quot; or “GIT” to manage the code. It will transfer all the files of our rails application which we have developed in our local host to server directly by simply executing a simple command in our command prompt.
  • 6. Capistrano Deployment Capistrano is originally called SwitchTower, the name was changed to Capistrano in March 2006 because of some trademark conflict. The original author, Jamis Buck, announced in the year 2009.
  • 7. Steps to deploy a rails app > gem install capistrano
  • 8. Capistrano Deployment Now, we need to capistranize our rails application using the following command >capify . It will creates two files: -- config/deploy.rb -- capfile
  • 9. How to set the deploy.rb file require 'rubygems' require 'activesupport' set :application, “<application_name>&quot; set :scm_username, “<username>“ set :use_sudo, false set :repository, &quot;http://#{scm_username}@www.example.com/svn/trunk&quot;
  • 10. deploy.rb file :scm_username is your server user name. :application is an arbitrary name you create to identify your application on the server :use_sudo specifies to Capistrano that it does not need to append 'sudo' before all the commands it will run. :repository identifies where your Subversion repository is located.
  • 11. deploy.rb file If we aren't deploying to /u/apps/#{application} on the target servers (which is the default path), we need to specify the actual location by using deploy_to variable like this… set :deploy_to, &quot;/var/www/#{application}&quot; set :deploy_via, :checkout
  • 12. deploy.rb file If we aren't using Subversion(SVN) to manage our source code, specify the SCM by using the “scm” variable… set :scm, :git set :user, &quot;root&quot; role :app, &quot;divvyhub.com&quot; role :web, &quot;divvyhub.com&quot; role :db, &quot;divvyhub.com&quot;, :primary => true
  • 13. deploy.rb file These are the default roles created by the capistrano, but we can add others if we want. The default roles are: role :app, “<domain_name>&quot; role :web, “<domain_name>&quot; role :db, “<domain_name>&quot;, :primary => true Since most rails users will have the same domain name for their web, app, and database, we can simply use our domain variable we set earlier.
  • 14. deploy.rb file namespace :migrations do desc &quot;Run the Migrations&quot; task :up, :roles => :app do run &quot;cd #{current_path}; rake db:auto:migrate;&quot; end task :down, :roles => :app do run &quot;cd #{current_path}; rake db:drop; rake db:create&quot; end end
  • 15. Capistrano Deployment After completion of our settings in the deploy.rb file, we need to commit the application by using “svn commit” command if we use SVN. Then we need to run the following command: > cap deploy:setup It is used to create the directory structure in server.
  • 16. Capistrano Deployment > cap deploy:check It checks all the dependencies/things like directory permissions and necessary utilities to deploy the application by using Capistrano. If everything is successful, you should see a message like… You appear to have all necessary dependencies installed
  • 17. Capistrano Deployment And finally deploy the application by using the following command: > cap deploy …………… . …………… .. Command finished successfully…..
  • 18. Some Important commands To Install the gem > gem install capistrano Add our application to Capistrano > capify . Execute the setup tasks > cap deploy:setup
  • 19. Capistrano Commands > cap deploy:setup it will create the directory structure in server like this…
  • 20. Capistrano Commands Deploy our application > cap deploy Runs the migrate task on the new release before updating the symlink > rake remote:deploy_with_migrations Rollback a release from production > rake rollback
  • 21. Capistrano Commands Clean up the releases directory, leaving the five most recent releases > cap cleanup
  • 22. Capistrano Commands Prints the difference between what was last deployed, and what is currently in your repository > cap diff_from_last_deploy
  • 23. Advantages It can execute commands in parallel on multiple servers. It can perform migrations during deployment. It can restart mongrels/fcgi. It uses repository which allows us to easy upgradation of source code.
  • 24. Disadvantages & Alternatives lack of scalability : when you're dealing with hundreds of servers, it starts showing its limits, unless it makes heavy use of threading or multi-processing. Altarnatives : inploy ---- gem install inploy vlad ----- gem install vlad phd ----- Passenger-based Heroku-like Deployment
  • 26. Thank You