Skip to content

Commit

Permalink
Add NVM/node setup for deploy.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
elohanlon committed Dec 20, 2023
1 parent 7fd4d58 commit 40db2f6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions config/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@
# Set default log level (which can be overridden by other environments)
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|
Expand Down

0 comments on commit 40db2f6

Please sign in to comment.