Hey Scott,
1. I don't see any problem with just killing the process, if it's
running, and then do a migrate and start (not restart).
2. I think you might need to create the link to database.yml earlier, in
the :after_update_code task. I think what is happening is that the
migrations are being run before the link is created since you don't do
that till your start/restart. Here's the capistrano task:
task :migrations do
set :migrate_target, :latest
update_code
migrate
symlink
restart
end
Regards,
Kerry
Scott Olmsted wrote:
>
> This is my first experience with Capistrano. I made some changes to an
> existing Rails site that already had Subversion and Capistrano in
> place, checked them into Subversion, and ran 'cap deploy:check'
> successfully. But 'cap deploy:migrations' produced an error:
>
> ** [out :: xx.xxx.xxx.xxx] rake aborted!
> ** [out :: xx.xxx.xxx.xxx] No such file or directory -
> /home/wwwfine/projects/fgc/releases/20080919185053/config/database.yml
>
> even though a quick check shows that database.yml in that location was
> successfully created as a symbolic link from the shared location of
> database.yml earlier in the script. Otherwise, the new release seems
> to have been set up properly.
>
> So I tried 'cap deploy:stop', figuring that I'd run the migration
> manually and then restart, but got
>
> * executing
> "/home/wwwfine/projects/fgc/current/script/process/reaper -a kill"
> servers: ["xx.xxx.xxx.xxx"]
> [xx.xxx.xxx.xxx] executing command
> ** [out :: xx.xxx.xxx.xxx] Couldn't find any pid file in
> '/home/wwwfine/projects/fgc/releases/20080919185053/tmp/pids' matching
> 'dispatch.[0-9]*.pid'
>
> Indeed, that directory is empty, so no processes were killed and the
> app is still running.
>
> First, can I just kill the ruby/mongrel process myself, run the rake
> migration, and then use Capistrano to restart?
>
> Second, any ideas about how to fix these problems? Should I just take
> this to the Capistrano forum?
>
> Below are the files deploy.rb and Capfile.
>
> Thanks.
>
> Scott
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> set :domain, "xx.xxx.xxx.xxx"
> set :user, "wwwfine"
> set :application, "fgc"
> set :mongrel_port, "4110"
>
> set :rails_env, :production
> set :deploy_to, "/home/#{user}/projects/#{application}"
> set :chmod755, "projects config db lib public vendor script script/*"
> # Some files that will need proper permissions
> set :use_sudo, false
> set :svn_user, "wwwfine"
> set :svn_password, "xxxxxxxxx"
> set :repository, Proc.new { "--username #{svn_user} " + "--password
> #{svn_password} " +
> "svn+ssh://[EMAIL PROTECTED]/home/wwwfine/svn/fgc/trunk" }
> set :keep_releases, 10
>
> default_run_options[:pty] = true
> #set :repository, " http://svn.#{domain}/svn/#{application}/trunk
> <http://svn./#%7Bdomain%7D/svn/#%7Bapplication%7D/trunk>"
>
> #latest one for capistrano 2.0
> #set :repository,
> "svn+ssh://[EMAIL PROTECTED]/home/#{user}/svn/#{application}/trunk" #
> The repository location for svn+ssh access
>
> # If you aren't deploying to /u/apps/#{application} on the target
> # servers (which is the default), you can specify the actual location
> # via the :deploy_to variable:
> # set :deploy_to, "/var/www/#{application}"
>
> # If you aren't using Subversion to manage your source code, specify
> # your SCM below:
> # set :scm, :subversion
>
> role :web, domain
> role :app, domain
> role :db, domain, :primary => true
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> load 'deploy' if respond_to?(:namespace) # cap2 differentiator
> load 'config/deploy'
>
> # ========================
> # For Mongrel Apps
> # ========================
>
> namespace :deploy do
>
> task :start, :roles => :app do
> run "ln -s #{shared_path}/config/database.yml
> #{current_path}/config/database.yml"
> run "rm -rf /home/#{user}/public_html;ln -s
> #{current_path}/public /home/#{user}/public_html"
> run "cd #{current_path} && mongrel_rails start -e
> production -p #{mongrel_port} -d"
> end
>
> task :restart, :roles => :app do
> run "ln -s #{shared_path}/config/database.yml
> #{current_path}/config/database.yml"
>
> run "cd #{current_path} && mongrel_rails stop"
> run "cd #{current_path} && mongrel_rails start -e
> production -p #{mongrel_port} -d"
>
> # run "cd #{current_path} && mongrel_rails restart"
> # run "cd #{current_path} && chmod 755 #{chmod755}"
> end
>
> task :after_update_code, :roles => :app do
> %w{media}.each do |share|
> run "rm -rf #{release_path}/public/images/#{share}"
> run "mkdir -p #{shared_path}/system/images/#{share}"
> run "ln -nfs #{shared_path}/system/images/#{share}
> #{release_path}/public/images/#{share}"
> end
>
> # link upload path
> run "rm -rf #{release_path}/public/uploads"
> run "mkdir -p #{shared_path}/system/uploads"
> run "ln -nfs #{shared_path}/system/uploads
> #{release_path}/public/uploads"
>
>
> # Or run: cap deploy:cleanup
> #cleanup
> end
>
> end
>
>
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
-~----------~----~----~----~------~----~------~--~---