Search code examples
ruby-on-rails-3.2capistranoasset-pipelinethinking-sphinx

Rails3 asset precompilation and capistrano tasks with symlinks out of sequence


Context: rails 3.2.18, capistrano 2.14.2, rvm-capistrano 1.2.7. thinking-sphinx 3.1.1, turbo-sprockets-rails3 0.3.14 When capfile is uncommented in production mode to

 load 'deploy/assets'

deployment fails when

executing `deploy:assets:precompile'

for motive:

Errno::ENOENT: No such file or directory - /Users/me/fna/releases/20140826161316/config/database.yml

The deployment file has a sequence that works in other production modes, however this combination fails. The only real change is the requirement of thinking-sphinx, but I fail to see how that comes into play with asset compilation. From deploy.rb:

require 'bundler/capistrano'
require 'thinking_sphinx/deploy/capistrano'
require "rvm/capistrano"

[...]

after "deploy:update_code","deploy:post_update"

[...]

task :post_update do
 # Symlink shared files
  %w(
    database.yml
    sphinx.yml
    thinking_sphinx.yml
    development.sphinx.conf
    production.sphinx.conf
  ).each do |filename|
   run "ln -nfs #{shared_path}/config/#{filename} #{release_path}/config/#{filename}"

How can I ensure that the symlinks are seen before the asset compilation starts?


Solution

  • One solution is to remove the reference to database.yml in the gitignore file.
    Not ideal if one wants to run production locally.