capistrano-rbenvでCapistrano 3を使用しているときにruby gemコマンドを実行する際に問題があります(Rubyインタプリタが見つからないと仮定しています) )、特にdelayed_job。問題に関連する必要なファイルを投稿しました。Capistrano 3 rbenv問題:ロードするファイルがありません - rubygems(LoadError)
`require': no such file to load -- rubygems (LoadError)
ご協力いただければ幸いです。
Gemfile
gem 'capistrano', "~> 3.6"
gem 'capistrano-rbenv', '~> 2.0'
Capfile
# Load DSL and set up stages
require "capistrano/setup"
# Include default deployment tasks
require "capistrano/deploy"
require "capistrano/rbenv"
# 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 only for current version of Capistrano
lock '3.6.1'
set :application, 'youtube_rank_tracker'
set :repo_url, './.git'
# Default branch is :master
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp
# Default deploy_to directory is /var/www/my_app_name
set :deploy_to, '/dogecoin'
# Default value for :scm is :git
set :scm, :git
# 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'
# Default value for linked_dirs is []
# append :linked_dirs, 'log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'public/system'
# Default value for default_env is {}
# set :default_env, { path: '$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH' }
# Default value for keep_releases is 5
set :keep_releases, 5
# set :default_env, { path: "$HOME/.rbenv/bin:$PATH" }
set :rbenv_type, :user # or :system, depends on your rbenv setup
set :rbenv_ruby, '2.1.2'
set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec"
set :rbenv_map_bins, %w{rake gem bundle ruby rails}
set :rbenv_roles, :all # default value
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:all) do |host|
execute :mkdir, "-p #{release_path}/tmp"
execute :touch, release_path.join('tmp/restart.txt')
execute "cd #{release_path} && RAILS_ENV=production bin/delayed_job restart;"
# execute "cd #{release_path} && bundle exec rake -T"
end
end
end
after 'deploy:publishing', 'deploy:restart'
エラー
he deploy has failed with an error: Exception while executing as [email protected]: cd /.... && RAILS_ENV=production bin/delayed_job restart; exit status: 1
cd /.... && RAILS_ENV=production bin/delayed_job restart; stdout: /usr/lib/ruby/vendor_ruby/bundler/shared_helpers.rb:2:in `require': no such file to load -- rubygems (LoadError)
from /usr/lib/ruby/vendor_ruby/bundler/shared_helpers.rb:2
from /usr/lib/ruby/vendor_ruby/bundler/setup.rb:1:in `require'
from /usr/lib/ruby/vendor_ruby/bundler/setup.rb:1
ありがとうございます!私はcapistranoのために遅れた仕事の宝石を試しました、そして、それは正常に動作していなかった、バンドラーエラーを取得しましたが、単純にあなたが投稿したコードをエミュレートしました。 – icantbecool