【发布时间】:2015-07-22 07:00:37
【问题描述】:
我使用 capistrano 4.4、nginx、独角兽。当我部署时,我有这样的错误:
bin/cap 生产部署:检查工作正常。
当我第一次运行 bin/cap production deploy 时,出现错误:
...
[7e794b92] Cloning into bare repository
'opt/www/foreignernetwork/repo'...
INFO [7e794b92] Finished in 3.847 seconds with exit status 0 (successful).
DEBUG [19e30ae6] Running /usr/bin/env if test ! -d opt/www/foreignernetwork/repo; then echo "Directory does not exist 'opt/www/foreignernetwork/repo'" 1>&2; false; fi as deployuser@128.199.226.61
DEBUG [19e30ae6] Command: if test ! -d opt/www/foreignernetwork/repo; then echo "Directory does not exist 'opt/www/foreignernetwork/repo'" 1>&2; false; fi
DEBUG [19e30ae6] Directory does not exist 'opt/www/foreignernetwork/repo'
(Backtrace restricted to imported tasks)
cap aborted!
....
当我再次运行它时,它会说:
[4daafe62] Command: cd opt/www/foreignernetwork && ( GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/foreignernetwork/git-ssh.sh /usr/bin/env git clone --mirror https://github.com/KonstantinSmirnov/foreignernetwork.git opt/www/foreignernetwork/repo )
DEBUG [4daafe62] fatal: destination path 'opt/www/foreignernetwork/repo' already exists and is not an empty directory.
(Backtrace restricted to imported tasks)
cap aborted!
....
SSHKit::Command::Failed: git exit status: 128
git stdout: Nothing written
git stderr: fatal: destination path 'opt/www/foreignernetwork/repo' already exists and is not an empty directory.
....
如果我删除这个文件夹,它会再次重复。
这是我的文件:
部署.rb:
lock '3.4.0'
set :application, 'foreignernetwork'
set :repo_url, 'https://github.com/KonstantinSmirnov/foreignernetwork.git'
set :scm, 'git'
set :deploy_via, :copy
set :deploy_to, 'opt/www/foreignernetwork'
set :user, 'deployuser'
set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets}
set :ssh_options, { :forward_agent => true, :port => 12531 }
set :use_sudo, true
namespace :deploy do
%w[start stop restart].each do |command|
desc 'Manage Unicorn'
task command do
on roles(:app), in: :sequence, wait: 1 do
execute "/etc/init.d/unicorn_#{fetch(:application)} #{command}"
end
end
end
after :publishing, :restart
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
# Here we can anything such as:
# within release_path do
# execute :rake, 'cache:clear'
# end
end
end
end
生产.rb:
role :app, %w{deployuser@128.199.226.61}
role :web, %w{deployuser@128.199.226.61}
role :db, %w{deployuser@128.199.226.61}
独角兽.rb:
root = "/opt/www/foreignernetwork/current"
working_directory root
pid "#{root}/tmp/pids/unicorn.pid"
stderr_path "#{root}/log/unicorn.log"
stdout_path "#{root}/log/unicorn.log"
listen "/tmp/unicorn.foreignernetwork.sock"
worker_processes 1
timeout 30
请你帮我弄清楚如何解决它?已经把所有东西都挖出来了……
【问题讨论】:
-
您能否检查this 的帖子是否回答了您的问题?
-
不,我已经检查过了,我没有加倍..
-
将尝试从头开始做所有事情
标签: ruby-on-rails github capistrano3