deprec usage instructions
The following instructions describe how to use deprec.
Most of the magic of deprec occurs in the install_rails_stack section. This builds the server, which developers previously had to do by hand, or find a hosting company that did it for them. Once that is done, deprec also adds application specific helper tasks, which are shown below in the "deploy a rails app to hosts" section.
Please note that the "deprec --apply-to" command is much like the "cap --apply-to" command, except that it creates a deploy.rb file in your application's config directory with more available settings than capistrano uses, because these settings can be used to configure the application specific aspects of apache and mongrel.
Important Note: Running "deprec --apply-to" currently overwrites your existing deploy.rb file. If you have deployed the app elsewhere before, you may want to backup this file so that you can refer to it when setting up your deprec generated deploy.rb. Because deprec sets up the server, it can fill in more sensible defaults than capistrano normally does, but there are still a few settings that you need to set yourself. Future versions of deprec will not overwrite this file automatically, but will move it out of the way first.
## install deprec on workstation # sudo gem install deprec -y # installs what you need # Deprec doesn't (yet) work with Capistrano 2 # When using deprec, you need to use cap1, which can happily coexist # with cap2 if you have a way of calling it. # Put the following into your bash environment (~/.bash_login on OSX) alias cap1="`which cap` _1.4.1_" # This loads the deprec recipes into Capistrano *except* when using Cap2. echo "require 'deprec/recipes' unless respond_to?(:namespace)" >> ~/.caprc # include deprec recipes cap show_tasks # should now include deprec tasks
install rails stack
# this currently only works with ubuntu 6.06.1 server installed # you need to have an account on this machine and sudo access # # This will install a rails stack on three hosts simultaneously # It should take about ten minutes depending on network and server speeds. # export HOSTS=r01,r02,r03 # define some hosts to mess with cap setup_ssh_keys # copy your public keys to the servers cap install_rails_stack # install apache, rubygems, mongrel, rails, etc. unset HOSTS # stop overriding cap's hosts list
deploy a rails app to hosts
# setup dns for your domain or put an entry in /etc/hosts cd /path/to/app deprec --apply-to . # open config/deploy.rb to update :domain, :application and :repository fields cap setup cap deploy_with_migrations cap restart_apache # update rails app on hosts cap deploy cap deploy_with_migrations
some handy tools
cap show_tasks cap disable_web, enable_web # puts up maintenance page cap restart_mongrel_cluster # does what it says
