4
我想部署一个网站第一次使用Rails 3.2.1与capistrano 2.8.0。Capistrano第一次部署doens't工作,由于缺少development.log文件
当谈到 “耙分贝:迁移” 的过程被中止:
* 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, "[email protected]: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
在这种情况下,我该如何进行第一次部署?
谢谢,这让我在正确的轨道。在部署cap之后:setup和cap:deploy:check(这是好的)现在错误有点不同了(Permission denied - /home/user/public_html/website.com/releases/20120323132001/log/production.log)。这很容易解决chown ... – user929062 2012-03-23 14:00:11