SlideShare a Scribd company logo
1 of 18
Download to read offline
Getting Started with Capistrano
       in Ten Easy Steps



            Keith Pitty

         http://keithpitty.org
         keith@keithpitty.org
What is Capistrano?

   ●   A tool that aims to make it easy to deploy Rails
       applications!
   ●   Written by Jamis Buck, one of the core Rails team




21 Feb 2007   Sydney RoR Meetup: quot;Getting Started with Capistranoquot;   Keith Pitty   2
These ten steps are based on my
  experience
   ●   Starting point:
        –     “Agile Web Development with Rails”
        –     2nd edition, Section 27.5
   ●   There may be better ways, but...
   ●   The following steps worked for me




21 Feb 2007       Sydney RoR Meetup: quot;Getting Started with Capistranoquot;   Keith Pitty   3
Step 1: Install Software

   ●   Client and server
        –     my client: OS X
        –     my server: Fedora Core 6 on a VPS
   ●   Native components
        –     apache2, mysql5, ruby, rb-rubygems, rb-termios
   ●   Ruby gems
        –     rake, rails, termios, capistrano, mongrel,
              mongrel_cluster

   $ sudo gem install --include-dependencies [gem]


21 Feb 2007       Sydney RoR Meetup: quot;Getting Started with Capistranoquot;   Keith Pitty   4
Step 2: Set up Database

   mysql> create database app;

   mysql > grant all privileges on app.* to
     'app'@'localhost identified by 'password'
     with grant option;




21 Feb 2007   Sydney RoR Meetup: quot;Getting Started with Capistranoquot;   Keith Pitty   5
Step 3: Add Mongrel to Project

   ●   On development machine, this will create
       config/mongrel_cluster.yml:



    $ mongrel_rails cluster::configure
      -e production -p 8000 -a 127.0.0.1 -N -2
      /deploy/path/current




21 Feb 2007   Sydney RoR Meetup: quot;Getting Started with Capistranoquot;   Keith Pitty   6
Step 4: Apply Capistrano to Project

   ●   On development machine, this will create
       config/deploy.rb and
       lib/tasks/capistrano.rake:

    $ cap –apply-to /local/project/path [app]




21 Feb 2007   Sydney RoR Meetup: quot;Getting Started with Capistranoquot;   Keith Pitty   7
Step 5: Configure Capistrano (1)

   ●   Edit config/deploy.rb:
        –     Add as first statement:



    require 'mongrel_cluster/recipes'




21 Feb 2007       Sydney RoR Meetup: quot;Getting Started with Capistranoquot;   Keith Pitty   8
Step 5: Configure Capistrano (2)

   ●   Edit config/deploy.rb:
        –     Set variables:

    set :application, “app”
    set :repository,
      “http:svn.host.com/#{application}/trunk”
    set :deploy_to,
      “/usr/local/railsapps/#{application}”
    set :mongrel_conf,
      “#{current_path}/config/mongrel_cluster.yml”


21 Feb 2007       Sydney RoR Meetup: quot;Getting Started with Capistranoquot;   Keith Pitty   9
Step 5: Configure Capistrano (3)

   ●   Edit config/deploy.rb (continued):


    set       :web, “my.host.com”
    set       :app, “my.host.com”
    set       :db, “my.host.com”, :primary => true
    set       :user, “keith”




21 Feb 2007      Sydney RoR Meetup: quot;Getting Started with Capistranoquot;   Keith Pitty   10
Step 6: Set up Directories

   ●   On development machine, this will set up
       directories on target server:


              $ cap setup




21 Feb 2007      Sydney RoR Meetup: quot;Getting Started with Capistranoquot;   Keith Pitty   11
Step 7: Secure Database

   ●   Copy database.yml to
       #{shared_path}/config on server
   ●   Rename to database.yml.production and set
       production username and password
   ●   Add the following to :after_update_code task
       in config/deploy.rb:
 db_config =
   “#{shared_path}/config/database.yml.production”
 run “cp #{db_config}
   #{release_path}/config/database.yml”
