SECURE YOURDEPLOYMENTWITH CAPISTRANO                Arnaud Lafon - Freelancecontact@arnaudlafon.com - @arnaudlafon
COD
COD   BUG      FIX
COD    BUG       FIX      COMMIT
COD         BUG            FIXTESTOUR CODE   COMMIT
COD             BUGTEST CODE FROMSOMEONE ELSE                 FIX   TEST   OUR CODE   COMMIT
COD             BUGTEST CODE FROMSOMEONE ELSE                 FIX   TEST   OUR CODE   COMMITLAST MINUTEPATCHES
COD             BUGTEST CODE FROMSOMEONE ELSE                 FIX   TEST   OUR CODE   COMMITLAST MINUTEPATCHES
THATSIMPLE ?
NOT REALLY ....
What DEPLOYMENTmeans ?
What DEPLOYMENTmeans ?   IT HAS TO BE
What DEPLOYMENTmeans ?                  as FAST as possible   IT HAS TO BE
What DEPLOYMENTmeans ?                as FAST as possible   IT HAS TO BE RELIABLE
What DEPLOYMENTmeans ?                as FAST as possible   IT HAS TO BE RELIABLE                STABLE
What DEPLOYMENTmeans ?                as FAST as possible   IT HAS TO BE RELIABLE                STABLEIT MUST
What DEPLOYMENTmeans ?                as FAST as possible   IT HAS TO BE RELIABLE                STABLE          provide R...
What DEPLOYMENTmeans ?                as FAST as possible   IT HAS TO BE RELIABLE                STABLE        provide ROL...
What DEPLOYMENTmeans ?                as FAST as possible   IT HAS TO BE RELIABLE                STABLE        provide ROL...
What DEPLOYMENTmeans ?                as FAST as possible   IT HAS TO BE RELIABLE                STABLE        provide ROL...
What DEPLOYMENTmeans ?                as FAST as possible   IT HAS TO BE RELIABLE                STABLE        provide ROL...
DEPLOYMENT PROCESS - example
DEPLOYMENT PROCESS - examplePre-deploymentoperations
DEPLOYMENT PROCESS - examplePre-deployment   REPLACE THIS WITH YOURoperations       OWN PROCESSES                 USERS TE...
DEPLOYMENT PROCESS - examplePre-deployment   REPLACE THIS WITH YOURoperations       OWN PROCESSES                 USERS TE...
DEPLOYMENT PROCESS - examplePre-deployment   REPLACE THIS WITH YOURoperations       OWN PROCESSES                 USERS TE...
DEPLOYMENT PROCESS - examplePre-deployment       REPLACE THIS WITH YOURoperations           OWN PROCESSES                 ...
DEPLOYMENT PROCESS - examplePre-deployment       REPLACE THIS WITH YOURoperations           OWN PROCESSES                 ...
CAPISTRANOconcepts & key featureshttps://github.com/capistrano/capistrano
CAPISTRAwhat ?
CAPISTRAwhat ?      CAPISTRANO
CAPISTRAwhat ?                  IS JUST A BUNCH OF                  SCRIPTS                 IS WRITTEN IN RUBY FOR      CA...
CAPISTRAwhat ?                  IS JUST A BUNCH OF                  SCRIPTS                 IS WRITTEN IN RUBY FOR      CA...
CAPISTRAwhat ?                  IS JUST A BUNCH OF                  SCRIPTS                 IS WRITTEN IN RUBY FOR      CA...
CAPISTRAwhat ?                  IS JUST A BUNCH OF                  SCRIPTS                 IS WRITTEN IN RUBY FOR      CA...
CAPISTRAwhat ?                       IS JUST A BUNCH OF                       SCRIPTS                 IS WRITTEN IN RUBY F...
CAPISTRAwhat ?                       IS JUST A BUNCH OF                       SCRIPTS                 IS WRITTEN IN RUBY F...
deploy:defaultBASED ON    deploy:updateTASKS                deploy:update_code                deploy:finalize_code  setup  ...
deploy:default   BASED ON    deploy:update   TASKS                   deploy:update_code                   deploy:finalize_c...
deploy:default   BASED ON            deploy:update   TASKS                               deploy:update_code               ...
deploy:default   BASED ON            deploy:update   TASKS                               deploy:update_code               ...
deploy:default   BASED ON            deploy:update   TASKS                               deploy:update_code               ...
BASIC SETUP
BASIC SETUP   Requirements
BASIC SETUP   Requirements    RubyGems >= 1.3.x    if needed => $ apt-get install rubygems    $ gem instal capistrano
BASIC SETUP   Requirements    RubyGems >= 1.3.x    if needed => $ apt-get install rubygems    $ gem instal capistrano   Ca...
config/deploy.rb set :application, "myapp" set :repository, "username@github.com:myapp.git" set :deploy_to, "/var/www/#{ap...
DEAL WITH MULTISTAGE
DEAL WITH MULTISTAGE    $ gem install capistrano-ext
DEAL WITH MULTISTAGE     $ gem install capistrano-ext    config/deploy.rb
DEAL WITH MULTISTAGE     $ gem install capistrano-ext    config/deploy.rb     require capistrano/ext/multistage     set :s...
DEAL WITH MULTISTAGE     $ gem install capistrano-ext    config/deploy.rb     require capistrano/ext/multistage     set :s...
DEAL WITH MULTISTAGE     $ gem install capistrano-ext    config/deploy.rb     require capistrano/ext/multistage     set :s...
DEAL WITH MULTISTAGE     $ gem install capistrano-ext    config/deploy.rb     require capistrano/ext/multistage     set :s...
DEAL WITH MULTISTAGE     $ gem install capistrano-ext    config/deploy.rb     require capistrano/ext/multistage     set :s...
DEAL WITH MULTISTAGE     $ gem install capistrano-ext    config/deploy.rb     require capistrano/ext/multistage     set :s...
DEAL WITH MULTISTAGE      $ gem install capistrano-ext    config/deploy.rb      require capistrano/ext/multistage      set...
ONEnable
CapONEnableCapistrano
AlCapON     EnableCapistrano       For eZ Publishhttp://alafon.github.com/alcapon/
eZ Publish ♥ Capistrano
eZ Publish ♥ CapistranoCapezit
eZ Publish ♥ CapistranoCapezit $ gem install alcapon $ capezit . [add] writing ./extension/alcapon/config/ezpublish.rb [ad...
eZ Publish ♥ CapistranoCapezit $ gem install alcapon $ capezit . [add] writing ./extension/alcapon/config/ezpublish.rb [ad...
eZ Publish ♥ CapistranoCapezit $ gem install alcapon $ capezit . [add] writing ./extension/alcapon/config/ezpublish.rb [ad...
eZ Publish ♥ CapistranoCapezit $ gem install alcapon $ capezit . [add] writing ./extension/alcapon/config/ezpublish.rb [ad...
eZ Publish ♥ CapistranoCapezit $ gem install alcapon $ capezit . [add] writing ./extension/alcapon/config/ezpublish.rb [ad...
eZ Publish ♥ CapistranoCapezit $ gem install alcapon $ capezit . [add] writing ./extension/alcapon/config/ezpublish.rb [ad...
eZ Publish ♥ CapistranoCapezit $ gem install alcapon $ capezit . [add] writing ./extension/alcapon/config/ezpublish.rb [ad...
eZ Publish ♥ CapistranoCapezit $ gem install alcapon $ capezit . [add] writing ./extension/alcapon/config/ezpublish.rb [ad...
eZ Publish ♥ CapistranoCapezit $ gem install alcapon $ capezit . [add] writing ./extension/alcapon/config/ezpublish.rb [ad...
eZ Publish ♥ CapistranoCapezit $ gem install alcapon $ capezit . [add] writing ./extension/alcapon/config/ezpublish.rb [ad...
eZ Publish ♥ CapistranoCapezit $ gem install alcapon $ capezit . [add] writing ./extension/alcapon/config/ezpublish.rb [ad...
eZ Publish ♥ CapistranoCapezit $ gem install alcapon $ capezit . [add] writing ./extension/alcapon/config/ezpublish.rb [ad...
eZ Publish ♥ CapistranoCapezit $ gem install alcapon $ capezit . [add] writing ./extension/alcapon/config/ezpublish.rb [ad...
OTHER COOL FEATURES
OTHER COOL FEATURESsystem check (ezpublish.rb)
OTHER COOL FEATURESsystem check (ezpublish.rb) depend :remote, :command, "php" depend :remote, :match, "php -r "echo(versi...
OTHER COOL FEATURESsystem check (ezpublish.rb) depend :remote, :command, "php" depend :remote, :match, "php -r "echo(versi...
OTHER COOL FEATURESsystem check (ezpublish.rb) depend :remote, :command, "php" depend :remote, :match, "php -r "echo(versi...
A few tipsgive specific sudo rights to your deployment user Cmnd_Alias DEPLOY_SHELLS = /bin/mkdir, /bin/chmod, /bin/chown,...
Not implemented yet ...  Not CLUSTER aware  SCM tagging operations during  deployment  Only MySQL supported for backup  Pe...
Demo
Secure deployment with capistrano
Secure deployment with capistrano
Secure deployment with capistrano
Secure deployment with capistrano
Upcoming SlideShare
Loading in …5
×

Secure deployment with capistrano

2,064 views

Published on

Presented during the flash talk session at the eZUnConference 2012 in Cologne.

Gives a short feedback on how using Capistrano can be interesting when it comes to deploy eZ Publish application.

It also introduces AlCapON which is a bunch of Capistrano recipes made specially for eZ Publish (still an alpha/poc version)

(better rendering on speaker deck at : https://speakerdeck.com/u/alafon/p/securedeploymentwithcapistrano)

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,064
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • \n
  • code\nwe commit some code\nwe fix some bugs\nthen we test our code... or someone else’s code\nand sometime, often actually, we add some last minute patches...\nand everything finally go live on your favorite and so be-loved production server...\nwell unfortunately this last operation does not just mean pushing an simple switch....\n\n\n
  • code\nwe commit some code\nwe fix some bugs\nthen we test our code... or someone else’s code\nand sometime, often actually, we add some last minute patches...\nand everything finally go live on your favorite and so be-loved production server...\nwell unfortunately this last operation does not just mean pushing an simple switch....\n\n\n
  • code\nwe commit some code\nwe fix some bugs\nthen we test our code... or someone else’s code\nand sometime, often actually, we add some last minute patches...\nand everything finally go live on your favorite and so be-loved production server...\nwell unfortunately this last operation does not just mean pushing an simple switch....\n\n\n
  • code\nwe commit some code\nwe fix some bugs\nthen we test our code... or someone else’s code\nand sometime, often actually, we add some last minute patches...\nand everything finally go live on your favorite and so be-loved production server...\nwell unfortunately this last operation does not just mean pushing an simple switch....\n\n\n
  • code\nwe commit some code\nwe fix some bugs\nthen we test our code... or someone else’s code\nand sometime, often actually, we add some last minute patches...\nand everything finally go live on your favorite and so be-loved production server...\nwell unfortunately this last operation does not just mean pushing an simple switch....\n\n\n
  • code\nwe commit some code\nwe fix some bugs\nthen we test our code... or someone else’s code\nand sometime, often actually, we add some last minute patches...\nand everything finally go live on your favorite and so be-loved production server...\nwell unfortunately this last operation does not just mean pushing an simple switch....\n\n\n
  • code\nwe commit some code\nwe fix some bugs\nthen we test our code... or someone else’s code\nand sometime, often actually, we add some last minute patches...\nand everything finally go live on your favorite and so be-loved production server...\nwell unfortunately this last operation does not just mean pushing an simple switch....\n\n\n
  • code\nwe commit some code\nwe fix some bugs\nthen we test our code... or someone else’s code\nand sometime, often actually, we add some last minute patches...\nand everything finally go live on your favorite and so be-loved production server...\nwell unfortunately this last operation does not just mean pushing an simple switch....\n\n\n
  • code\nwe commit some code\nwe fix some bugs\nthen we test our code... or someone else’s code\nand sometime, often actually, we add some last minute patches...\nand everything finally go live on your favorite and so be-loved production server...\nwell unfortunately this last operation does not just mean pushing an simple switch....\n\n\n
  • code\nwe commit some code\nwe fix some bugs\nthen we test our code... or someone else’s code\nand sometime, often actually, we add some last minute patches...\nand everything finally go live on your favorite and so be-loved production server...\nwell unfortunately this last operation does not just mean pushing an simple switch....\n\n\n
  • code\nwe commit some code\nwe fix some bugs\nthen we test our code... or someone else’s code\nand sometime, often actually, we add some last minute patches...\nand everything finally go live on your favorite and so be-loved production server...\nwell unfortunately this last operation does not just mean pushing an simple switch....\n\n\n
  • code\nwe commit some code\nwe fix some bugs\nthen we test our code... or someone else’s code\nand sometime, often actually, we add some last minute patches...\nand everything finally go live on your favorite and so be-loved production server...\nwell unfortunately this last operation does not just mean pushing an simple switch....\n\n\n
  • code\nwe commit some code\nwe fix some bugs\nthen we test our code... or someone else’s code\nand sometime, often actually, we add some last minute patches...\nand everything finally go live on your favorite and so be-loved production server...\nwell unfortunately this last operation does not just mean pushing an simple switch....\n\n\n
  • code\nwe commit some code\nwe fix some bugs\nthen we test our code... or someone else’s code\nand sometime, often actually, we add some last minute patches...\nand everything finally go live on your favorite and so be-loved production server...\nwell unfortunately this last operation does not just mean pushing an simple switch....\n\n\n
  • code\nwe commit some code\nwe fix some bugs\nthen we test our code... or someone else’s code\nand sometime, often actually, we add some last minute patches...\nand everything finally go live on your favorite and so be-loved production server...\nwell unfortunately this last operation does not just mean pushing an simple switch....\n\n\n
  • code\nwe commit some code\nwe fix some bugs\nthen we test our code... or someone else’s code\nand sometime, often actually, we add some last minute patches...\nand everything finally go live on your favorite and so be-loved production server...\nwell unfortunately this last operation does not just mean pushing an simple switch....\n\n\n
  • code\nwe commit some code\nwe fix some bugs\nthen we test our code... or someone else’s code\nand sometime, often actually, we add some last minute patches...\nand everything finally go live on your favorite and so be-loved production server...\nwell unfortunately this last operation does not just mean pushing an simple switch....\n\n\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • CVS TAGGING : but the revision is known on the target server in a text file\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • CVS TAGGING : but the revision is known on the target server in a text file\n
  • CVS TAGGING : but the revision is known on the target server in a text file\n
  • CVS TAGGING : but the revision is known on the target server in a text file\n
  • CVS TAGGING : but the revision is known on the target server in a text file\n
  • CVS TAGGING : but the revision is known on the target server in a text file\n
  • CVS TAGGING : but the revision is known on the target server in a text file\n
  • CVS TAGGING : but the revision is known on the target server in a text file\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • Source code :\n
  • SCM tagging : but the revision is known on the target server in a text file\n
  • CVS TAGGING : but the revision is known on the target server in a text file\n
  • Secure deployment with capistrano

    1. 1. SECURE YOURDEPLOYMENTWITH CAPISTRANO Arnaud Lafon - Freelancecontact@arnaudlafon.com - @arnaudlafon
    2. 2. COD
    3. 3. COD BUG FIX
    4. 4. COD BUG FIX COMMIT
    5. 5. COD BUG FIXTESTOUR CODE COMMIT
    6. 6. COD BUGTEST CODE FROMSOMEONE ELSE FIX TEST OUR CODE COMMIT
    7. 7. COD BUGTEST CODE FROMSOMEONE ELSE FIX TEST OUR CODE COMMITLAST MINUTEPATCHES
    8. 8. COD BUGTEST CODE FROMSOMEONE ELSE FIX TEST OUR CODE COMMITLAST MINUTEPATCHES
    9. 9. THATSIMPLE ?
    10. 10. NOT REALLY ....
    11. 11. What DEPLOYMENTmeans ?
    12. 12. What DEPLOYMENTmeans ? IT HAS TO BE
    13. 13. What DEPLOYMENTmeans ? as FAST as possible IT HAS TO BE
    14. 14. What DEPLOYMENTmeans ? as FAST as possible IT HAS TO BE RELIABLE
    15. 15. What DEPLOYMENTmeans ? as FAST as possible IT HAS TO BE RELIABLE STABLE
    16. 16. What DEPLOYMENTmeans ? as FAST as possible IT HAS TO BE RELIABLE STABLEIT MUST
    17. 17. What DEPLOYMENTmeans ? as FAST as possible IT HAS TO BE RELIABLE STABLE provide ROLLBACK FEATURESIT MUST
    18. 18. What DEPLOYMENTmeans ? as FAST as possible IT HAS TO BE RELIABLE STABLE provide ROLLBACK FEATURESIT MUST deal with MULTIPLE ENVIRONMENTS
    19. 19. What DEPLOYMENTmeans ? as FAST as possible IT HAS TO BE RELIABLE STABLE provide ROLLBACK FEATURESIT MUST deal with MULTIPLE ENVIRONMENTS take of your var/ FOLDERS
    20. 20. What DEPLOYMENTmeans ? as FAST as possible IT HAS TO BE RELIABLE STABLE provide ROLLBACK FEATURESIT MUST deal with MULTIPLE ENVIRONMENTS take of your var/ FOLDERS OBVIOUSLY, YOU ONLY HAVE ONE PRODUCTION SERVER... NO ???
    21. 21. What DEPLOYMENTmeans ? as FAST as possible IT HAS TO BE RELIABLE STABLE provide ROLLBACK FEATURESIT MUST deal with MULTIPLE ENVIRONMENTS take of your var/ FOLDERS be able to manage MORE THAN 1 SERVER OBVIOUSLY, YOU ONLY HAVE ONE PRODUCTION SERVER... NO ???
    22. 22. DEPLOYMENT PROCESS - example
    23. 23. DEPLOYMENT PROCESS - examplePre-deploymentoperations
    24. 24. DEPLOYMENT PROCESS - examplePre-deployment REPLACE THIS WITH YOURoperations OWN PROCESSES USERS TESTS CONTINUOUS INTEGRATION
    25. 25. DEPLOYMENT PROCESS - examplePre-deployment REPLACE THIS WITH YOURoperations OWN PROCESSES USERS TESTS CONTINUOUS INTEGRATIONSource codeoperations
    26. 26. DEPLOYMENT PROCESS - examplePre-deployment REPLACE THIS WITH YOURoperations OWN PROCESSES USERS TESTS CONTINUOUS INTEGRATION TAGSource code GIT PUSH on a ref.operations repository anything...
    27. 27. DEPLOYMENT PROCESS - examplePre-deployment REPLACE THIS WITH YOURoperations OWN PROCESSES USERS TESTS CONTINUOUS INTEGRATION TAGSource code GIT PUSH on a ref.operations repository anything...Production serversoperations
    28. 28. DEPLOYMENT PROCESS - examplePre-deployment REPLACE THIS WITH YOURoperations OWN PROCESSES USERS TESTS CONTINUOUS INTEGRATION TAGSource code GIT PUSH on a ref.operations repository anything... UPDATE SOURCE CODEProduction servers WARM UP CACHEoperations GO LIVE with the new version
    29. 29. CAPISTRANOconcepts & key featureshttps://github.com/capistrano/capistrano
    30. 30. CAPISTRAwhat ?
    31. 31. CAPISTRAwhat ? CAPISTRANO
    32. 32. CAPISTRAwhat ? IS JUST A BUNCH OF SCRIPTS IS WRITTEN IN RUBY FOR CAPISTRANO RAILS HAS MULTIPLE DEPLOYMENT STRATEGY
    33. 33. CAPISTRAwhat ? IS JUST A BUNCH OF SCRIPTS IS WRITTEN IN RUBY FOR CAPISTRANO RAILS HAS MULTIPLE DEPLOYMENT STRATEGY WORKS WITH GIT SVN ...
    34. 34. CAPISTRAwhat ? IS JUST A BUNCH OF SCRIPTS IS WRITTEN IN RUBY FOR CAPISTRANO RAILS HAS MULTIPLE DEPLOYMENT STRATEGY WORKS WITH GIT SVN ... COMMAND LINE BASED
    35. 35. CAPISTRAwhat ? IS JUST A BUNCH OF SCRIPTS IS WRITTEN IN RUBY FOR CAPISTRANO RAILS HAS MULTIPLE DEPLOYMENT STRATEGY WORKS WITH GIT SVN ... COMMAND LINE BASED VERY BASIC REQUIREMENTS
    36. 36. CAPISTRAwhat ? IS JUST A BUNCH OF SCRIPTS IS WRITTEN IN RUBY FOR CAPISTRANO RAILS HAS MULTIPLE DEPLOYMENT STRATEGY WORKS WITH GIT SVN ... COMMAND LINE BASED VERY BASIC REQUIREMENTS LOCAL MACHINE RUBY
    37. 37. CAPISTRAwhat ? IS JUST A BUNCH OF SCRIPTS IS WRITTEN IN RUBY FOR CAPISTRANO RAILS HAS MULTIPLE DEPLOYMENT STRATEGY WORKS WITH GIT SVN ... COMMAND LINE BASED VERY BASIC REQUIREMENTS LOCAL MACHINE REMOTE SERVERS RUBY SSH SERVER NO RUBY REQUIRED UNIX-LIKE OS
    38. 38. deploy:defaultBASED ON deploy:updateTASKS deploy:update_code deploy:finalize_code setup deploy:symlink check deploy:restart
    39. 39. deploy:default BASED ON deploy:update TASKS deploy:update_code deploy:finalize_code setup deploy:symlink check deploy:restartBEFORE &AFTERTRIGGERS
    40. 40. deploy:default BASED ON deploy:update TASKS deploy:update_code deploy:finalize_code setup deploy:symlink check deploy:restartBEFORE & BUILDS & SENDSAFTER REQUESTSTRIGGERS OVER SSH
    41. 41. deploy:default BASED ON deploy:update TASKS deploy:update_code deploy:finalize_code setup deploy:symlink check deploy:restartBEFORE & BUILDS & SENDS MAKES USEAFTER REQUESTS OFTRIGGERS OVER SSH SYMLINKS
    42. 42. deploy:default BASED ON deploy:update TASKS deploy:update_code deploy:finalize_code setup deploy:symlink check deploy:restartBEFORE & BUILDS & SENDS MAKES USEAFTER REQUESTS OF ROLLBACKTRIGGERS OVER SSH SYMLINKS
    43. 43. BASIC SETUP
    44. 44. BASIC SETUP Requirements
    45. 45. BASIC SETUP Requirements RubyGems >= 1.3.x if needed => $ apt-get install rubygems $ gem instal capistrano
    46. 46. BASIC SETUP Requirements RubyGems >= 1.3.x if needed => $ apt-get install rubygems $ gem instal capistrano Capify your app locally $ capify . [add] making directory ./config [add] writing ./config/deploy.rb [add] writing ./Capfile [done] capified!
    47. 47. config/deploy.rb set :application, "myapp" set :repository, "username@github.com:myapp.git" set :deploy_to, "/var/www/#{application}" set :user, "deploymentuser" set :branch, "devel" # Or : accurev, bzr, cvs, darcs, git, mercurial, perforce, subversion or none set :scm, :git role :web, "www.myapp.com" # Your HTTP server, Apache/etc role :web, "78.123.21.5" # Another front server role :db, "www.myapp.com",:primary => true # Your main MySQL server role :db, "78.123.21.5" # A slave SQL server
    48. 48. DEAL WITH MULTISTAGE
    49. 49. DEAL WITH MULTISTAGE $ gem install capistrano-ext
    50. 50. DEAL WITH MULTISTAGE $ gem install capistrano-ext config/deploy.rb
    51. 51. DEAL WITH MULTISTAGE $ gem install capistrano-ext config/deploy.rb require capistrano/ext/multistage set :stages, %w(local devel preproduction production) set :default_stage, "devel"
    52. 52. DEAL WITH MULTISTAGE $ gem install capistrano-ext config/deploy.rb require capistrano/ext/multistage set :stages, %w(local devel preproduction production) set :default_stage, "devel" config/deploy/devel.rb
    53. 53. DEAL WITH MULTISTAGE $ gem install capistrano-ext config/deploy.rb require capistrano/ext/multistage set :stages, %w(local devel preproduction production) set :default_stage, "devel" config/deploy/devel.rb role :web, ‘dev.myapp.com’
    54. 54. DEAL WITH MULTISTAGE $ gem install capistrano-ext config/deploy.rb require capistrano/ext/multistage set :stages, %w(local devel preproduction production) set :default_stage, "devel" config/deploy/devel.rb role :web, ‘dev.myapp.com’ config/deploy/qa.rb
    55. 55. DEAL WITH MULTISTAGE $ gem install capistrano-ext config/deploy.rb require capistrano/ext/multistage set :stages, %w(local devel preproduction production) set :default_stage, "devel" config/deploy/devel.rb role :web, ‘dev.myapp.com’ config/deploy/qa.rb config/deploy/preproduction.rb
    56. 56. DEAL WITH MULTISTAGE $ gem install capistrano-ext config/deploy.rb require capistrano/ext/multistage set :stages, %w(local devel preproduction production) set :default_stage, "devel" config/deploy/devel.rb role :web, ‘dev.myapp.com’ config/deploy/qa.rb config/deploy/preproduction.rb config/deploy/production.rb
    57. 57. DEAL WITH MULTISTAGE $ gem install capistrano-ext config/deploy.rb require capistrano/ext/multistage set :stages, %w(local devel preproduction production) set :default_stage, "devel" config/deploy/devel.rb role :web, ‘dev.myapp.com’ config/deploy/qa.rb config/deploy/preproduction.rb config/deploy/production.rb .....
    58. 58. ONEnable
    59. 59. CapONEnableCapistrano
    60. 60. AlCapON EnableCapistrano For eZ Publishhttp://alafon.github.com/alcapon/
    61. 61. eZ Publish ♥ Capistrano
    62. 62. eZ Publish ♥ CapistranoCapezit
    63. 63. eZ Publish ♥ CapistranoCapezit $ gem install alcapon $ capezit . [add] writing ./extension/alcapon/config/ezpublish.rb [add] writing ./extension/alcapon/config/deploy.rb [add] writing ./extension/alcapon/config/deploy/production.rb [add] writing ./extension/alcapon/config/deploy/devel.rb [add] writing ./Capfile [done] Your eZ Publish project is now controlled by AlCapON !
    64. 64. eZ Publish ♥ CapistranoCapezit $ gem install alcapon $ capezit . [add] writing ./extension/alcapon/config/ezpublish.rb [add] writing ./extension/alcapon/config/deploy.rb [add] writing ./extension/alcapon/config/deploy/production.rb [add] writing ./extension/alcapon/config/deploy/devel.rb [add] writing ./Capfile [done] Your eZ Publish project is now controlled by AlCapON !Dedicated tasks to eZ
    65. 65. eZ Publish ♥ CapistranoCapezit $ gem install alcapon $ capezit . [add] writing ./extension/alcapon/config/ezpublish.rb [add] writing ./extension/alcapon/config/deploy.rb [add] writing ./extension/alcapon/config/deploy/production.rb [add] writing ./extension/alcapon/config/deploy/devel.rb [add] writing ./Capfile [done] Your eZ Publish project is now controlled by AlCapON !Dedicated tasks to eZ LOCA L
    66. 66. eZ Publish ♥ CapistranoCapezit $ gem install alcapon $ capezit . [add] writing ./extension/alcapon/config/ezpublish.rb [add] writing ./extension/alcapon/config/deploy.rb [add] writing ./extension/alcapon/config/deploy/production.rb [add] writing ./extension/alcapon/config/deploy/devel.rb [add] writing ./Capfile [done] Your eZ Publish project is now controlled by AlCapON !Dedicated tasks to eZ REMOT LOCA E L SERVER(S )
    67. 67. eZ Publish ♥ CapistranoCapezit $ gem install alcapon $ capezit . [add] writing ./extension/alcapon/config/ezpublish.rb [add] writing ./extension/alcapon/config/deploy.rb [add] writing ./extension/alcapon/config/deploy/production.rb [add] writing ./extension/alcapon/config/deploy/devel.rb [add] writing ./Capfile [done] Your eZ Publish project is now controlled by AlCapON !Dedicated tasks to eZ DATABASE IMPORT EXPORT REMOT LOCA E L SERVER(S )
    68. 68. eZ Publish ♥ CapistranoCapezit $ gem install alcapon $ capezit . [add] writing ./extension/alcapon/config/ezpublish.rb [add] writing ./extension/alcapon/config/deploy.rb [add] writing ./extension/alcapon/config/deploy/production.rb [add] writing ./extension/alcapon/config/deploy/devel.rb [add] writing ./Capfile [done] Your eZ Publish project is now controlled by AlCapON !Dedicated tasks to eZ DATABASE IMPORT EXPORT VAR SYNC REMOT LOCA E L SERVER(S )
    69. 69. eZ Publish ♥ CapistranoCapezit $ gem install alcapon $ capezit . [add] writing ./extension/alcapon/config/ezpublish.rb [add] writing ./extension/alcapon/config/deploy.rb [add] writing ./extension/alcapon/config/deploy/production.rb [add] writing ./extension/alcapon/config/deploy/devel.rb [add] writing ./Capfile [done] Your eZ Publish project is now controlled by AlCapON !Dedicated tasks to eZ DATABASE IMPORT EXPORT VAR SYNC REMOT LOCA AUTOLOADS & CACHE E L SERVER(S )
    70. 70. eZ Publish ♥ CapistranoCapezit $ gem install alcapon $ capezit . [add] writing ./extension/alcapon/config/ezpublish.rb [add] writing ./extension/alcapon/config/deploy.rb [add] writing ./extension/alcapon/config/deploy/production.rb [add] writing ./extension/alcapon/config/deploy/devel.rb [add] writing ./Capfile [done] Your eZ Publish project is now controlled by AlCapON !Dedicated tasks to eZ DATABASE IMPORT EXPORT VAR SYNC REMOT LOCA AUTOLOADS & CACHE E L MANAGEMENT SERVER(S )
    71. 71. eZ Publish ♥ CapistranoCapezit $ gem install alcapon $ capezit . [add] writing ./extension/alcapon/config/ezpublish.rb [add] writing ./extension/alcapon/config/deploy.rb [add] writing ./extension/alcapon/config/deploy/production.rb [add] writing ./extension/alcapon/config/deploy/devel.rb [add] writing ./Capfile [done] Your eZ Publish project is now controlled by AlCapON !Dedicated tasks to eZ DATABASE IMPORT EXPORT VAR SYNC REMOT LOCA AUTOLOADS & CACHE E L MANAGEMENT SERVER(S )
    72. 72. eZ Publish ♥ CapistranoCapezit $ gem install alcapon $ capezit . [add] writing ./extension/alcapon/config/ezpublish.rb [add] writing ./extension/alcapon/config/deploy.rb [add] writing ./extension/alcapon/config/deploy/production.rb [add] writing ./extension/alcapon/config/deploy/devel.rb [add] writing ./Capfile [done] Your eZ Publish project is now controlled by AlCapON !Dedicated tasks to eZ DATABASE IMPORT EXPORT VAR SYNC REMOT LOCA AUTOLOADS & CACHE E L MANAGEMENT SERVER(S )
    73. 73. eZ Publish ♥ CapistranoCapezit $ gem install alcapon $ capezit . [add] writing ./extension/alcapon/config/ezpublish.rb [add] writing ./extension/alcapon/config/deploy.rb [add] writing ./extension/alcapon/config/deploy/production.rb [add] writing ./extension/alcapon/config/deploy/devel.rb [add] writing ./Capfile [done] Your eZ Publish project is now controlled by AlCapON !Dedicated tasks to eZ DATABASE IMPORT EXPORT VAR SYNC REMOT LOCA AUTOLOADS & CACHE E L MANAGEMENT SERVER(S )
    74. 74. eZ Publish ♥ CapistranoCapezit $ gem install alcapon $ capezit . [add] writing ./extension/alcapon/config/ezpublish.rb [add] writing ./extension/alcapon/config/deploy.rb [add] writing ./extension/alcapon/config/deploy/production.rb [add] writing ./extension/alcapon/config/deploy/devel.rb [add] writing ./Capfile [done] Your eZ Publish project is now controlled by AlCapON !Dedicated tasks to eZ DATABASE IMPORT EXPORT VAR SYNC REMOT LOCA AUTOLOADS & CACHE E L MANAGEMENT SERVER(S )
    75. 75. eZ Publish ♥ CapistranoCapezit $ gem install alcapon $ capezit . [add] writing ./extension/alcapon/config/ezpublish.rb [add] writing ./extension/alcapon/config/deploy.rb [add] writing ./extension/alcapon/config/deploy/production.rb [add] writing ./extension/alcapon/config/deploy/devel.rb [add] writing ./Capfile [done] Your eZ Publish project is now controlled by AlCapON !Dedicated tasks to eZ DATABASE IMPORT EXPORT VAR SYNC REMOT LOCA AUTOLOADS & CACHE E L MANAGEMENT SERVER(S )
    76. 76. OTHER COOL FEATURES
    77. 77. OTHER COOL FEATURESsystem check (ezpublish.rb)
    78. 78. OTHER COOL FEATURESsystem check (ezpublish.rb) depend :remote, :command, "php" depend :remote, :match, "php -r "echo(version_compare(PHP_VERSION,5.2.14)?ok:ko);"", "ok" depend :remote, :match, "php -m | grep curl", "curl"
    79. 79. OTHER COOL FEATURESsystem check (ezpublish.rb) depend :remote, :command, "php" depend :remote, :match, "php -r "echo(version_compare(PHP_VERSION,5.2.14)?ok:ko);"", "ok" depend :remote, :match, "php -m | grep curl", "curl"check if you have local changes
    80. 80. OTHER COOL FEATURESsystem check (ezpublish.rb) depend :remote, :command, "php" depend :remote, :match, "php -r "echo(version_compare(PHP_VERSION,5.2.14)?ok:ko);"", "ok" depend :remote, :match, "php -m | grep curl", "curl"check if you have local changes $ cap capez:dev:local_check /Users/alafon/Sites/alcapon-demo/local-install triggering load callbacks * 10:23:51 == Currently executing `devel triggering start callbacks for `capez:dev:local_check * 10:23:51 == Currently executing `multistage:ensure * 10:23:51 == Currently executing `capez:dev:local_check Checking your local git... You have new files Abort ? y/n (n) n You have 1 commits that need to be pushed Push them before deployment ? y/n (y) n
    81. 81. A few tipsgive specific sudo rights to your deployment user Cmnd_Alias DEPLOY_SHELLS = /bin/mkdir, /bin/chmod, /bin/chown, /bin/ chgrp, /bin/ln, /usr/bin/php user ALL=(user) NOPASSWD: DEPLOY_SHELLS user ALL=(apache) NOPASSWD: DEPLOY_SHELLSuse publickey on the remote server $ ssh-copy-id ~/.ssh/publickkey.pub user@domain.com
    82. 82. Not implemented yet ... Not CLUSTER aware SCM tagging operations during deployment Only MySQL supported for backup Permissions issues Automated database backup during deployment with ROLLBACK SUPPORT Enable debug on remotes ....
    83. 83. Demo

    ×