Capistrano 3无法部署,并显示此错误SSHKit :: Command :: Failed:rake stdout:Noth写]]

问题描述 投票:0回答:3

我使用了rails 4和Capistrano3。在耙资产期间,我与Capistrano进行的解聚失败时:预编译并显示以下错误

 INFO [1c9c2531] Running ~/.rvm/bin/rvm default do bundle exec rake assets:precompile on 107.170.67.113
cap aborted!
SSHKit::Command::Failed: rake stdout: Nothing written
rake stderr: Nothing written

Tasks: TOP => deploy:assets:precompile
(See full trace by running task with --trace)

我是Rails和服务器设置的新手,所以我想念哪里?我不知道

这里是我的depoly.rb

SSHKit.config.command_map[:rake] ||= "bundle exec rake"

# config valid only for Capistrano 3.1
lock '3.0.1'


set :application, 'PCA'
set :repo_url, '[email protected]:3lackRos3/pca.git'

# Default branch is :master
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call

# Default deploy_to directory is /var/www/my_app
 set :deploy_to, '/home/pca/app/pca'
 set :deploy_user, 'pca'

 set :rvm_ruby_string, ENV['GEM_HOME'].gsub(/.*\//,"")
 set :rvm_type, :user
 set :rvm_bin_path, '/usr/local/rvm/bin'


#  set :default_environment, {
#   'RBENV_ROOT' => '/usr/local/rbenv',
#   'PATH' => "/usr/local/rbenv/shims:/usr/local/rbenv/bin:$PATH"
# }

# set :default_environment, {
#   'PATH' => "$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH"
# }
# set :rbenv_ruby, "2.1.1"

 #    set :rbenv_ruby_dir, -> { "#{fetch(:rbenv_path)}/versions/#{fetch(:rbenv_ruby)}" }
 #    set :rbenv_map_bins, %w{rake gem bundle ruby rails}
# Default value for :scm is :git
 set :scm, :git
 set :ssh_options, { forward_agent: true }
 #set :ssh_options, proxy: Net::SSH::Proxy::Command.new('ssh  [email protected]  -W %h:%p')

# Default value for :format is :pretty
# set :format, :pretty

set :log_level, :info
# Default value for :log_level is :debug
# set :log_level, :debug

# Default value for :pty is false
set :pty, true


# Default value for :linked_files is []
# set :linked_files, %w{config/database.yml}

# Default value for linked_dirs is []
 set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}




 # SSHKit.config.command_map[:rake].sub!(/\(.*\)rake/, "\1bundle exec rake")

# Default value for default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }

# Default value for keep_releases is 5
# set :keep_releases, 20
after "deploy", "deploy:cleanup"

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 :publishing, :restart

  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

这里是我的capfile

# Load DSL and Setup Up Stages
require 'capistrano/setup'

# Includes default deployment tasks
require 'capistrano/deploy'
#require 'rvm1/capistrano3'
#require 'capistrano/rvm'
# Includes tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
#
#   https://github.com/capistrano/rvm
#   https://github.com/capistrano/rbenv
#   https://github.com/capistrano/chruby
#   https://github.com/capistrano/bundler
#   https://github.com/capistrano/rails
#
require 'capistrano/rvm'
# require 'capistrano/rbenv'
# require 'capistrano/chruby'
 require 'capistrano/bundler'
 require 'capistrano/rails/assets'
 require 'capistrano/rails/migrations'
 require 'capistrano/rails'

# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

我已运行bundle exec cap生产deploy:check和我的输出是

  INFO [ecf1a980] Running /usr/bin/env mkdir -p /tmp/PCA/
  INFO [ecf1a980] Finished in 4.848 seconds with exit status 0 (successful).
  INFO Uploading /tmp/PCA/git-ssh.sh 100.0%
  INFO [8e7210f6] Running /usr/bin/env chmod +x /tmp/PCA/git-ssh.sh on serverip
  INFO [8e7210f6] Finished in 0.639 seconds with exit status 0 (successful).
  INFO [4c538c51] Running /usr/bin/env mkdir -pv /home/pca/app/pca/shared /home/pca/app/pca/releases
 INFO [4c538c51] Finished in 4.480 seconds with exit status 0 (successful).
 INFO [d6a7dce6] Running /usr/bin/env mkdir -pv /home/pca/app/pca/shared/bin /home/pca/app/pca/shared/log /home/pca/app/pca/shared/tmp/pids /home/pca/app/pca/shared/tmp/cache /home/pca/app/pca/shared/tmp/sockets /home/pca/app/pca/shared/vendor/bundle /home/pca/app/pca/shared/public/system
 INFO [d6a7dce6] Finished in 4.507 seconds with exit status 0 (successful).

有人帮助我..

谢谢!

我使用过Rails 4和Capistrano 3。 >

确保在gits受信任密钥中包括正在进行部署的服务器的ssh密钥。

似乎是由于缺少内存而导致预编译过程终止。尝试创建交换内存。查看this教程

我有同样的问题,在运行(部署)Cap Production部署时出现错误rake stderr: Nothing written

原来是由于内存不足,我有一台1G内存服务器,因此“解决方案是创建交换内存”。对我来说,创建2G交换内存可以解决该问题。现在,部署将继续并完成,没有任何错误。

ruby-on-rails-4 capistrano3
3个回答
0
投票

确保在gits受信任密钥中包括正在进行部署的服务器的ssh密钥。


0
投票

似乎是由于缺少内存而导致预编译过程终止。尝试创建交换内存。查看this教程


0
投票

我有同样的问题,在运行(部署)Cap Production部署时出现错误rake stderr: Nothing written

原来是由于内存不足,我有一台1G内存服务器,因此“解决方案是创建交换内存”。对我来说,创建2G交换内存可以解决该问题。现在,部署将继续并完成,没有任何错误。

© www.soinside.com 2019 - 2024. All rights reserved.