If you're deploying your Rails application with capistrano and using ferret as your app's index, you'll quickly notice that with every deployment/update to your production code will come a ferret index rebuild. Not good.
Luckily, the solution is quite simple.
First, deploy your app and build your index. Once that's done, copy your index folder to the shared folder:
cp -R /path/to/your/app/current/index /path/to/your/app/shared/
Lastly, in your deploy.rb file that you use to control your deployments, tell capistrano to create a symlink to the shared directory for your ferret index:
desc "Preserve ferret index"
task :after_update_code, :roles => [:web] do
run <<-EOF
ln -s #{shared_path}/index #{latest_release}/index
EOF
end
That's it. Now every time you deploy, your index is the same as it was before. This is great 99% of the time, but don't forget to rebuild your index manually if you modify your indexed data structures.



blog
by 
Add a Comment (0)
Email This
Message Author
Statistics
RSS

