CAPISTRANO
 for non-Rubyists
who we are


   Dimitris Tsironis
    Founder at Geembo, UI designer & huge geek, who
    loves good design and french fries, as much as good
    indentation in a stylesheet. Follow him @tsironakos
    and @geemboHQ

   Dr. John Pagonis
    Dr. John Pagonis is onto something with Missum
    these days. You can follow him at @JohnPagonis
    and @MissumApp
WHAT’S THE PROBLEM?



       deploys can be a real mess

       mistakes could happen very easily
       you don’t mess with the production
       you’re actually delaying bug fixes, new features etc.
one-click deploys!
     (well, almost)
is a language agnostic tool for remote application
administration tasks
provisioning of infrastructure better handled
with other tools, eg. Chef, Puppet, Babushka
it fits well with deploying web-apps
heavily used by Rails community
it’s for sysadmins and devops guys
how it works
 under the bonnet
philosophy



       it runs on your computer

       connects to the server over ssh

       there is no Capistrano server or sth like that

       automates the tasks you would manually do
       with command-line
philosophy part ii



       uses a Ruby-based DSL for task automation

       there are already ready-to-use tasks
       cap shell offers an interactive prompt for adhoc
       commands
       cap shell sessions are cached and can be reused
built-in tasks


   It ships with plenty of stuff, by default
ready-to-use recipes

                  You can find plenty on Github
              https://github.com/nesquena/cap-recipes


           Ruby setup & RubyGems management

           Apache & Phusion Passenger
           Aptitude management
           MongoDB
           and much more!
custom tasks


  Tailor-made Capistrano tasks are easy.

  It’s all Ruby and Rake-like tasks, after all.
how to set it up
 prepare for the battle
set it up



            you need a Capfile in the root of the project

            then, you can execute capistrano tasks anywhere in
            your project’s folder, by running:

                        cap <task name>
rails-less deploy example
capify




         Capify is a file generator for your project

         usually used with Rails project but it works with other projects

         in general, it can be enhanced to work with other structures
capify

 One command to generate the files




 Files you need
         Capfile - basic Capistrano file in root of the project

         config/deploy.rb - here’s where you write custom tasks
production or staging


    config/deploy/production.rb




    config/deploy/staging.rb
roles



        allow you to write capistrano tasks that only apply to
        certain servers

        then you can do something like this
configuration example


    config/deploy.rb
custom tasks example

  config/deploy.rb
RAILS-specific magic
 tasks for Ruby on Rails only
asset precompile




                              PROBLEM
                   Asset precompile can be slow.

                   It could take several minutes that
                     we could use to make a coffee
                        or watch some cats gifs
asset precompile




                            solution

              Skip precompile, if it isn’t necessary

                     “The ability to destroy
                    a planet is insignificant
                    next to the power of Git”

                    --a tech-savvy Darth Vader
rails-specific magic

   config/deploy.rb




Source: StackOverflow of course!
RESOURCES


       Deploying with Capistrano - Github Help
       https://help.github.com/articles/deploying-with-capistrano

       Capistrano Wiki
       https://github.com/capistrano/capistrano/wiki

       Capistrano Multistage extension
       https://github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension

       Capistrano Handbook - still immature
       https://github.com/leehambley/capistrano-handbook/blob/master/
       index.markdown

       Capistrano Google Group
       http://groups.google.com/group/capistrano
thank you!
@JohnPagonis
 @tsironakos
@geemboHQ

Capistrano for non-rubyist

  • 1.
  • 2.
    who we are Dimitris Tsironis Founder at Geembo, UI designer & huge geek, who loves good design and french fries, as much as good indentation in a stylesheet. Follow him @tsironakos and @geemboHQ Dr. John Pagonis Dr. John Pagonis is onto something with Missum these days. You can follow him at @JohnPagonis and @MissumApp
  • 3.
    WHAT’S THE PROBLEM? deploys can be a real mess mistakes could happen very easily you don’t mess with the production you’re actually delaying bug fixes, new features etc.
  • 4.
    one-click deploys! (well, almost)
  • 5.
    is a languageagnostic tool for remote application administration tasks provisioning of infrastructure better handled with other tools, eg. Chef, Puppet, Babushka it fits well with deploying web-apps heavily used by Rails community it’s for sysadmins and devops guys
  • 6.
    how it works under the bonnet
  • 7.
    philosophy it runs on your computer connects to the server over ssh there is no Capistrano server or sth like that automates the tasks you would manually do with command-line
  • 8.
    philosophy part ii uses a Ruby-based DSL for task automation there are already ready-to-use tasks cap shell offers an interactive prompt for adhoc commands cap shell sessions are cached and can be reused
  • 9.
    built-in tasks It ships with plenty of stuff, by default
  • 10.
    ready-to-use recipes You can find plenty on Github https://github.com/nesquena/cap-recipes Ruby setup & RubyGems management Apache & Phusion Passenger Aptitude management MongoDB and much more!
  • 11.
    custom tasks Tailor-made Capistrano tasks are easy. It’s all Ruby and Rake-like tasks, after all.
  • 12.
    how to setit up prepare for the battle
  • 13.
    set it up you need a Capfile in the root of the project then, you can execute capistrano tasks anywhere in your project’s folder, by running: cap <task name>
  • 14.
  • 15.
    capify Capify is a file generator for your project usually used with Rails project but it works with other projects in general, it can be enhanced to work with other structures
  • 16.
    capify One commandto generate the files Files you need Capfile - basic Capistrano file in root of the project config/deploy.rb - here’s where you write custom tasks
  • 17.
    production or staging config/deploy/production.rb config/deploy/staging.rb
  • 18.
    roles allow you to write capistrano tasks that only apply to certain servers then you can do something like this
  • 19.
    configuration example config/deploy.rb
  • 20.
    custom tasks example config/deploy.rb
  • 21.
    RAILS-specific magic tasksfor Ruby on Rails only
  • 22.
    asset precompile PROBLEM Asset precompile can be slow. It could take several minutes that we could use to make a coffee or watch some cats gifs
  • 23.
    asset precompile solution Skip precompile, if it isn’t necessary “The ability to destroy a planet is insignificant next to the power of Git” --a tech-savvy Darth Vader
  • 24.
    rails-specific magic config/deploy.rb Source: StackOverflow of course!
  • 25.
    RESOURCES Deploying with Capistrano - Github Help https://help.github.com/articles/deploying-with-capistrano Capistrano Wiki https://github.com/capistrano/capistrano/wiki Capistrano Multistage extension https://github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension Capistrano Handbook - still immature https://github.com/leehambley/capistrano-handbook/blob/master/ index.markdown Capistrano Google Group http://groups.google.com/group/capistrano
  • 26.