21 Feb 2007   Sydney RoR Meetup: quot;Getting Started with Capistranoquot;   Keith Pitty   12
Step 8: Ensure Subversion is OK

   ●   Installed on client and server?
   ●   Repository created on server?
   ●   Apache configured for subversion?
   ●   svn import?
   ●   svn checkout?




21 Feb 2007   Sydney RoR Meetup: quot;Getting Started with Capistranoquot;   Keith Pitty   13
Step 9: Deploy and Verify

   ●   One more pre-req: edit sudoers file on server
   ●   Deploy app, create tables (from client):

       $ cap cold_deploy
       $ cap migrate

   ●   Verify (on server):

       $ curl -I http://127.0.0.1:8000


21 Feb 2007   Sydney RoR Meetup: quot;Getting Started with Capistranoquot;   Keith Pitty   14
Step 10: Configure Apache

   ●   Configure Apache to connect to Mongrel
        –     Proxy for mongrel_cluster
        –     VirtualHost with rewrite rules for app
        –     see AWDwR, Section 27.5, Step Five for details
   ●   Restart Apache
   ●   App should now work via browser!




21 Feb 2007       Sydney RoR Meetup: quot;Getting Started with Capistranoquot;   Keith Pitty   15
From now on it will be easy!

   ●   When you've checked in some changes:

       $ cap deploy



   ●   If you need to back out your changes:

       $ cap rollback



21 Feb 2007   Sydney RoR Meetup: quot;Getting Started with Capistranoquot;   Keith Pitty   16
Resources

   ●   “Agile Web Development with Rails”
        –     Second Edition, section 27.5
   ●   http://manuals.rubyonrails.com/read/book/17
        –     when it's available
   ●   http://rubyforge.org/projects/capistrano/
   ●   http://weblog.jamisbuck.org
   ●   capistrano@googlegroups.com
   ●   rubyonrails-deployment@googlegroups.com



21 Feb 2007       Sydney RoR Meetup: quot;Getting Started with Capistranoquot;   Keith Pitty   17
Thanks for listening!



                                 Keith Pitty

                           http://keithpitty.org
                           keith@keithpitty.org




21 Feb 2007   Sydney RoR Meetup: quot;Getting Started with Capistranoquot;   Keith Pitty   18

More Related Content

What's hot

What's hot (19)

MeaNstack on Docker
MeaNstack on DockerMeaNstack on Docker
MeaNstack on Docker
 
Front-end tools
Front-end toolsFront-end tools
Front-end tools
 
"Wix Serverless from inside", Mykola Borozdin
"Wix Serverless from inside", Mykola Borozdin"Wix Serverless from inside", Mykola Borozdin
"Wix Serverless from inside", Mykola Borozdin
 
Forget Grunt and Gulp! Webpack and NPM rule them all!
Forget Grunt and Gulp! Webpack and NPM rule them all!Forget Grunt and Gulp! Webpack and NPM rule them all!
Forget Grunt and Gulp! Webpack and NPM rule them all!
 
The First 10M Pulls: Building The Official Curl Image for Docker Hub
The First 10M Pulls: Building The Official Curl Image for Docker HubThe First 10M Pulls: Building The Official Curl Image for Docker Hub
The First 10M Pulls: Building The Official Curl Image for Docker Hub
 
簡單介紹git
簡單介紹git簡單介紹git
簡單介紹git
 
Хокку про Heroku
Хокку про HerokuХокку про Heroku
Хокку про Heroku
 
Mastering Grails 3 Plugins - G3 Summit 2016
Mastering Grails 3 Plugins - G3 Summit 2016Mastering Grails 3 Plugins - G3 Summit 2016
Mastering Grails 3 Plugins - G3 Summit 2016
 
Google App Engine with JSF 2.x
Google App Engine with JSF 2.xGoogle App Engine with JSF 2.x
Google App Engine with JSF 2.x
 
