Skip to content

Instantly share code, notes, and snippets.

@weppos
Created July 29, 2008 15:37
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save weppos/3110 to your computer and use it in GitHub Desktop.
Provides tasks for deploying a Rails application with FastCGI.
#
# = Capistrano FastCGI deploy tasks
#
# Provides tasks for deploying a Rails application with FastCGI.
#
# Category:: Capistrano
# Package:: FastCGI
# Author:: Simone Carletti <weppos@weppos.net>
# 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