Run Webistrano with Lighttpd

Webistrano intends to make the deployment of multi-stage and multi-environment scenarios easy. Webistrano is a Web UI for managing Capistrano deployments. It lets you manage projects and their stages like test, staging, and production with different settings. Those stages can then be deployed with Capistrano through this web interface. Additionally it allows you to track who deployed what, when to which servers and be alerted by email on each deployment.

As there’s no direct guide on how to run Webistrano with a web server like Lighttpd or Nginx, here we’ll describe how to do that it.

Basically we need to enable FastCGI support for Lighttpd, and set the variables which are needed. We assume that you’re running the latest Webistrano which is checked out from its git repository.

Webistrano dependency requirements

Firstly it requires rubygems 1.3.6. You might need to upgrade your rubygems to the right version, you can refer to our former post Upgrade and downgrade RubyGems for details. Then get the bundle installed, and run “sudo bundle install” in your webistrano root directory.

Enable FastCGI on Lighttpd

Here’s an example for reference. The lighttpd needs mod_fastcgi as well.

server.modules           = ( "mod_accesslog", "mod_fastcgi", "mod_expire" )

The other configuration section:

server.error-handler-404 = "/dispatch.fcgi"
server.pid-file          = "/opt/lighttpd/tmp/pids/lighttpd.pid"
server.document-root     = "/opt/webistrano/public/"

compress.filetype        = ( "text/javascript" )
compress.cache-dir       = "/opt/lighttpd/tmp/cache"

# Change *-procs to 2 if you need to use Upload Progress or other tasks that
# *need* to execute a second request while the first is still pending.
fastcgi.debug     = 2
fastcgi.server      = ( ".fcgi" => ( "localhost" => (
"min-procs"       => 2,
"max-procs"       => 3,
"socket"          => "/opt/lighttpd/tmp/sockets/fcgi.socket",
"bin-path"        => "/opt/webistrano/public/dispatch.fcgi",
"bin-environment" => ( "RAILS_ENV" => "production" ),
"allow-x-send-file" => "enable"
) ) )

When the configuration finishes, don’t forget to set the Webinistrano’s log level to debug, it can be done in config/environments/production.rb. Error mesage will be written to log/production.log. A typic as below indicates the ruby path is incorrect, and you can use fully path to ruby in line 130.

Processing DeploymentsController#new (for 172.24.1.61 at 2011-06-21 06:55:24) [GET]
Parameters: {"project_id"=>"1", "repeat"=>"777", "stage_id"=>"1"}
Rendering template within layouts/application
Rendering deployments/new
Completed in 78ms (View: 53, DB: 19) | 200 OK [http://git.admon.org/projects/1/stages/1/deployments/new?repeat=777]
sh: ruby: command not found
Share Button

Leave a comment

Your email address will not be published. Required fields are marked *