加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails-3 – Capistrano首次部署由于缺少development.log

发布时间:2020-12-17 07:09:47 所属栏目:百科 来源:网络整理
导读:我想第一次使用带有capistrano 2.8.0的Rails 3.2.1部署一个网站. 当谈到“rake db:migrate”时,进程将中止: * executing `deploy:migrate'* executing "cd /home/user/public_html/website.com/releases/20120323114534 bundle exec rake RAILS_ENV=produc
我想第一次使用带有capistrano 2.8.0的Rails 3.2.1部署一个网站.

当谈到“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 "nn=== Creating Production Log! ===nn"
      run "touch #{File.join(shared_path,'production.log')}"
    end
  end

end

在这种情况下,我该如何进行首次部署?

解决方法

你是否进行了帽子部署:设置并进行了帽子部署:检查告诉你一切正常吗?

否则,我会说这是因为日志目录不存在,可能是因为你没有版本控制

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读