diff --git a/Capfile b/Capfile index 61f9e29..e5e3f32 100644 --- a/Capfile +++ b/Capfile @@ -4,6 +4,7 @@ require 'capistrano/setup' require 'capistrano/deploy' require 'capistrano/puma' +require 'capistrano/nvm' # Load the SCM plugin appropriate to your project: # diff --git a/Gemfile b/Gemfile index 6474935..eb5228a 100644 --- a/Gemfile +++ b/Gemfile @@ -30,6 +30,7 @@ group :development do gem 'binding_of_caller' gem 'capistrano', require: false gem 'capistrano3-puma', require: false + gem 'capistrano-nvm', require: false gem 'capistrano-rails', require: false gem 'capistrano-rbenv', require: false end diff --git a/Gemfile.lock b/Gemfile.lock index ff93135..043aa41 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -131,6 +131,8 @@ GEM sshkit (>= 1.9.0) capistrano-bundler (2.2.0) capistrano (~> 3.1) + capistrano-nvm (0.0.7) + capistrano (~> 3.1) capistrano-rails (1.7.0) capistrano (~> 3.1) capistrano-bundler (>= 1.1, < 3) @@ -504,6 +506,7 @@ DEPENDENCIES binding_of_caller bundle-audit capistrano + capistrano-nvm capistrano-rails capistrano-rbenv capistrano3-puma diff --git a/config/deploy.rb b/config/deploy.rb index 4872d8e..9dfc708 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -3,10 +3,19 @@ # config valid for current version and patch releases of Capistrano lock '~> 3.20.0' +set :nvm_type, :user # or :system, depends on your nvm setup +set :nvm_node, 'v24.13.1' +set :nvm_prefix, '/home/deploy/.nvm/nvm.sh' +set :nvm_map_bins, %w[node npm yarn bundle] + set :rbenv_type, :user # or :system, depends on your rbenv setup set :rbenv_ruby, File.read('.ruby-version').strip set :rbenv_prefix, - "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec" + "RBENV_ROOT=#{fetch(:rbenv_path)} " \ + "RBENV_VERSION=#{fetch(:rbenv_ruby)} " \ + "#{fetch(:nvm_prefix)} " \ + "#{fetch(:rbenv_path)}/bin/rbenv exec" + set :rbenv_map_bins, %w[rake gem bundle ruby rails puma pumactl] set :rbenv_roles, :all # default value