diff --git a/config/deploy.rb b/config/deploy.rb index 0cfa9075..23fa3048 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -24,6 +24,25 @@ # Default value for :log_level is :debug set :log_level, :info +# NVM Setup, for selecting the correct node version +# NOTE: This NVM configuration MUST be configured before the RVM setup steps because: +# This works: +# nvm exec 16 ~/.rvm-alma8/bin/rvm example_app_dev do node --version +# But this does not work: +# ~/.rvm-alma8/bin/rvm example_app_dev do nvm exec 16 node --version +set :nvm_node_version, fetch(:deploy_name) # This NVM alias must exist on the server +[:rake, :node, :npm, :yarn].each do |command_to_prefix| + SSHKit.config.command_map.prefix[command_to_prefix].push("nvm exec #{fetch(:nvm_node_version)}") +end + +# RVM Setup, for selecting the correct ruby version (instead of capistrano-rvm gem) +set :rvm_ruby_version, fetch(:deploy_name) # This RVM alias must exist on the server +[:rake, :gem, :bundle, :ruby].each do |command_to_prefix| + SSHKit.config.command_map.prefix[command_to_prefix].push( + "#{fetch(:rvm_custom_path, '~/.rvm')}/bin/rvm #{fetch(:rvm_ruby_version)} do" + ) +end + # Default value for linked_dirs is [] set :linked_dirs, fetch(:linked_dirs, []).push('log','tmp/pids', 'storage', 'public/feature-logos', 'node_modules', 'public/packs')