capistrano - automate all the things

23
CAPISTRANO automate all the things

Upload: john-cleary

Post on 09-Aug-2015

255 views

Category:

Software


1 download

TRANSCRIPT

CAPISTRANOautomate all the things

@THEREALBIFTER

John Cleary

Lead Developer at IntelliCentrics UK

x years PHP (where x > 10)

y years Ruby (where y < 2)

CONFIGURED FOR DEPLOYMENT OUT OF THE BOX

PLAYS NICE WITH MULTIPLE SERVERS

UNDERSTANDS THAT DIFFERENT BOXES DO DIFFERENT THINGS (ROLES)

NOT JUST FOR DEPLOYMENT

STAGES, ROLES & TASKS

Stages are the environments (can be multiple servers)

Roles are the jobs servers have, i.e. “I’m a database” == :db

Tasks are actions that we can perform on a server, e.g. deploy or restart apache (see cap -T)

GET CAPISTRANO

Ruby >= 1.9.3

gem install bundler

https://github.com/capistrano/capistrano

CAPIFY A PHP PROJECT

CAP FILES

DEPLOY.RB

EDIT A STAGE FILE

CONFIG THE SERVER(S)

create a deploy user

add them to the sudoers

ssh keys (add your key, add ssh key to git)

create the folder (/var/www/whatever)

LET’S DEPLOY

start with bundle exec cap staging deploy:check

bundle exec cap staging deploy

…LOOKS LIKE THIS

MIGRATING TO CAPISTRANO

setup capistrano in a different folder

diff the folders

symlink the folder or edit apache/nginx config aka the ol’ switcheroo

SOME USEFUL TASKS

capistrano/drupal-deploy

capistrano/composer

capistrano/laravel

hipchat/hipchat-rb

seuros/capistrano-newrelic

WRITE YOUR OWN TASKS

AND FINALLY

linked_files and linked_dirs (for db passwords)

branch (ask or set)

hooks

works with svn too

THANKS :)