Capistrano“上限生产部署”每次都在不同的步骤失败?

时间:2021-04-20 18:28:04

标签: ruby-on-rails ruby git ubuntu capistrano

我有一个 Ubuntu 18.04 服务器,我想将我的应用程序部署到它。 我一直在与 Capistrano 斗争几个小时。每当我修复某个错误时,它就会越过该错误,提示一个新错误,并且(很多次)因之前解决的错误而失败。有时它只运行 5 个步骤,然后在新的一个步骤中失败。

如果我的配置有错误,我不会经常陷入同样的​​错误吗?是否可能是服务器容量问题? (RAM、磁盘等?)

磁盘:

mr2552@ip-10-5-121-225:~$ df -h /
Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme0n1p1   49G  3.0G   46G   7% /

内存:

mr2552@ip-10-5-121-225:~$ free -h
              total        used        free      shared  buff/cache   available
Mem:           3.8G        172M        3.2G         12M        482M        3.4G
Swap:            0B          0B          0B

大部分错误都包括这两个句子:

mkdir stdout: Nothing written
mkdir stderr: Nothing written

这是最常见的错误:

SSHKit::Runner::ExecuteError: Exception while executing as mr2552@10.5.121.225: mkdir exit

在出现上一个错误的情况下尝试 5 次后,没有文件或代码更改,也没有重新启动服务器:

Git clone directory already exists

于是我进入服务器并自己删除了克隆的文件夹,并进一步前进了几步,结果却崩溃了 "Directory does not exist '/var/www/CRISPR_Citrus/repo'" 再次运行 cap production deploy 重复了错误,所以我去了服务器并创建了一个空的 repo 文件夹,并收到:

A very similar error to the first ones 还有几个same errors

直到第 4 次尝试显示

repo does not exist


我疯了吗?

来自服务器的 SSH 密钥在 repo 的 Deploy Keys 部分配置。

这些是我的文件:

#config/deploy.rb
# config valid for current version and patch releases of Capistrano
lock "~> 3.16.0"

set :application, "CRISPR_Citrus"
set :repo_url, "git@github.com:cratag/crisprcitrus.git"

set :tmp_dir, "/home/mr2552/tmp"

set :chruby_ruby, 'ruby 3.0.0p0'

SSHKit.config.command_map[:env] = '/usr/bin/env'
# config/deploy/production.rb
# server-based syntax
# ======================
# Defines a single server with a list of roles and multiple properties.
# You can define all roles on a single server, or split them:

# server "example.com", user: "deploy", roles: %w{app db web}, my_property: :my_value
# server "example.com", user: "deploy", roles: %w{app web}, other_property: :other_value
# server "db.example.com", user: "deploy", roles: %w{db}

server '10.5.121.225', user: 'mr2552', roles: %w{app db web}
...
#Capfile.rb

# Load DSL and set up stages
require "capistrano/setup"

# Include default deployment tasks
require "capistrano/deploy"

# Load the SCM plugin appropriate to your project:
#
# require "capistrano/scm/hg"
# install_plugin Capistrano::SCM::Hg
# or
# require "capistrano/scm/svn"
# install_plugin Capistrano::SCM::Svn
# or
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git

# Include 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
#   https://github.com/capistrano/passenger
#
# require "capistrano/rvm"
# require "capistrano/rbenv"
# require "capistrano/chruby"
# require "capistrano/bundler"
# require "capistrano/rails/assets"
# require "capistrano/rails/migrations"
# require "capistrano/passenger"

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

require 'capistrano/rails'
require 'capistrano/chruby'

0 个答案:

没有答案
相关问题