Using SaltStack to orchestrate microservices in application containers at Sal...
Using SaltStack to orchestrate microservices in application containers at Sal...Using SaltStack to orchestrate microservices in application containers at Sal...
Using SaltStack to orchestrate microservices in application containers at Sal...
 
Git - Get Ready To Use It
Git - Get Ready To Use ItGit - Get Ready To Use It
Git - Get Ready To Use It
 
JS Chicago Meetup 2/23/16 - Redux & Routes
JS Chicago Meetup 2/23/16 - Redux & RoutesJS Chicago Meetup 2/23/16 - Redux & Routes
JS Chicago Meetup 2/23/16 - Redux & Routes
 
Puppet Camp Paris 2015: Continuous Integration of Puppet Code (Intermediate)
Puppet Camp Paris 2015: Continuous Integration of Puppet Code (Intermediate) Puppet Camp Paris 2015: Continuous Integration of Puppet Code (Intermediate)
Puppet Camp Paris 2015: Continuous Integration of Puppet Code (Intermediate)
 
KubeCon 2017 Zero Touch Provision
KubeCon 2017 Zero Touch ProvisionKubeCon 2017 Zero Touch Provision
KubeCon 2017 Zero Touch Provision
 
Heroku 101 py con 2015 - David Gouldin
Heroku 101   py con 2015 - David GouldinHeroku 101   py con 2015 - David Gouldin
Heroku 101 py con 2015 - David Gouldin
 
Bower - A package manager for the web
Bower - A package manager for the webBower - A package manager for the web
Bower - A package manager for the web
 
Geb quick start
Geb quick startGeb quick start
Geb quick start
 
第1回名古屋Grails/Groogy勉強会「Grailsを始めてみよう!」
第1回名古屋Grails/Groogy勉強会「Grailsを始めてみよう!」第1回名古屋Grails/Groogy勉強会「Grailsを始めてみよう!」
第1回名古屋Grails/Groogy勉強会「Grailsを始めてみよう!」
 
Learnings from govuk
Learnings from govukLearnings from govuk
Learnings from govuk
 

Viewers also liked (6)

Capistrano
CapistranoCapistrano
Capistrano
 
Capistrano
CapistranoCapistrano
Capistrano
 
Photos
PhotosPhotos
Photos
 
Getting Started with Capistrano
Getting Started with CapistranoGetting Started with Capistrano
Getting Started with Capistrano
 
Capistrano, Puppet, and Chef
Capistrano, Puppet, and ChefCapistrano, Puppet, and Chef
Capistrano, Puppet, and Chef
 
Chef vs. Puppet in the Cloud: How Telepictures and MoneySuperMarket Do It
Chef vs. Puppet in the Cloud: How Telepictures and MoneySuperMarket Do ItChef vs. Puppet in the Cloud: How Telepictures and MoneySuperMarket Do It
Chef vs. Puppet in the Cloud: How Telepictures and MoneySuperMarket Do It
 

Similar to Getting Started with Capistrano in Ten Easy Steps

How to publish ASP.NET Core web application via Visual Studio 2019.pdf
How to publish ASP.NET Core web application via Visual Studio 2019.pdfHow to publish ASP.NET Core web application via Visual Studio 2019.pdf
How to publish ASP.NET Core web application via Visual Studio 2019.pdf
gerardov5
 
Хокку про Heroku
Хокку про HerokuХокку про Heroku
Хокку про Heroku
GeeksLab Odessa
 

Similar to Getting Started with Capistrano in Ten Easy Steps (20)

The Big Cloud native FaaS Lebowski
The Big Cloud native FaaS LebowskiThe Big Cloud native FaaS Lebowski
The Big Cloud native FaaS Lebowski
 
You got database in my cloud (short version)
You got database  in my cloud (short version)You got database  in my cloud (short version)
You got database in my cloud (short version)
 
[Hands-on] Kubernetes | Nov 18, 2017
[Hands-on] Kubernetes | Nov 18, 2017[Hands-on] Kubernetes | Nov 18, 2017
[Hands-on] Kubernetes | Nov 18, 2017
 
Scaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceScaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container Service
 
Installing Component Pack 6.0.0.6
Installing Component Pack 6.0.0.6Installing Component Pack 6.0.0.6
Installing Component Pack 6.0.0.6
 
An Express Guide ~ Cacti for IT Infrastructure Monitoring & Graphing
An Express Guide ~ Cacti for IT Infrastructure Monitoring & GraphingAn Express Guide ~ Cacti for IT Infrastructure Monitoring & Graphing
An Express Guide ~ Cacti for IT Infrastructure Monitoring & Graphing
 
Serverless - introduction et perspectives concrètes
Serverless - introduction et perspectives concrètesServerless - introduction et perspectives concrètes
Serverless - introduction et perspectives concrètes
 
How to publish ASP.NET Core web application via Visual Studio 2019.pdf
How to publish ASP.NET Core web application via Visual Studio 2019.pdfHow to publish ASP.NET Core web application via Visual Studio 2019.pdf
How to publish ASP.NET Core web application via Visual Studio 2019.pdf
 
Bdc from bare metal to k8s
Bdc   from bare metal to k8sBdc   from bare metal to k8s
Bdc from bare metal to k8s
 
Kubernetes Basic Operation
Kubernetes Basic OperationKubernetes Basic Operation
Kubernetes Basic Operation
 
Docker for Ruby Developers
Docker for Ruby DevelopersDocker for Ruby Developers
Docker for Ruby Developers
 
The Big Cloud Native FaaS Lebowski
The Big Cloud Native FaaS LebowskiThe Big Cloud Native FaaS Lebowski
The Big Cloud Native FaaS Lebowski
 
Deploying windows containers with kubernetes
Deploying windows containers with kubernetesDeploying windows containers with kubernetes
Deploying windows containers with kubernetes
 
Using rbenv in Production
Using rbenv in ProductionUsing rbenv in Production
Using rbenv in Production
 
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
 
Consegi 2010 - Dicas de Desenvolvimento Web com Ruby
Consegi 2010 - Dicas de Desenvolvimento Web com RubyConsegi 2010 - Dicas de Desenvolvimento Web com Ruby
Consegi 2010 - Dicas de Desenvolvimento Web com Ruby
 
Introduction to Vitess on Kubernetes for MySQL - Webinar
Introduction to Vitess on Kubernetes for MySQL -  WebinarIntroduction to Vitess on Kubernetes for MySQL -  Webinar
Introduction to Vitess on Kubernetes for MySQL - Webinar
 
Хокку про Heroku
Хокку про HerokuХокку про Heroku
Хокку про Heroku
 
Pragmatic sbt
Pragmatic sbtPragmatic sbt
Pragmatic sbt
 
Kubernetes on Bare Metal at the Kitchener-Waterloo Kubernetes and Cloud Nativ...
Kubernetes on Bare Metal at the Kitchener-Waterloo Kubernetes and Cloud Nativ...Kubernetes on Bare Metal at the Kitchener-Waterloo Kubernetes and Cloud Nativ...
Kubernetes on Bare Metal at the Kitchener-Waterloo Kubernetes and Cloud Nativ...
 

More from elliando dias

Why you should be excited about ClojureScript
Why you should be excited about ClojureScriptWhy you should be excited about ClojureScript
Why you should be excited about ClojureScript
elliando dias
 
Nomenclatura e peças de container
Nomenclatura  e peças de containerNomenclatura  e peças de container
Nomenclatura e peças de container
elliando dias
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agility
elliando dias
 
Javascript Libraries
Javascript LibrariesJavascript Libraries
Javascript Libraries
elliando dias
 
How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!
elliando dias
 
A Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the WebA Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the Web
elliando dias
 
Introdução ao Arduino
Introdução ao ArduinoIntrodução ao Arduino
Introdução ao Arduino
elliando dias
 
Incanter Data Sorcery
Incanter Data SorceryIncanter Data Sorcery
Incanter Data Sorcery
elliando dias
 
Fab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine DesignFab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine Design
elliando dias
 
Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.
elliando dias
 
