Slide 1

Slide 1 text

© 2013 [email protected] Capistrano

Slide 2

Slide 2 text

Stefan Husch

Slide 3

Slide 3 text

‣ Inhaber ‚qutic development‘ : Beratung, Entwicklung und Hosting ‣ Software-Entwicklung seit 1983 ‣ Start mit Basic und Assembler auf dem C64 ‣ Seit 1993 MacOS, ab 2000 MacOS X: C, Objective-C ‣ Web-Entwicklung mit Ruby (On Rails) seit Ende 2005

Slide 4

Slide 4 text

Introducing SwitchTower Posted by Jamis Buck on August 05, 2005 @ 05:43 PM

Slide 5

Slide 5 text

SwitchTower: Renamed Posted by Jamis Buck on March 05, 2006 @ 05:49 PM

Slide 6

Slide 6 text

Capistrano

Slide 7

Slide 7 text

Application Deployment Tool

Slide 8

Slide 8 text

geschrieben in Ruby

Slide 9

Slide 9 text

mit einer einfachen DSL für die Konfiguration

Slide 10

Slide 10 text

zur Ausführung auf der Kommandozeile

Slide 11

Slide 11 text

cap deploy

Slide 12

Slide 12 text

... und Capistrano macht das Heavy Lifting :-)

Slide 13

Slide 13 text

‣ Applikation aus scm auschecken und auf Server kopieren ‣ Wartungsseite schalten ‣ Hintergrund-Prozesse beenden ‣ fehlende Bibliotheken nachinstallieren ‣ Datenbank migrieren ‣ Ordner in Projekt hineinlinken (files, logs, etc) ‣ Hintergrund-Prozesse wieder starten ‣ Memcache-Instanz zurücksetzen (flush_all) ‣ Sphinx-Datenbank indizieren und Prozess neu starten ‣ Applikation neu starten ‣ Wartungsseite entfernen ‣ Alte Deployments entfernen

Slide 14

Slide 14 text

Einfache Installation

Slide 15

Slide 15 text

nur auf dem Deployment-Rechner!

Slide 16

Slide 16 text

gem install capistrano cd /mein/projekt capify . nano config/deploy.rb

Slide 17

Slide 17 text

set :location, "radiantmagic.com" set :user, "radiantic" set :port, 10900 set :use_sudo, false set :application, "radiantic" set :scm, :git set :repository, "git@mein-git-srv:radiantic.git" set :branch, "master" set :deploy_via, :rsync_with_remote_cache set :deploy_to, "/export/home/#{user}/www/#{application}"

Slide 18

Slide 18 text

Ausführung über SSH

Slide 19

Slide 19 text

mit Ruby >= 1.9 auch parallel

Slide 20

Slide 20 text

Und wenn etwas schief geht?

Slide 21

Slide 21 text

cap deploy:rollback

Slide 22

Slide 22 text

Spezielle Ordner-Struktur

Slide 23

Slide 23 text

radiantic current -> releases/20130609164855 releases 20130608155124 20130609164855 shared config database.yml log production.log sphinx files

Slide 24

Slide 24 text

desc "Migrate database" task :migrate, :roles => :db do run "cd '#{current_path}' && /rake db:migrate" end desc "Delete cache" task :cache_clear, :roles => :worker do delete "#{shared_path}/tmp/cache", :recursive => true end desc "Restart application" task :restart, :roles => :app do run "touch '#{current_path}/tmp/restart.txt'" end desc "Restart Webserver" task :restart_webserver, :roles => : app do sudo "/etc/init.d/apache2 restart" end

Slide 25

Slide 25 text

Namespaces

Slide 26

Slide 26 text

namespace :dj do desc "Start delayed_job backgound worker" task :start, :roles => :worker do run "'#{current_path}/script/delayed_job' start -n 4" end desc "Stop delayed_job backgound worker" task :stop, :roles => :worker do run "'#{current_path}/script/delayed_job' stop" end desc "Restart delayed_job backgound worker" task :restart, :roles => :worker do stop start end end

Slide 27

Slide 27 text

Callbacks

Slide 28

Slide 28 text

before "deploy:update_code", "deploy:dj:stop" before "deploy:restart", "deploy:bundle" after "deploy:bundle", "deploy:migrate" after "deploy:migrate", "deploy:cache_clear"

Slide 29

Slide 29 text

Rollen

Slide 30

Slide 30 text

role :app, "web1.example.com", "web2.example.com" role :web, "web1.example.com", "web2.example.com" role :db, "web1.example.com", :primary => true role :worker, "web2.example.com"

Slide 31

Slide 31 text

Multistage

Slide 32

Slide 32 text

Erweiterbar

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

GUI

Slide 35

Slide 35 text

Webistrano

Slide 36

Slide 36 text

a Web UI for managing Capistrano deployment

Slide 37

Slide 37 text

Harrow.io

Slide 38

Slide 38 text

SaaS für Deployment?

Slide 39

Slide 39 text

there is one more thing...

Slide 40

Slide 40 text

cap shell

Slide 41

Slide 41 text

Orchestration

Slide 42

Slide 42 text

task "puppet:stop" task "puppet:start" task "puppet:restart" task "zone:stop" task "zone:start" task "zone:restart" task "db:switch_master" task "db:switch_proxy"

Slide 43

Slide 43 text

?

Slide 44

Slide 44 text

Quellen ‣ https://github.com/capistrano/capistrano ‣ http://de.wikipedia.org/wiki/Capistrano_(Software) ‣ http://www.capistranorb.com ‣ http://weblog.jamisbuck.org/2005/8/5/introducing-switchtower ‣ http://weblog.jamisbuck.org/2006/3/6/switchtower-renamed ‣ https://github.com/peritor/webistrano ‣ https://www.harrow.io ‣ http://stackoverflow.com/questions/tagged/capistrano