简体   繁体   中英

Capistrano: trying to run rake db:seed on remote server

I'm trying to run my seed file on a remote server using capistrano. My deploy is OK, so there is no issue there. Here is the code for running the seed file in config/deploy.rb

namespace :seed do
  desc "Run a task on a remote server."
  # run like: cap staging rake:invoke task=a_certain_task  
  task :default do
    run("cd #{deploy_to}/current; /usr/bin/env bundle exec rake #{ENV['db:seed']} RAILS_ENV=#{rails_env}")
  end
end

I am evoking this task by running 'cap seed'.

Whats weird is it looks like tests are running when I run this.. HERE is a snippet.

Maybe the problem is with #{ENV['db:seed']} part. Isn't it should be just db:seed. The eniviroment variable db:seed doesn't exist so You are calling a pure rake command.

Try this:

run("cd #{deploy_to}/current; /usr/bin/env bundle exec rake db:seed RAILS_ENV=#{rails_env}")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM