Capistrano deployment and keeping the indexes up to date

3 views
Skip to first unread message

Chris Roos

unread,
Nov 13, 2009, 8:50:00 AM11/13/09
to Thinking Sphinx
Afternoon,

I've spent some time this morning getting my head around how the
thinking sphinx capistrano tasks work. My understanding is that the
default tasks (as described on the deployment page[1]) will execute
the thinking sphinx tasks in /<app>/current. As these tasks happen
before and after deploy:update_code they will execute in the currently
deployed version of the app, i.e. *not* the version that's in the
process of becoming the deployed version (because the current symlink
doesn't get changed until the end of the deployment task). The result
is that, after a successful deploy, the current version of the app
doesn't have a sphinx config file (e.g. config/sphinx.staging.conf) or
a symlink to the indexes (db/sphinx/).

Although I find this confusing, I don't think it becomes a problem
until you come to rebuild the indexes (again, as documented on the
deployment page[1]). The suggested command to rebuild the indexes is
"cd /path/to/app/current && /usr/local/bin/rake
thinking_sphinx:rebuild". Running that command results in an error
because it tries to read the config file from the current directory
and that doesn't exist.

The approach I'm favouring at the moment is to change the thinking
sphinx tasks to run after 'deploy:restart' so that sphinx is
configured and started from the actually deployed version of the app.
Does that sound sensible?

Cheers, Chris

[1] http://freelancing-god.github.com/ts/en/deployment.html

Pat Allan

unread,
Nov 14, 2009, 12:16:56 AM11/14/09
to thinkin...@googlegroups.com
Hi Chris

Just yesterday I updated Thinking Sphinx to use the release path
instead of current path for Capistrano, so hopefully this should get
around the problems. I've not released a new version of the gem yet,
but the plugin includes the update. A new gem version will certainly
be out early in the coming week.

--
Pat
Reply all
Reply to author
Forward
0 new messages