Hadoop and Hive Development at Facebook
Hadoop and Hive Development at FacebookHadoop and Hive Development at Facebook
Hadoop and Hive Development at Facebook
elliando dias
 
Multi-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case StudyMulti-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case Study
elliando dias
 

More from elliando dias (20)

Clojurescript slides
Clojurescript slidesClojurescript slides
Clojurescript slides
 
Why you should be excited about ClojureScript
Why you should be excited about ClojureScriptWhy you should be excited about ClojureScript
Why you should be excited about ClojureScript
 
Functional Programming with Immutable Data Structures
Functional Programming with Immutable Data StructuresFunctional Programming with Immutable Data Structures
Functional Programming with Immutable Data Structures
 
Nomenclatura e peças de container
Nomenclatura  e peças de containerNomenclatura  e peças de container
Nomenclatura e peças de container
 
Geometria Projetiva
Geometria ProjetivaGeometria Projetiva
Geometria Projetiva
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agility
 
Javascript Libraries
Javascript LibrariesJavascript Libraries
Javascript Libraries
 
How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!
 
Ragel talk
Ragel talkRagel talk
Ragel talk
 
A Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the WebA Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the Web
 
Introdução ao Arduino
Introdução ao ArduinoIntrodução ao Arduino
Introdução ao Arduino
 
Minicurso arduino
Minicurso arduinoMinicurso arduino
Minicurso arduino
 
Incanter Data Sorcery
Incanter Data SorceryIncanter Data Sorcery
Incanter Data Sorcery
 
Rango
RangoRango
Rango
 
Fab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine DesignFab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine Design
 
The Digital Revolution: Machines that makes
The Digital Revolution: Machines that makesThe Digital Revolution: Machines that makes
The Digital Revolution: Machines that makes
 
Hadoop + Clojure
Hadoop + ClojureHadoop + Clojure
Hadoop + Clojure
 
Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.
 
Hadoop and Hive Development at Facebook
Hadoop and Hive Development at FacebookHadoop and Hive Development at Facebook
Hadoop and Hive Development at Facebook
 
Multi-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case StudyMulti-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case Study
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
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
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
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
 

