Hi,
Making that change would break things for people who run sphinx on the
database servers (or completely dedicated servers with a custom role).
Personally I generally find it easier to roll my own deploy tasks that
look something like this:
namespace :deploy do
namespace :sphinx do
before "deploy:restart", "deploy:sphinx:index_and_restart"
desc "Reindexes and restarts sphinx in new release dir"
task :index_and_restart, :roles => :app do
run "cd #{current_path} && rake RAILS_ENV=#{rails_env}
thinking_sphinx:rebuild"
end
desc "Re-generates indexes and signals sphinx to reload"
task :reindex, :roles => :app do
run "cd #{current_path} && rake RAILS_ENV=#{rails_env}
thinking_sphinx:reindex"
end
end
end
The reindex one is only for convienience, the deploy only actually uses
the first one. I've found linking the db/sphinx directory to be
unnecessary as the database is regenerated on every deploy.
hope that's helpful,
Alex
On 24/06/2010 11:01, Marcelo Barbudas wrote:
Hi.
It seems the capistrano recipes are kindof old. I had two problems
with them:
1) Running something like
task :after_update_code, :roles => [:app] do
thinking_sphinx.configure
end
Doesn't send :roles => [ :app ] to the underlying tasks. In my case TS
was being executed on all roles, including DB servers, and everything
crashed.
The proper fix is to include :roles => :app in the thinking_sphinx/lib/
deploy/capistrano.rb to each task.
2) :after_update(as mentioned here
http://freelancing-god.github.com/ts/en/deployment.html)
apparently is deprecated
This is what I'm using:
task :sphinx_stop, :roles => [:app] do
thinking_sphinx.stop
end
task :sphinx_start, :roles => [:app] do
symlink_sphinx_indexes
thinking_sphinx.start
end
task :symlink_sphinx_indexes, :roles => [:app] do
run "ln -nfs #{shared_path}/db/sphinx #{current_path}/db/sphinx"
end
before "deploy:update_code", "sphinx_stop"
after "deploy:update_code", "sphinx_start"
--
M.
--
Alex Tomlins
Unboxed
Consulting
E: [email protected]
<mailto:[email protected]>
M: +44 78 2469 6890
T: +44 20 3137 2930
F: +44 20 7183 4251
8 Elder Street
London, E1 6BT
United Kingdom
www.unboxedconsulting.com <http://www.unboxedconsulting.com>
--
You received this message because you are subscribed to the Google Groups "Thinking
Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/thinking-sphinx?hl=en.