[英]rails capistrano deployment error
我已經安裝了capistrano和gem capistrano
在我的應用程序目錄中,我安裝了cap install
此命令包括deploy/production.rb
和deploy/staging.rb
config/deploy.rb
以及config/deploy.rb
我的production.rb
文件有以下內容
set :stage, :production
role :all, %w{seting@mydomain.com}
server 'sub.mydomain.com', user: 'deploy', roles: %w{web app}, my_property: :my_value
set :ssh_options, { :forward_agent => true, :port => 1754, :keys => %w(/home/seting/.ssh/id_rsa) }
這是我的deploy.rb
set :application, 'admin'
set :repo_url, 'git@bitbucket.org:username/myadmin.git'
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
# Your restart mechanism here, for example:
# execute :touch, release_path.join('tmp/restart.txt')
end
end
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
# Here we can do anything such as:
# within release_path do
# execute :rake, 'cache:clear'
# end
end
end
after :finishing, 'deploy:cleanup'
end
最后當我運行cap production deploy
得到錯誤
cap aborted!
seting
/home/seting/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh.rb:215:in `start'
/home/seting/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:156:in `ssh'
/home/seting/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:68:in `upload!'
/home/seting/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-3.0.0/lib/capistrano/tasks/git.rake:11:in `block (3 levels) in <top (required)>'
/home/seting/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:42:in `instance_exec'
/home/seting/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:42:in `run'
/home/seting/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => git:check => git:wrapper
(See full trace by running task with --trace)
編輯 - 1
另外,我沒有在我的服務器中進行任何特殊安裝來運行rails應用程序。 我已決定先將文件移到服務器上。 這是對的嗎?
您應該設置角色名稱deploy而不是seting或其他方式。
set :stage, :production
set :branch, 'master'
set :deploy_to, '/srv/www/server.com/'
role :all, %w{deploy@server.com}
server 'server.com', user: 'deploy', roles: %w{web app}, my_property: :my_value
fetch(:default_env).merge!(rails_env: :production)
這是指南
你可能想跑
cap production deploy:check
檢查你的配置。
在capistrano 3.0中也沒有部署:設置
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.