Your SlideShare is downloading. ×
Deploying Rails Apps with Capistrano
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Deploying Rails Apps with Capistrano

3,064
views

Published on

Seminar presentation on Capistrano by Chaitanya at Nyros Technologies on 16th June, 2009. …

Seminar presentation on Capistrano by Chaitanya at Nyros Technologies on 16th June, 2009.

http://www.nyros.com

Published in: Technology

0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,064
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
65
Comments
0
Likes
4
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • Transcript

    • 1. Capistrano Deploying Rails Apps with Capistrano By Chaitanya
    • 2. What is Capistrano
      • Capistrano is a utility for managing remote servers and automating remote tasks. It is popularly used to deploy Rails applications . The main functionality of the Capistrano is to Deploy the rails application which you have already written. and we are using the "SVN" subversion to manage the code.
    • 3.
      • It was previously called Switchtower. You can easily rollback to previous versions, do database migrations, and complete other complicated tasks.
      • Presently available version is 2.2.0
    • 4.
      • Capistrano will transfer all the files of the rails application which you have developed in your local host to server directly by simply executing an simple command in your command prompt.
    • 5. Deployment isn’t that complex, right?
      • Simple sites are easy
        • One Database
        • One Webserver
        • One Application
      • Multiple Sites?
    • 6. Installing Capistrano
      • Gem install capistrano
        • “ cap –h” to see commands
      • Now to apply it to an application
        • “ capify .”
      • Creates two files:
        • config/deploy.rb
        • capfile
    • 7. Configure Capistrano
      • Edit deploy.rb to match your app’s setup
        • You’ll need to specify the servers, repository location and deployment path at minimum
        • Defaults to SVN, normal SSH port, key in user home, SCM executable on PATH, etc.
        • When you first start, you’ll probably only have one server fulfill the DB, web and app roles.
    • 8. My Modifications to deploy.rb
      • set :application, "captest"
      • set :repository, "https://pollack.textdriven.com/svn/captest"
      • role :web, "burnaby.textdrive.com"
      • role :app, "burnaby.textdrive.com"
      • role :db, "burnaby.textdrive.com"
      • set :deploy_to, "/users/home/patched/sites/captest"
      • set :user, "patched"
      • set :svn_username, "captest"
      • set :svn_password, "captest"
      • desc "Restart the webserver/fcgi procs, however you do it"
      • task :restart, :roles => :app do
      • # I’m not going to restart anything for this example
      • end
      • task :after_deploy, :roles => :app do
      • # Set my new dispatch.fcgi to be executable
      • run "chmod 755 #{deploy_to}/current/public/dispatch.fcgi"
      • end
    • 9. Setup
      • “ rake remote:exec ACTION=setup”
        • Sets up the base directories
      This creates /sites/captest/releases /sites/captest/shared /sites/captest/shared/log /sites/captest/shared/system
    • 10. Deployment Structure
    • 11. Lets Deploy!
      • “Rake --tasks” to see all our options
      • “Rake deploy” to push a version
      • “Rake rollback” to rollback
    • 12. Deploying?
        • cap deploy
    • 13. Rollback?
      • cap rollback
    • 14. Web Access?
      • cap disable_web
      • cap enable_web
    • 15. Various commands
      • cap apache:configure # Configure Apache.
      • cap apache:reload # Reload Apache
      • cap apache:restart # Restart Apache
      • cap apache:start # Start Apache
      • cap apache:stop # Stop Apache
      • cap app:restart # Restart application server.
      • cap app:setup # Setup mongrel
      • cap app:start # Start application server.
      • cap app:stop # Stop application server.
      • cap app:symlinks:setup # Setup application symlinks in the public
      • cap app:symlinks:update # Link public directories to shared location.
      • cap cache_comm_count # Simple cache of counts for comm users
      • cap db:setup # Setup database server.
      • cap deploy # Deploys your project.
      • cap deploy:check # Test deployment dependencies.
    • 16. Various commands
      • cap deploy:cleanup # Clean up old releases.
      • cap deploy:cold # Deploys and starts a `cold' application.
      • cap deploy:migrate # Run the migrate rake task.
      • cap deploy:migrations # Deploy and run pending migrations.
      • cap deploy:pending # Displays the commits since your last deploy.
      • cap deploy:pending:diff # Displays the `diff' since your last deploy.
      • cap deploy:restart # Restart the Mongrel processes on the app serv...
      • cap deploy:rollback # Rolls back to a previous version and restarts.
      • cap deploy:rollback:code # Rolls back to the previously deployed version.
      • cap deploy:setup # Prepares one or more servers for deployment.
      • cap deploy:start # Start the Mongrel processes on the app server...
      • cap deploy:stop # Stop the Mongrel processes on the app server ...
      • cap deploy:symlink # Updates the symlink to the most recently depl...
      • cap deploy:update # Copies your project and updates the symlink.
    • 17.
      • Thank You