Forum: Ferret Trouble deploying ferret with Capistrano

A7263d0aad8f750b83d52b6a58a44b4b?d=identicon&s=25 Mark Richman (mrichman)
on 2008-06-21 21:55
Why do I get this error "No such file or directory -
/home/mrichman/www/myapp/releases/20080619193605/log/ferret_index.log"
when the release I'm deploying is 20080621135622 ?

I have /shared/log/ferret_index.log, which is symlinked via shared/log
-> current/log.

When the deployment fails, the only thing left in 20080619193605 is
index/

The error is frustrating because it shows up in the middle of one of my
migrations...I thought all these tasks were synchronous:

$ cap deploy:cold

<snip>
 ** [out :: 207.xxx.xxx.xxx] == 28 AddAgeAndGender: migrating
==============================================
 ** [out :: 207.xxx.xxx.xxx] -- add_column(:people, :gender, :string,
{:limit=>1})
 ** [out :: 207.xxx.xxx.xxx] -> 0.1351s
 ** [out :: 207.xxx.xxx.xxx] -- add_index(:people, :gender)
 ** [out :: 207.xxx.xxx.xxx] -> 0.0884s
 ** [out :: 207.xxx.xxx.xxx] -- add_column(:people, :seeking_gen
*** [err :: 207.xxx.xxx.xxx] rake aborted!
*** [err :: 207.xxx.xxx.xxx] No such file or directory -
/home/mrichman/www/myapp/releases/20080619193605/log/ferret_index.log
*** [err :: 207.xxx.xxx.xxx]
*** [err :: 207.xxx.xxx.xxx] (See full trace by running task with
--trace)
 ** [out :: 207.xxx.xxx.xxx] der, :string, {:limit=>1})
 ** [out :: 207.xxx.xxx.xxx] -> 0.0698s
 ** [out :: 207.xxx.xxx.xxx] -- add_index(:people, :seeking_gender)
 ** [out :: 207.xxx.xxx.xxx] -> 0.0499s
 ** [out :: 207.xxx.xxx.xxx] -- add_column(:people, :birthdate, :date)
 ** [out :: 207.xxx.xxx.xxx] -> 0.0699s
 ** [out :: 207.xxx.xxx.xxx] -- add_index(:people, :birthdate)
 ** [out :: 207.xxx.xxx.xxx] -> 0.0499s
 ** [out :: 207.xxx.xxx.xxx] == 28 AddAgeAndGender: migrated (0.4638s)
=====================================
</snip>

I'm just trying to sort out the "No such file or directory" error which
is preventing me from deploying.

My Capistrano tasks look like:

after  "deploy:update_code", "db:symlink_config",
"ferret:server:copy_config", "ferret:index:symlink"
before "deploy:start", "ferret:server:start"
after  "deploy:stop", "ferret:server:stop"
after  "deploy:restart", "ferret:server:restart"

namespace :ferret do
  namespace :index do
    desc <<-DESC
An after_update_code task to symlink release/index to shared/index \
useful for maintaining a constant ferret index between deployments
DESC
    task :symlink, :role => :app do
      ferret.index.create
      run <<-CMD
rm -rf #{release_path}/index &&
ln -nfs #{shared_path}/index #{release_path}/index
CMD
    end

    desc "Creates the shared/index directory for persistent ferret
indexes"
    task :create, :role => :app do
      run "if [ ! -d #{shared_path}/index ]; then mkdir -p
#{shared_path}/index ; fi"
    end

    desc "Removes the contents of the shared/index directory"
    task :purge, :role => :app do
      run "if [ -d #{shared_path}/index ]; then rm -rf
#{shared_path}/index/* ; fi"
    end
  end # namespace :index

  namespace :server do
    desc "Configure ferret server"
    task :configure, :role => :app do
      config = {rails_env => {'port' => ferret_port,
                              'host' => ferret_host,
                              'pid_file' =>
"#{current_path}/log/ferret-#{rails_env}.pid"}}
      ferret_server_yml = config.to_yaml

      run "if [ ! -d #{shared_path}/config ]; then mkdir
#{shared_path}/config; fi"
      put(ferret_server_yml, "#{shared_path}/config/ferret_server.yml",
:mode => 0644)
    end

    desc "Copies the ferret_server.yml file to release_path/config"
    task :copy_config, :role => :app do
      on_rollback {
        puts "***** File shared/config/ferret_server.yml is missing.
Make sure you have run configure_ferret first. *****"
      }

      run "cp #{shared_path}/config/ferret_server.yml
#{release_path}/config/"
    end

    desc "Start ferret server"
    task :start, :role => :app do
      run "RAILS_ENV=#{rails_env} #{current_path}/script/runner
#{current_path}/script/ferret_start"
    end

    desc "Stop ferret server"
    task :stop, :role => :app do
      run "RAILS_ENV=#{rails_env} #{current_path}/script/runner
#{current_path}/script/ferret_stop"
    end

    desc "Restart ferret server"
    task :restart, :role => :app do
      ferret.server.stop
      sleep(5)
      ferret.server.start
    end
  end # namespace :server
end # namespace :ferret


Thanks,
Mark
This topic is locked and can not be replied to.