Я хочу развернуть сайт впервые, используя Rails 3.2.1 с capistrano 2.8.0.
Когда дело доходит до "rake db: migrate", процесс прерывается:
* executing `deploy:migrate'
* executing "cd /home/user/public_html/website.com/releases/20120323114534 && bundle exec rake RAILS_ENV=production db:migrate"
servers: ["23.11.63.203"]
[23.11.63.203] executing command
** [out :: 23.11.63.203] rake aborted!
** [out :: 23.11.63.203] No such file or directory - /home/user/public_html/website.com/releases/20120323114534/log/production.log
Я развертываю через github, вот соответствующая часть моего deploy.rb:
require 'bundler/capistrano'
require 'whenever/capistrano'
set :rails_env, 'production'
set :application, "website.com"
set :domain, "website.com"
set :user, "user"
set :sudo_use, false
set :repository, "git@github.com:User/website.com.git"
set :local_repository, '~/rails_projects/website.com/.git'
set :deploy_to, "/home/user/public_html/#{application}"
set :scm, :git
set :branch, "master"
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
server "23.11.63.203", :app, :web, :db, :primary => true
after "deploy", "deploy:bundle_gems"
after "deploy:bundle_gems", "deploy:restart"
after "deploy:update_code", "deploy:migrate"
namespace :deploy do
task :bundle_gems do
run "cd #{deploy_to}/current && bundle install vendor/gems"
end
...(there are some more tasks, but I think they cannot be relevant)
end
Я попробовал следующее в моем deploy.rb, но он не работал, так что, возможно, это неправильный способ решить эту проблему:
after "deploy", "deploy:create_production_log"
namespace :deploy do
desc "Creates the production log if it does not exist"
task :create_production_log do
unless File.exist?(File.join(shared_path, 'log', 'production.log'))
puts "\n\n=== Creating Production Log! ===\n\n"
run "touch #{File.join(shared_path, 'log', 'production.log')}"
end
end
end
Как я могу сделать свое первое развертывание в этом случае?