26
CAPISTRANO fo non-Rubyi

Capistrano for non-rubyist

Embed Size (px)

Citation preview

Page 1: Capistrano for non-rubyist

CAPISTRANOfor non-Rubyists

Page 2: Capistrano for non-rubyist

who we are

Dimitris Tsironis

Dr. John Pagonis

Dr. John Pagonis is onto something with Missum these days. You can follow him at @JohnPagonis and @MissumApp

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

Page 3: Capistrano for non-rubyist

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.

Page 4: Capistrano for non-rubyist

one-click deploys!(well, almost)

Page 5: Capistrano for non-rubyist

is a language agnostic tool for remote application administration tasks

heavily used by Rails community

it’s for sysadmins and devops guys

it fits well with deploying web-apps

provisioning of infrastructure better handled with other tools, eg. Chef, Puppet, Babushka

Page 6: Capistrano for non-rubyist

how it worksunder the bo$et

Page 7: Capistrano for non-rubyist

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

Page 8: Capistrano for non-rubyist

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 adhoccommands

cap shell sessions are cached and can be reused

Page 9: Capistrano for non-rubyist

built-in tasks

It ships with plenty of stuff, by default

Page 10: Capistrano for non-rubyist

ready-to-use recipes

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

Ruby setup & RubyGems management

Apache & Phusion Passenger

Aptitude management

MongoDB

and much more!

Page 11: Capistrano for non-rubyist

custom tasks

Tailor-made Capistrano tasks are easy.

It’s all Ruby and Rake-like tasks, after all.

Page 12: Capistrano for non-rubyist

how to set it upprepare for the ba%le

Page 13: Capistrano for non-rubyist

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>

Page 14: Capistrano for non-rubyist

rails-less deploy example

Page 15: Capistrano for non-rubyist

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

Page 16: Capistrano for non-rubyist

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

Page 17: Capistrano for non-rubyist

production or staging

config/deploy/production.rb

config/deploy/staging.rb

Page 18: Capistrano for non-rubyist

roles

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

then you can do something like this

Page 19: Capistrano for non-rubyist

configuration example

config/deploy.rb

Page 20: Capistrano for non-rubyist

custom tasks example

config/deploy.rb

Page 21: Capistrano for non-rubyist

RAILS-specific magictasks for Ruby on Rails only

Page 22: Capistrano for non-rubyist

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

Page 23: Capistrano for non-rubyist

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

Page 25: Capistrano for non-rubyist

RESOURCES

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

Capistrano Wikihttps://github.com/capistrano/capistrano/wiki

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

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

Capistrano Google Grouphttp://groups.google.com/group/capistrano

Page 26: Capistrano for non-rubyist

thank you!@JohnPagonis

@tsironakos@geemboHQ