Report abuse

# Using the plugin
load 'vendor/plugins/thinking-sphinx/lib/thinking_sphinx/deploy/capistrano'
# If using the ThinkingSphinx gem, use the following instead.
# require 'thinking_sphinx/deploy/capistrano'

set :application, "appname"
set :domain, "www.myserver.com"
set :deploy_to, "/app/directory"
set :user, "root"
set :repository, "http://www.example.com/svn/#{application}/trunk"

role :web, domain
role :app, domain
role :db,  domain, :primary => true

namespace :deploy do
  desc "Restart the app"
  task :restart, :roles => :app do

    # This regen's the config file, stops Sphinx if running, then starts it.
    # No indexing is done, just a restart of the searchd daemon
    # thinking_sphinx.running_start

    # The above does not re-index. If any of your define_index blocks
    # in your models have changed, you will need to perform an index.
    # If these are changing frequently, you can use the following
    # in place of running_start

      # thinking_sphinx.stop
      # thinking_sphinx.index
      # thinking_sphinx.start

    # Restart the app
    run "touch #{current_path}/tmp/restart.txt"
  end

  desc "Cleanup older revisions"
  task :after_deploy do
    cleanup
  end

end

after "deploy:setup", "thinking_sphinx:shared_sphinx_folder"