Capistorano部署SSHKit :: Runner :: ExecuteError:rake退出状态:1 错误日志 Gemfile Capfile deploy.rb Unicorn.rb

感谢您检查我的问题。
我的capistorano现在有错误。
几天来一直在处理此错误,因此请帮帮我。
我正在应用中使用active Storage。
密钥在/ etc / environment中。
以防万一,也要使用凭据。(AWS IAM密钥)
详细信息如下。
请告诉我是否需要更多信息,如果能帮助我,我非常感谢。
谢谢。

错误日志

00:12 deploy:assets:precompile
      01 $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile
#<Thread:0x00007fa8bc548e10@/Users/coro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sshkit-1.20.0/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
    1: from /Users/coro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sshkit-1.20.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/Users/coro/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sshkit-1.20.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as ec2-user@18.176.69.6: rake exit status: 1 (SSHKit::Runner::ExecuteError)
rake stdout: Nothing written
rake stderr: Nothing written
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as ec2-user@18.176.69.6: rake exit status: 1
rake stdout: Nothing written
rake stderr: Nothing written


Caused by:
SSHKit::Command::Failed: rake exit status: 1
rake stdout: Nothing written
rake stderr: Nothing written

Tasks: TOP => deploy:assets:precompile
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as ec2-user@18.176.69.6: rake exit status: 1
rake stdout: Nothing written
rake stderr: Nothing written


** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:

Gemfile

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.5.1'

# Bundle edge Rails instead: gem 'rails',github: 'rails/rails'
gem 'rails','~> 6.0.1'
# Use mysql as the database for active Record
gem 'mysql2','>= 0.4.4'
# Use Puma as the app server
gem 'puma','~> 4.1'
# Use SCSS for stylesheets
gem 'sass-rails','>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker','~> 4.0'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
# gem 'turbolinks','~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
# gem 'jbuilder','~> 2.7'
# Use active Model has_secure_password
# gem 'bcrypt','~> 3.1.7'

# Use active Storage variant
gem 'image_processing','~> 1.2'

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap','>= 1.4.2',require: false

group :development,:test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug',platforms: %i[mri mingw x64_mingw]
  gem 'capistrano'
  gem 'capistrano-rbenv'
  gem 'capistrano-bundler'
  gem 'capistrano-rails'
  gem 'capistrano3-unicorn'
end

group :development do
  # access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'listen','>= 3.0.5','< 3.2'
  gem 'web-console','>= 3.3.0'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'better_errors'
  gem 'binding_of_caller'
  gem 'rubocop',require: false
  gem 'spring'
  gem 'spring-watcher-listen','~> 2.0.0'
end

group :production do
  gem 'unicorn','5.4.1'
end

# Windows does not include zoneinfo files,so bundle the tzinfo-data gem
gem 'active_hash'
gem "aws-sdk-s3",require: false
gem "devise"
gem 'dotenv-rails'
gem 'font-awesome-sass'
gem 'mini_magick'
gem 'pry-rails'
gem 'tzinfo-data',platforms: %i[mingw mswin x64_mingw jruby]

Capfile

require "capistrano/setup"
require "capistrano/deploy"
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git

require "capistrano/rbenv"
require "capistrano/bundler"
require "capistrano/rails/assets"
require "capistrano/rails/migrations"
require 'capistrano3/unicorn'
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }

deploy.rb

lock '3.11.2'

set :application,'datingapp'

set :repo_url,'git@github.com:coro-from-Kyoto/DatingApp.git'

set :linked_dirs,fetch(:linked_dirs,[]).push('log','tmp/pids','tmp/cache','tmp/sockets','vendor/bundle','public/system','public/uploads')

set :rbenv_type,:user
set :rbenv_ruby,'2.5.1'

set :ssh_options,auth_methods: ['publickey'],keys: ['~/.ssh/DatingAppPort.pem'] 

set :unicorn_pid,-> { "#{shared_path}/tmp/pids/unicorn.pid" }

set :unicorn_config_path,-> { "#{current_path}/config/unicorn.rb" }
set :keep_releases,5

set :linked_files,fetch(:linked_files,[]).push("config/master.key")


after 'deploy:publishing','deploy:restart'
namespace :deploy do
  task :restart do
    invoke 'unicorn:restart'
  end
end

Unicorn.rb

app_path = File.expand_path('../../../',__FILE__)

worker_processes 1

working_directory "#{app_path}/current"

pid "#{app_path}/shared/tmp/pids/unicorn.pid"

listen "#{app_path}/shared/tmp/sockets/unicorn.sock"

stderr_path "#{app_path}/shared/log/unicorn.stderr.log"

stdout_path "#{app_path}/shared/log/unicorn.stdout.log"

timeout 60

preload_app true
GC.respond_to?(:copy_on_write_friendly=) && GC.copy_on_write_friendly = true

check_client_connection false

run_once = true

before_fork do |server,worker|
  defined?(activeRecord::Base) &&
    activeRecord::Base.connection.disconnect!

  if run_once
    run_once = false # prevent from firing again
  end

  old_pid = "#{server.config[:pid]}.oldbin"
  if File.exist?(old_pid) && server.pid != old_pid
    begin
      sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU
      Process.kill(sig,File.read(old_pid).to_i)
    rescue Errno::ENOENT,Errno::ESRCH => e
      logger.error e
    end
  end
end

after_fork do |_server,_worker|
  defined?(activeRecord::Base) && activeRecord::Base.establish_connection
end
chendian76 回答:Capistorano部署SSHKit :: Runner :: ExecuteError:rake退出状态:1 错误日志 Gemfile Capfile deploy.rb Unicorn.rb

似乎服务器连接突然断开。
可以检查服务器是否还有足够的磁盘空间吗?
还可以尝试在服务器中手动运行资产编译,看看会发生什么情况。

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Convert Link</title>
</head>
<body>
    <span id="demo"></span>
    
    <script>
    function convertLink(article) {

    var cArticle = "";
    cArticle = article.replace(/(?:(https?):\/\/)?(?:www\.)?(?:youtube\.com|youtu\.be)\/(?:watch\?v=)?([^\ \r\n]+)/g,'<div id="$2" class="anotherClass" onclick="someFunction(\'$2\',\'$2\');"><img class="some-class" src="https://i.ytimg.com/vi/$2/0.jpg"></div>').replace(/(?:(https?):\/\/)?(?:www\.)?(?:vimeo\.com)\/([^\ \r\n]+)/g,'<div class="video-container"><iframe src="//player.vimeo.com/video/$2" width="100%" height="480" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>').replace(/([\s+])@([^\s]+)/g," <a href='https:\/\/example.com/$2'>@$2</a>").replace(/([\r\n])/ig,"<br>").replace(/([\s+])#([^\s]+)/g," <a href='https:\/\/example.com/#2'>#$2</a>").replace(/([\r\n])/ig,"<br>").replace(/(\<br\>\<br\>)/,"<br>");

    return cArticle;

    }  
    
    var stringIs = "In this article,we will be talking about Some of the interesting facts like: Youtube Flutterhttps://www.youtube.com/watch?v=i-Qy1VQUMuI as well as https://example.com/images.jpg,https://vimeo.com/259411563 and #rain @stackoverflow more coming soon at https://example.com/link/me Let's talk.";
    document.getElementById("demo").innerHTML = convertLink(stringIs);
  </script>
</body>
</html>

※更改为分期或开发(取决于您的环境)。

,

我收到此错误是因为我没有在服务器上安装npmyarn

本文链接:https://www.f2er.com/2855913.html

大家都在问