Created
July 29, 2008 15:37
-
-
Save weppos/3110 to your computer and use it in GitHub Desktop.
Provides tasks for deploying a Rails application with FastCGI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# = Capistrano FastCGI deploy tasks | |
# | |
# Provides tasks for deploying a Rails application with FastCGI. | |
# | |
# Category:: Capistrano | |
# Package:: FastCGI | |
# Author:: Simone Carletti <[email protected]> | |
# Copyright:: 2007-2008 The Authors | |
# License:: MIT License | |
# Link:: http://www.simonecarletti.com/ | |
# Source:: http://gist.github.com/2769 | |
# | |
# | |
# == Requirements | |
# | |
# This extension requires the following variables to be defined: | |
# | |
# [<tt>user</tt>] | |
# The unix user under which all commands are run on the server | |
# | |
# | |
unless Capistrano::Configuration.respond_to?(:instance) | |
abort "This extension requires Capistrano 2" | |
end | |
Capistrano::Configuration.instance.load do | |
namespace :fastcgi do | |
desc <<-DESC | |
Restarts your application. \ | |
Kills all `dispatch.fcgi` processes running under `user`, | |
and causes fcgi processes to be restarted on the next request. | |
DESC | |
task :restart, :roles => :app, :except => { :no_release => true } do | |
run "pkill -9 -u #{user} -f dispatch.fcgi" | |
end | |
desc <<-DESC | |
Start the application servers. \ | |
Please note that this task is not supported by FastCGI. | |
DESC | |
task :start, :roles => :app do | |
logger.info ":start task not supported by FastCGI" | |
end | |
desc <<-DESC | |
Stop the application servers. \ | |
Please note that this task is not supported by FastCGI. | |
DESC | |
task :stop, :roles => :app do | |
logger.info ":stop task not supported by FastCGI" | |
end | |
end | |
namespace :deploy do | |
desc <<-DESC | |
Restarts your application. \ | |
Overwrites default :restart task for FastCGI. | |
DESC | |
task :restart, :roles => :app, :except => { :no_release => true } do | |
fastcgi.restart | |
end | |
desc <<-DESC | |
Start the application servers. \ | |
Overwrites default :start task for FastCGI. | |
DESC | |
task :start, :roles => :app do | |
fastcgi.start | |
end | |
desc <<-DESC | |
Stop the application servers. \ | |
Overwrites default :start task for FastCGI. | |
DESC | |
task :stop, :roles => :app do | |
fastcgi.stop | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment