Slide 1

Slide 1 text

CAPISTRANO fo non-Rubyist

Slide 2

Slide 2 text

who we are Dimitris Tsironis Dr. John Pagonis Dr. John Pa onis is onto somethin with Missum these days. You can follow him at @JohnPa onis and @MissumApp Founder at Geembo, UI desi ner & hu e eek, who loves ood desi n and french fries, as much as ood indentation in a stylesheet. Follow him @tsironakos and @ eemboHQ

Slide 3

Slide 3 text

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 delayin bu fixes, new features etc.

Slide 4

Slide 4 text

one-click deploys! (well, almost)

Slide 5

Slide 5 text

is a lan ua e agnostic tool for remote application administration tasks heavily used by Rails community it’s for sysadmins and devops uys it fits well with deployin web-apps provisionin of infrastructure better handled with other tools, e . Chef, Puppet, Babushka

Slide 6

Slide 6 text

how it works unde the bo et

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

built-in tasks It ships with plenty of stuff, by default

Slide 10

Slide 10 text

ready-to-use recipes You can find plenty on Github https://github.com/nesquena/cap-recipes Ruby setup & RubyGems mana ement Apache & Phusion Passen er Aptitude mana ement Mon oDB and much more!

Slide 11

Slide 11 text

custom tasks Tailor-made Capistrano tasks are easy. It’s all Ruby and Rake-like tasks, after all.

Slide 12

Slide 12 text

how to set it up prepare fo the ba le

Slide 13

Slide 13 text

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 runnin : cap

Slide 14

Slide 14 text

rails-less deploy example

Slide 15

Slide 15 text

capify Capify is a file enerator for your project usually used with Rails project but it works with other projects in eneral, it can be enhanced to work with other structures

Slide 16

Slide 16 text

capify One command to enerate the files Files you need Capfile - basic Capistrano file in root of the project config/deploy.rb - here’s where you write custom tasks

Slide 17

Slide 17 text

production or staging confi /deploy/production.rb confi /deploy/sta in .rb

Slide 18

Slide 18 text

roles allow you to write capistrano tasks that only apply to certain servers then you can do somethin like this

Slide 19

Slide 19 text

configuration example confi /deploy.rb

Slide 20

Slide 20 text

custom tasks example confi /deploy.rb

Slide 21

Slide 21 text

RAILS-specific magic task fo Ruby on Rail only

Slide 22

Slide 22 text

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 ifs

Slide 23

Slide 23 text

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

Slide 24

Slide 24 text

rails-specific magic confi /deploy.rb Source: StackOverflow of course!

Slide 25

Slide 25 text

RESOURCES Deployin with Capistrano - Github Help https://help. ithub.com/articles/deployin -with-capistrano Capistrano Wiki https:// ithub.com/capistrano/capistrano/wiki Capistrano Multista e extension https:// ithub.com/capistrano/capistrano/wiki/2.x-Multista e-Extension Capistrano Handbook - still immature https:// ithub.com/leehambley/capistrano-handbook/blob/master/ index.markdown Capistrano Goo le Group http:// roups. oo le.com/ roup/capistrano

Slide 26

Slide 26 text

thank you! @JohnPa onis @tsironakos @ eemboHQ