Getting Started with Capistrano in Ten Easy Steps

  • 1. Getting Started with Capistrano in Ten Easy Steps Keith Pitty http://keithpitty.org keith@keithpitty.org
  • 2. What is Capistrano? ● A tool that aims to make it easy to deploy Rails applications! ● Written by Jamis Buck, one of the core Rails team 21 Feb 2007 Sydney RoR Meetup: quot;Getting Started with Capistranoquot; Keith Pitty 2
  • 3. These ten steps are based on my experience ● Starting point: – “Agile Web Development with Rails” – 2nd edition, Section 27.5 ● There may be better ways, but... ● The following steps worked for me 21 Feb 2007 Sydney RoR Meetup: quot;Getting Started with Capistranoquot; Keith Pitty 3
  • 4. Step 1: Install Software ● Client and server – my client: OS X – my server: Fedora Core 6 on a VPS ● Native components – apache2, mysql5, ruby, rb-rubygems, rb-termios ● Ruby gems – rake, rails, termios, capistrano, mongrel, mongrel_cluster $ sudo gem install --include-dependencies [gem] 21 Feb 2007 Sydney RoR Meetup: quot;Getting Started with Capistranoquot; Keith Pitty 4
  • 5. Step 2: Set up Database mysql> create database app; mysql > grant all privileges on app.* to 'app'@'localhost identified by 'password' with grant option; 21 Feb 2007 Sydney RoR Meetup: quot;Getting Started with Capistranoquot; Keith Pitty 5
  • 6. Step 3: Add Mongrel to Project ● On development machine, this will create config/mongrel_cluster.yml: $ mongrel_rails cluster::configure -e production -p 8000 -a 127.0.0.1 -N -2 /deploy/path/current 21 Feb 2007 Sydney RoR Meetup: quot;Getting Started with Capistranoquot; Keith Pitty 6
  • 7. Step 4: Apply Capistrano to Project ● On development machine, this will create config/deploy.rb and lib/tasks/capistrano.rake: $ cap –apply-to /local/project/path [app] 21 Feb 2007 Sydney RoR Meetup: quot;Getting Started with Capistranoquot; Keith Pitty 7
  • 8. Step 5: Configure Capistrano (1) ● Edit config/deploy.rb: – Add as first statement: require 'mongrel_cluster/recipes' 21 Feb 2007 Sydney RoR Meetup: quot;Getting Started with Capistranoquot; Keith Pitty 8
  • 9. Step 5: Configure Capistrano (2) ● Edit config/deploy.rb: – Set variables: set :application, “app” set :repository, “http:svn.host.com/#{application}/trunk” set :deploy_to, “/usr/local/railsapps/#{application}” set :mongrel_conf, “#{current_path}/config/mongrel_cluster.yml” 21 Feb 2007 Sydney RoR Meetup: quot;Getting Started with Capistranoquot; Keith Pitty 9
  • 10. Step 5: Configure Capistrano (3) ● Edit config/deploy.rb (continued): set :web, “my.host.com” set :app, “my.host.com” set :db, “my.host.com”, :primary => true set :user, “keith” 21 Feb 2007 Sydney RoR Meetup: quot;Getting Started with Capistranoquot; Keith Pitty 10
  • 11. Step 6: Set up Directories ● On development machine, this will set up directories on target server: $ cap setup 21 Feb 2007 Sydney RoR Meetup: quot;Getting Started with Capistranoquot; Keith Pitty 11
  • 12. Step 7: Secure Database ● Copy database.yml to #{shared_path}/config on server ● Rename to database.yml.production and set production username and password ● Add the following to :after_update_code task in config/deploy.rb: db_config = “#{shared_path}/config/database.yml.production” run “cp #{db_config} #{release_path}/config/database.yml” 21 Feb 2007 Sydney RoR Meetup: quot;Getting Started with Capistranoquot; Keith Pitty 12
  • 13. Step 8: Ensure Subversion is OK ● Installed on client and server? ● Repository created on server? ● Apache configured for subversion? ● svn import? ● svn checkout? 21 Feb 2007 Sydney RoR Meetup: quot;Getting Started with Capistranoquot; Keith Pitty 13
  • 14. Step 9: Deploy and Verify ● One more pre-req: edit sudoers file on server ● Deploy app, create tables (from client): $ cap cold_deploy $ cap migrate ● Verify (on server): $ curl -I http://127.0.0.1:8000 21 Feb 2007 Sydney RoR Meetup: quot;Getting Started with Capistranoquot; Keith Pitty 14
  • 15. Step 10: Configure Apache ● Configure Apache to connect to Mongrel – Proxy for mongrel_cluster – VirtualHost with rewrite rules for app – see AWDwR, Section 27.5, Step Five for details ● Restart Apache ● App should now work via browser! 21 Feb 2007 Sydney RoR Meetup: quot;Getting Started with Capistranoquot; Keith Pitty 15
  • 16. From now on it will be easy! ● When you've checked in some changes: $ cap deploy ● If you need to back out your changes: $ cap rollback 21 Feb 2007 Sydney RoR Meetup: quot;Getting Started with Capistranoquot; Keith Pitty 16
  • 17. Resources ● “Agile Web Development with Rails” – Second Edition, section 27.5 ● http://manuals.rubyonrails.com/read/book/17 – when it's available ● http://rubyforge.org/projects/capistrano/ ● http://weblog.jamisbuck.org ● capistrano@googlegroups.com ● rubyonrails-deployment@googlegroups.com 21 Feb 2007 Sydney RoR Meetup: quot;Getting Started with Capistranoquot; Keith Pitty 17
  • 18. Thanks for listening! Keith Pitty http://keithpitty.org keith@keithpitty.org 21 Feb 2007 Sydney RoR Meetup: quot;Getting Started with Capistranoquot; Keith Pitty 18