我正在尝试使用一些教程来设置Capistrano。我从这个http://guides.beanstalkapp.com/deployments/deploy-with-capistrano.html开始,然后发布了它已经过时的版本,所以我转到了这个https://www.zodiacmedia.co.uk/blog/capistrano-3-tutorial-series-part-3
我在Windows中尝试使用babun,但它无法正确支持ruby / gem,因此我被迫通过Windows PowerShell进行操作。我有Capistrano 3.11.0,Ruby 2.6.3p62和Gem 3.0.3
我遇到一个问题,我会收到关于找不到env文件的错误,因此我遵循了/usr/bin/env ruby no such file or directory: Using capistrano 3, capistrano/rbenv, capistrano/bundler and capistrano/rails (using rails 4)
我跑步时
cap staging svn:check
它给我一个错误提示
/usr/bin/env: svn: No such file or directory
如果我包括
require "capistrano/rvm"
将其添加到捆绑包并安装后,出现此错误
Command: ~/.rvm/bin/rvm version
DEBUG [9986eaa0] bash: /root/.rvm/bin/rvm: No such file or directory
我的Capfile
# 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 }
我的deploy.rb
# config valid for current version and patch releases of Capistrano
# lock "~> 3.11.0"
set :application, "my_app"
set :repo_url, "http:my.svn.address:85/svn/repository"
set :ssh_options, {
user: 'root'
}
set :rvm_path, '/usr/local/rvm'
set :format, :pretty
set :log_level, :debug
set :keep_releases, 5
namespace :deploy do
after :finishing, 'deploy:cleanup'
end
我的staging.rb
set :stage, :staging
server 'my.server.com', roles: %w{web app db}, port: 22
# role :app, %w{myflexdev.cosairus.com}
# role :web, %w{myflexdev.cosairus.com}
# role :db, %w{myflexdev.cosairus.com}
set :application, 'app'
set :repo_url, 'http:my.svn.address:85/svn/repository/Branches'
set :branch, 'Staging'
set :deploy_to, '/var/www/my_server/public_html/staging'
set :ssh_options, {
forward_agent: false,
user: 'root',
keys: %w(C:/Users/usr/.babun/cygwin/home/usr/.ssh/id_rsa)
}
如果您有任何建议,请告诉我,我会尝试的。希望我可以使其执行而没有任何进一步的错误,我将发布修复程序。