不确定Capistrano正在尝试做什么或出了什么问题。我已经使用用户“deploy4”在我的服务器上设置了文件和文件夹权限,并在此处提及了所有必要的内容:
我已经尝试了所有其他的解决方法,但没有任何作用,我也尝试了同样的移动我的web目录到deploy4主页而不是服务器“/ var / www /”,仍然发生相同的错误。我也有.gitignore
数据库和secrets.yml文件。
同样的问题适用于secrets.yml
文件
Rails:5.0.0.1,Ruby:2.3.1,Capistrano:3.6.1
Capistrano日志:
**********@**********:~/Documents/**********/group4$ cap production deploy --trace
** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke rbenv:validate (first_time)
** Invoke rbenv:install (first_time)
** Execute rbenv:install
** Invoke rbenv:install_rbenv (first_time)
** Execute rbenv:install_rbenv
** Invoke rbenv:install_ruby_build (first_time)
** Execute rbenv:install_ruby_build
** Invoke rbenv:install_ruby (first_time)
** Execute rbenv:install_ruby
** Invoke rbenv:install_bundler (first_time)
** Invoke rbenv:map_bins (first_time)
** Invoke passenger:rbenv:hook (first_time)
** Invoke passenger:test_which_passenger (first_time)
** Execute passenger:test_which_passenger
** Execute passenger:rbenv:hook
** Execute rbenv:map_bins
** Execute rbenv:install_bundler
** Execute rbenv:validate
** Invoke rbenv:map_bins
** Invoke bundler:map_bins (first_time)
** Invoke passenger:bundler:hook (first_time)
** Execute passenger:bundler:hook
** Execute bundler:map_bins
** Invoke deploy:set_rails_env (first_time)
** Execute deploy:set_rails_env
** Invoke deploy:set_linked_dirs (first_time)
** Execute deploy:set_linked_dirs
** Invoke deploy:set_rails_env
** Invoke deploy (first_time)
** Execute deploy
** Invoke deploy:starting (first_time)
** Execute deploy:starting
** Invoke deploy:check (first_time)
** Execute deploy:check
** Invoke git:check (first_time)
** Invoke git:wrapper (first_time)
** Execute git:wrapper
00:00 git:wrapper
01 mkdir -p /tmp
✔ 01 deploy4@********** 0.011s
✔ 01 deploy4@********** 0.013s
Uploading /tmp/git-ssh-group4-production-**********.sh 100.0%
Uploading /tmp/git-ssh-group4-production-**********.sh 100.0%
02 chmod 700 /tmp/git-ssh-group4-production-**********.sh
✔ 02 deploy4@********** 0.011s
✔ 02 deploy4@********** 0.012s
** Execute git:check
00:00 git:check
01 git ls-remote --heads git@**********.git
01 7651cd0265b7494eb5b16e47d056e3f9a52795cc refs/heads/master
01 7651cd0265b7494eb5b16e47d056e3f9a52795cc refs/heads/master
✔ 01 deploy4@********** 4.835s
✔ 01 deploy4@********** 4.836s
** Invoke deploy:check:directories (first_time)
** Execute deploy:check:directories
00:04 deploy:check:directories
01 mkdir -p /var/www/web/group4/shared /var/www/web/group4/releases
✔ 01 deploy4@********** 0.012s
✔ 01 deploy4@********** 0.013s
** Invoke deploy:check:linked_dirs (first_time)
** Execute deploy:check:linked_dirs
00:04 deploy:check:linked_dirs
01 mkdir -p /var/www/web/group4/shared/log /var/www/web/group4/shared/tmp/pids /var/www/web/group4/shared/tmp…
✔ 01 deploy4@********** 0.022s
✔ 01 deploy4@********** 0.021s
** Invoke deploy:check:make_linked_dirs (first_time)
** Execute deploy:check:make_linked_dirs
00:04 deploy:check:make_linked_dirs
01 mkdir -p /var/www/web/group4/shared/config
✔ 01 deploy4@********** 0.011s
✔ 01 deploy4@********** 0.011s
** Invoke deploy:check:linked_files (first_time)
** Execute deploy:check:linked_files
** Invoke deploy:set_previous_revision (first_time)
** Execute deploy:set_previous_revision
** Invoke deploy:started (first_time)
** Execute deploy:started
** Invoke secrets_yml:secrets_yml_symlink (first_time)
** Execute secrets_yml:secrets_yml_symlink
** Invoke deploy:updating (first_time)
** Invoke deploy:new_release_path (first_time)
** Execute deploy:new_release_path
** Execute deploy:updating
** Invoke git:create_release (first_time)
** Invoke git:update (first_time)
** Invoke git:clone (first_time)
** Invoke git:wrapper
** Execute git:clone
00:05 git:clone
The repository mirror is at /var/www/web/group4/repo
The repository mirror is at /var/www/web/group4/repo
** Execute git:update
00:05 git:update
01 git remote update --prune
01 Fetching origin
01 Fetching origin
✔ 01 deploy4@********** 4.824s
✔ 01 deploy4@********** 4.821s
** Execute git:create_release
00:09 git:create_release
01 mkdir -p /var/www/web/group4/releases/20160918214854
✔ 01 deploy4@********** 0.012s
02 git archive master group4 | tar -x --strip-components 1 -f - -C /var/www/web/group4/releases/20160918214854
✔ 01 deploy4@********** 0.012s
✔ 02 deploy4@********** 0.033s
✔ 02 deploy4@********** 0.034s
** Invoke deploy:set_current_revision (first_time)
** Execute deploy:set_current_revision
** Invoke git:set_current_revision (first_time)
** Execute git:set_current_revision
00:09 git:set_current_revision
01 echo "7651cd0265b7494eb5b16e47d056e3f9a52795cc" >> REVISION
✔ 01 deploy4@********** 0.011s
✔ 01 deploy4@********** 0.012s
** Invoke deploy:symlink:shared (first_time)
** Execute deploy:symlink:shared
** Invoke deploy:symlink:linked_files (first_time)
** Execute deploy:symlink:linked_files
00:09 deploy:symlink:linked_files
01 mkdir -p /var/www/web/group4/releases/20160918214854/config
✔ 01 deploy4@********** 0.011s
✔ 01 deploy4@********** 0.014s
02 rm /var/www/web/group4/releases/20160918214854/config/database.yml
✔ 02 deploy4@********** 0.011s
03 ln -s /var/www/web/group4/shared/config/database.yml /var/www/web/group4/releases/20160918214854/config/da…
02 rm: cannot remove '/var/www/web/group4/releases/20160918214854/config/database.yml': No such file or direc…
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy4@**********: rm exit status: 1
rm stdout: Nothing written
rm stderr: rm: cannot remove '/var/www/web/group4/releases/20160918214854/config/database.yml': No such file or directory
/home/**********/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.3/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute'
/home/**********/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.3/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
SSHKit::Command::Failed: rm exit status: 1
rm stdout: Nothing written
rm stderr: rm: cannot remove '/var/www/web/group4/releases/20160918214854/config/database.yml': No such file or directory
/home/**********/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.3/lib/sshkit/command.rb:100:in `exit_status='
/home/**********/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.3/lib/sshkit/backends/netssh.rb:148:in `execute_command'
/home/**********/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.3/lib/sshkit/backends/abstract.rb:141:in `block in create_command_and_execute'
/home/**********/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.3/lib/sshkit/backends/abstract.rb:141:in `tap'
/home/**********/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.3/lib/sshkit/backends/abstract.rb:141:in `create_command_and_execute'
/home/**********/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.3/lib/sshkit/backends/abstract.rb:74:in `execute'
/home/**********/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/capistrano-3.6.1/lib/capistrano/tasks/deploy.rake:143:in `block (5 levels) in <top (required)>'
/home/**********/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/capistrano-3.6.1/lib/capistrano/tasks/deploy.rake:139:in `each'
/home/**********/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/capistrano-3.6.1/lib/capistrano/tasks/deploy.rake:139:in `block (4 levels) in <top (required)>'
/home/**********/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.3/lib/sshkit/backends/abstract.rb:29:in `instance_exec'
/home/**********/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.3/lib/sshkit/backends/abstract.rb:29:in `run'
/home/**********/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sshkit-1.11.3/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => deploy:symlink:linked_files
The deploy has failed with an error: Exception while executing as deploy4@**********: rm exit status: 1
rm stdout: Nothing written
rm stderr: rm: cannot remove '/var/www/web/group4/releases/20160918214854/config/database.yml': No such file or directory
** Invoke deploy:failed (first_time)
** Execute deploy:failed
** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:
DEBUG [6bf2cf17] Command: [ -L /var/www/web/group4/releases/20160918214854/config/database.yml ]
INFO [ce01eb8c] Finished in 0.014 seconds with exit status 0 (successful).
DEBUG [1aa31b6f] Running [ -L /var/www/web/group4/releases/20160918214854/config/database.yml ] as deploy4@**********
DEBUG [1aa31b6f] Command: [ -L /var/www/web/group4/releases/20160918214854/config/database.yml ]
DEBUG [6bf2cf17] Finished in 0.007 seconds with exit status 1 (failed).
DEBUG [d065dc4b] Running [ -f /var/www/web/group4/releases/20160918214854/config/database.yml ] as deploy4@**********
DEBUG [d065dc4b] Command: [ -f /var/www/web/group4/releases/20160918214854/config/database.yml ]
DEBUG [1aa31b6f] Finished in 0.007 seconds with exit status 1 (failed).
DEBUG [a8a079de] Running [ -f /var/www/web/group4/releases/20160918214854/config/database.yml ] as deploy4@**********
DEBUG [a8a079de] Command: [ -f /var/www/web/group4/releases/20160918214854/config/database.yml ]
DEBUG [d065dc4b] Finished in 0.007 seconds with exit status 0 (successful).
INFO [c01dbafb] Running /usr/bin/env rm /var/www/web/group4/releases/20160918214854/config/database.yml as deploy4@**********
DEBUG [c01dbafb] Command: ( export BAZOOKA_USER="**********" http_proxy="**********" https_proxy="**********" ftp_proxy="**********" rsync_proxy="**********" no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com" HTTP_PROXY="" HTTPS_PROXY="" FTP_PROXY="" RSYNC_PROXY="" NO_PROXY="" RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.3.1" ; /usr/bin/env rm /var/www/web/group4/releases/20160918214854/config/database.yml )
DEBUG [a8a079de] Finished in 0.007 seconds with exit status 0 (successful).
INFO [4c6e0f98] Running /usr/bin/env rm /var/www/web/group4/releases/20160918214854/config/database.yml as deploy4@**********
DEBUG [4c6e0f98] Command: ( export BAZOOKA_USER="**********" http_proxy="**********" https_proxy="**********" ftp_proxy="**********" rsync_proxy="**********" no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com" HTTP_PROXY="" HTTPS_PROXY="" FTP_PROXY="" RSYNC_PROXY="" NO_PROXY="" RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.3.1" ; /usr/bin/env rm /var/www/web/group4/releases/20160918214854/config/database.yml )
INFO [c01dbafb] Finished in 0.011 seconds with exit status 0 (successful).
INFO [67264213] Running /usr/bin/env ln -s /var/www/web/group4/shared/config/database.yml /var/www/web/group4/releases/20160918214854/config/database.yml as deploy4@**********
DEBUG [67264213] Command: ( export BAZOOKA_USER="**********" http_proxy="**********" https_proxy="**********" ftp_proxy="**********" rsync_proxy="**********" no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com" HTTP_PROXY="" HTTPS_PROXY="" FTP_PROXY="" RSYNC_PROXY="" NO_PROXY="" RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.3.1" ; /usr/bin/env ln -s /var/www/web/group4/shared/config/database.yml /var/www/web/group4/releases/20160918214854/config/database.yml )
DEBUG [4c6e0f98] rm: cannot remove '/var/www/web/group4/releases/20160918214854/config/database.yml': No such file or directory
config / deploy.rb文件:
# Config valid only for current version of Capistrano
lock '3.6.1'
#Set app details
set :application, 'group4'
set :repo_url, 'git@**********'
#For restarting Apache
set :passenger_restart_with_touch, true
# Default branch is :master
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp
set :stages,['production']
set :default_stage, 'production'
set :user, 'deploy4'
set :branch, 'master'
# Default deploy_to directory is /var/www/my_app_name
set :deploy_to, '/var/www/web/group4'
# Default value for :scm is :git
set :scm, :git
#Set Ruby versions
set :rbenv_type, :user
set :rbenv_ruby, '2.3.1'
set :repo_tree, 'group4'
# Default value for :format is :airbrussh.
# set :format, :airbrussh
# You can configure the Airbrussh format using :format_options.
# These are the defaults.
# set :format_options, command_output: true, log_file: 'log/capistrano.log', color: :auto, truncate: :auto
# Default value for :pty is false
# set :pty, true
# Default value for :linked_files is []
#append :linked_files, 'config/database.yml', 'config/secrets.yml'
set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml')
# Default value for linked_dirs is []
#append :linked_dirs, 'log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'public/system'
set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system')
# Default value for default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
# Default value for keep_releases is 5
set :keep_releases, 5
config / deploy / production.rb文件:
# Role-based syntax
role :app, %w{deploy4@**********}
role :web, %w{deploy4@**********}
role :db, %w{deploy4@**********}, :primary => true
# Configurations
set :branch, 'master'
set :rails_env, "production"
set :deploy_to, "/var/www/web/group4"
set :default_env,{
'BAZOOKA_USER' => ENV['BAZOOKA_USER'],
"http_proxy" => "**********",
"https_proxy" => "**********",
"ftp_proxy" => "**********",
"rsync_proxy" => "**********",
"no_proxy" => "localhost,127.0.0.1,localaddress,.localdomain.com",
"HTTP_PROXY" => $http_proxy,
"HTTPS_PROXY" => $https_proxy,
"FTP_PROXY" => $ftp_proxy,
"RSYNC_PROXY" => $rsync_proxy,
"NO_PROXY" => $no_proxy
}
# Custom SSH Options
server '**********',
user: 'deploy4',
roles: %w{web app db},
ssh_options: {
user: 'deploy4',
keys: %w(/home/**********/.ssh/id_rsa),
forward_agent: true,
auth_methods: %w(publickey password),
password: '**********'
}
答案 0 :(得分:0)
我经常在以下两种情况之一中看到这一点:
/var/www/web/group4/shared/config/database.yml
?/var/www/web/group4/shared/config/database.yml
是不存在的文件(或相对符号链接)的符号链接吗?