Deploy Drupal With Capistrano

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    5 Favorites

    Deploy Drupal With Capistrano - Presentation Transcript

    1. Deploy Drupal with Capistrano and live to tell
    2. “A life without philosophy Capistrano is  not worth living”  --Socrates
    3. The plan • Throw away what we don’t need • Keep it simple • ??? • Profit!
    4. Standard stuff “non ragioniam di lor, ma guarda e passa” 



1
load
'deploy'
if
respond_to?(:namespace)
#
cap2
differentiator 



2
 



3
#
You
should
probably
configure
these 



4
set
:user,
\"drupal\" 



5
set
:password,
\"supersecret\" 



6
set
:application,
\"my.application.name\" 



7
 



8
#
The
default
should
be
ok 



9
set
:deploy_to,
\"/var/apps/#{application}\" 


10
 


11
#
SCM
Stuff
configure
to
taste,
just
remember
the
repository 


12
set
:repository,

\"git@github.com:intinig/app.git\" 


13
set
:scm,
:git 


14
set
:branch,
\"master\" 


15
set
:repository_cache,
\"git_master\" 


16
set
:deploy_via,
:remote_cache 


17
set
:scm_verbose,
true 


18
 


19
#
Single
server
setup 


20
role
:web,
\"danton.mikamai.com:8888\",
:primary
=>
true
    5. Callbacks The Juice 


22
#
Callbacks 


23
after
'deploy:setup',
'drupal:setup' 


24
after
'deploy:symlink',
'drupal:symlink' 


25
before
'deploy:start',
'drupal:db:import:production' 


26
 


27
before
'deploy:restart',
'mikamai:permissions:fix' 


28
before
'deploy:restart',
'mikamai:production:symlink',
'drupal:configure:production' 


29
before
'deploy:start',
'mikamai:permissions:fix' 


30
before
'deploy:start',
'mikamai:production:symlink',
'drupal:configure:production' 


31
before
'deploy:cold',
'drupal:db:dump:development'
    6. Overriding Who’s your daddy? 


85
namespace
:deploy
do 


86


task
:finalize_update,
:except
=>
{
:no_release
=>
true
}
do 


87




sudo
\"chmod
‐R
g+w
#{latest_release}\"
if
fetch(:group_writable,
 true) 


88


end 


89


 


90


task
:cold
do 


91




update 


92




start 


93


end 


94


 


95


task
:restart
do 


96


end 


97


 


98


task
:start
do 


99


end 

100
end
    7. The (long) Drupal namespace 


48
namespace
:drupal
do 


49


task
:setup,
:except
=>
{
:no_release
=>
true
}
do 


50




sudo
\"mkdir
‐p
#{shared_path}/files\" 


51




sudo
\"chown
‐R
#{user}:#{user}
#{deploy_to}\" 


52


end 


53


 


54


task
:symlink,
:except
=>
{
:no_release
=>
true
}
do 


55




sudo
\"ln
‐s
#{shared_path}/files
#{latest_release}\" 


56


end 


57


 


58


namespace
:configure
do 


59




task
:production
do 


60






sudo
\"cd
#{latest_release}/sites/default;
cp
settings.production.php
settings.php\" 


61




end 


62




 


63




task
:development
do 


64






sudo
\"cd
#{latest_release}/sites/default;
cp
settings.development.php
settings.php\" 


65




end 


66


end
    8. Still the (long) Drupal namespace 


68


namespace
:db
do 


69




namespace
:dump
do 


70






task
:development
do 


71








raise
RuntimeError.new(\"failed
dump\")
unless
system
... 


72






end 


73




end 


74




 


75




namespace
:import
do 


76






task
:production
do 


77








ENV[\"FILES\"]
=
\"dump.sql\" 


78








deploy::upload 


79








run
\"mysql
‐u
#{db_user}
‐‐password=#{db_password}
...\" 


80






end 


81




end 


82


end 


83
end
    9. Last, but not least...
    10. How we do it in Mikamai 

102
namespace
:mikamai
do 

103


 

104


namespace
:production
do 

105




task
:symlink,
:except
=>
{
:no_release
=>
true
}
do 

106






sudo
\"rm
‐rf
/var/www/#{application}\" 

107






sudo
\"ln
‐s
#{latest_release}
/var/www/#{application}\" 

108




end 

109


end 

110


 

111


namespace
:permissions
do 

112




task
:fix,
:except
=>
{
:no_release
=>
true
}
do 

113






sudo
\"chown
‐R
www‐data:www‐data
#{latest_release}\" 

114




end 

115


end 

116


 

117
end
    11. Questions? Giovanni Intini <giovanni@mikamai.com>

    + intinigintinig, 2 years ago

    custom

    1416 views, 5 favs, 1 embeds more stats

    Slow-lightning-talk slides for the Ruby Social Club more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 1416
      • 1347 on SlideShare
      • 69 from embeds
    • Comments 0
    • Favorites 5
    • Downloads 21
    Most viewed embeds
    • 69 views on http://blog.mikamai.com

    more

    All embeds
    • 69 views on http://blog.mikamai.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories