Permalink
Browse files

Deployment/Installation updates

* Have both gem and plugin references for Capistrano setup.
* Remove symlink section for Capistrano - should be using shared paths already, as documented on the same page.
* Adding begin/rescue block around Raketask require - ugly, but makes gems:install rake task work.
  • Loading branch information...
pat committed May 7, 2011
1 parent e0fa174 commit f37976670268fff55075d1b2a794493a5572a1a5
Showing with 8 additions and 5 deletions.
  1. +3 −4 ts/en/deployment.textile
  2. +5 −1 ts/en/installing_thinking_sphinx.textile
View
@@ -37,6 +37,9 @@ Deploying via Capistrano is simplified by the included recipe file that comes wi
The first step is to include the recipe in order to define the necessary tasks for us:
{%highlight ruby%}
+# If you're using Thinking Sphinx as a gem:
+require 'thinking_sphinx/deploy/capistrano'
+# If you're using Thinking Sphinx as a plugin:
require 'vendor/plugins/thinking-sphinx/recipes/thinking_sphinx'
{%endhighlight%}
@@ -52,10 +55,6 @@ task :after_update_code, :roles => [:app] do
thinking_sphinx.configure
thinking_sphinx.start
end
-
-task :symlink_sphinx_indexes, :roles => [:app] do
- run "ln -nfs #{shared_path}/db/sphinx #{release_path}/db/sphinx"
-end
{%endhighlight%}
The above makes sure we stop the Sphinx @searchd@ search daemon before we update the code. After the code is updated, we reconfigure Sphinx and then restart. We'll setup a @cron@ job next to keep the indexes up-to-date.
@@ -34,7 +34,11 @@ config.gem(
And one last thing: ensure the rake tasks are available by adding the following lines to your @Rakefile@:
{% highlight ruby %}
-require 'thinking_sphinx/tasks'
+begin
+ require 'thinking_sphinx/tasks'
+rescue LoadError
+ puts "You can't load Thinking Sphinx tasks unless the thinking-sphinx gem is installed."
+end
{% endhighlight %}
Please note that if you've got Rails vendored, then this may not work so neatly. Thinking Sphinx's rake tasks load ActiveRecord, but it doesn't pick up on the vendored version - so you will "still need Rails gems installed normally":http://elliot-nelson.net/2010/02/thinking-sphinx-and-frozen-rails/ as well.

0 comments on commit f379766

Please sign in to comment.